package cn.com.tenlion.freemarker.controller.route.templateconfig;

import cn.com.tenlion.freemarker.service.templateconfig.ITemplateConfigService;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.common.component.SecurityComponent;
import ink.wgink.interfaces.consts.ISystemConstant;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 * @ClassName: TemplateRecordController
 * @Description: 模板页面
 * @Author: WenG
 * @Date: 2020-05-07 16:50
 * @Version: 1.0
 **/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "模板页面接口")
@RestController
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/templateconfig")
public class TemplateConfigRouteController extends DefaultBaseController {

    @Autowired
    private ITemplateConfigService templateConfigService;
    @Autowired
    private SecurityComponent securityComponent;

    @GetMapping("listtemplateconfig")
    public ModelAndView listTemplateConfig() {
        ModelAndView mv = new ModelAndView("templateconfig/list-templateconfig");
        return mv;
    }

    @GetMapping("savetemplateconfig")
    public ModelAndView saveTemplateConfig() {
        ModelAndView mv = new ModelAndView("templateconfig/save-templateconfig");
        return mv;
    }

    @GetMapping("updatetemplateconfig")
    public ModelAndView updateTemplateConfig(@RequestParam("templateConfigId") String templateConfigId) {
        ModelAndView mv = new ModelAndView("templateconfig/update-templateconfig");
        mv.addObject("templateConfigId", templateConfigId);
        return mv;
    }

    @GetMapping("updatetemplateconfigcontent")
    public ModelAndView updateTemplateconfigContent(@RequestParam("templateConfigId") String templateConfigId, @RequestParam("templateAllGenerate") String templateAllGenerate, @RequestParam("templateCode") String templateCode) {
        ModelAndView mv = new ModelAndView("templateconfig/update_templateconfig_content");
        mv.addObject("templateConfigId", templateConfigId);
        mv.addObject("templateAllGenerate", templateAllGenerate);
        mv.addObject("templateCode", templateCode);
        return mv;
    }

}