package com.cm.common.plugin.controller.routes.dataarea;

import com.cm.common.constants.ISystemConstant;
import io.swagger.annotations.Api;
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: IDataDictionaryRouteController
 * @Description: 数据字典
 * @Author: WangGeng
 * @Date: 2019/12/6 16:52
 * @Version: 1.0
 **/
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "数据字典页面接口")
@Controller
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/dataarea")
public class DataAreaRouteController {

    @GetMapping("savedataarea/{areaParentId}")
    public ModelAndView saveDataDictionary(@PathVariable("areaParentId") String areaParentId) {
        ModelAndView mv = new ModelAndView("dataarea/save");
        mv.addObject("areaParentId", areaParentId);
        return mv;
    }

    @GetMapping("updatedataarea/{areaId}")
    public ModelAndView updateDataDictionary(@PathVariable("areaId") String areaId) {
        ModelAndView mv = new ModelAndView("dataarea/update");
        mv.addObject("areaId", areaId);
        return mv;
    }

    @GetMapping("listtreedataarea")
    public ModelAndView listTreeDataDictionary() {
        ModelAndView mv = new ModelAndView("dataarea/list-tree");
        return mv;
    }

    @GetMapping("listdataarea/{areaParentId}")
    public ModelAndView listDataDictionary(@PathVariable("areaParentId") String areaParentId) {
        ModelAndView mv = new ModelAndView("dataarea/list");
        mv.addObject("areaParentId", areaParentId);
        return mv;
    }

}
