package com.railway.web.controller.system;

import com.railway.common.config.RailwayConfig;
import com.railway.common.core.controller.BaseController;
import com.railway.common.utils.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 首页 业务处理
 *
 * @author railway
 */
@RestController
public class SysIndexController extends BaseController {

  /**
   * 系统基础配置
   */
  private final RailwayConfig railwayConfig;

  public SysIndexController(RailwayConfig railwayConfig) {
    this.railwayConfig = railwayConfig;
  }

  /**
   * 访问首页，提示语
   */
  @RequestMapping("/")
  public String index() {
    return StringUtils.format("欢迎使用{}后台管理框架，当前版本：v{}，请通过前端地址访问。",
        railwayConfig.getName(), railwayConfig.getVersion());
  }
}
