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

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 + "/datadictionary")
public class DataDictionaryRouteController {

    @GetMapping("savedatadictionary/{parentId}")
    public ModelAndView saveDataDictionary(@PathVariable("parentId") String parentId) {
        ModelAndView mv = new ModelAndView("datadictionary/save");
        mv.addObject("parentId", parentId);
        return mv;
    }

    @GetMapping("updatedatadictionary/{dictionaryId}")
    public ModelAndView updateDataDictionary(@PathVariable("dictionaryId") String dictionaryId) {
        ModelAndView mv = new ModelAndView("datadictionary/update");
        mv.addObject("dictionaryId", dictionaryId);
        return mv;
    }

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

    @GetMapping("listdatadictionary/{parentId}")
    public ModelAndView listDataDictionary(@PathVariable("parentId") String parentId) {
        ModelAndView mv = new ModelAndView("datadictionary/list");
        mv.addObject("parentId", parentId);
        return mv;
    }

}
