package com.cm.common.plugin.controller.routes.dynamic.config;

import com.cm.common.constants.ISystemConstant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: DynamicConfigMainRouteController
 * @Description: 动态配置-表
 * @Author: WangGeng
 * @Date: 2019/12/7 4:36 下午
 * @Version: 1.0
 **/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "动态配置-表接口")
@Controller
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/dynamicconfigtable")
public class DynamicConfigTableRouteController {

    @ApiOperation(value = "新增页面", notes = "新增页面接口")
    @GetMapping("save")
    public ModelAndView save() {
        ModelAndView mv = new ModelAndView("dynamic/config/save");
        return mv;
    }

    @ApiOperation(value = "编辑页面", notes = "编辑页面接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "id", paramType = "path")
    })
    @GetMapping("update/{id}")
    public ModelAndView update(@PathVariable("id") String id) {
        ModelAndView mv = new ModelAndView("dynamic/config/update");
        mv.addObject("id", id);
        return mv;
    }

    @ApiOperation(value = "列表页面", notes = "列表页面接口")
    @GetMapping("list")
    public ModelAndView list() {
        ModelAndView mv = new ModelAndView("dynamic/config/list");
        return mv;
    }

    @ApiOperation(value = "生成模板页面", notes = "生成模板页面接口")
    @GetMapping("getgeneratorcode/{id}")
    public ModelAndView getGeneratorCode(@PathVariable("id") String id) {
        ModelAndView mv = new ModelAndView("dynamic/config/get-generator-code");
        mv.addObject("id", id);
        return mv;
    }

    @ApiOperation(value = "生成空项目页面", notes = "生成空项目页面接口")
    @GetMapping("getgeneratoremptyproject")
    public ModelAndView getGeneratorEmptyProject() {
        ModelAndView mv = new ModelAndView("dynamic/config/get-generator-empty-project");
        return mv;
    }

}
