jyy
2021-01-25 949efdc17fa833f6511c0e5902057f3be0fe72c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.matrix.system.hive.action;
 
import java.util.List;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
 
import com.matrix.core.pojo.AjaxResult;
import com.matrix.core.pojo.PaginationVO;
import com.matrix.system.constance.Dictionary;
import com.matrix.system.hive.action.util.QueryUtil;
import com.matrix.system.common.bean.SystemDictionary;
import com.matrix.system.common.service.SystemDictionaryService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
 
import com.matrix.core.anotations.RemoveRequestToken;
import com.matrix.core.anotations.SaveRequestToken;
 
/**
 * 
 * @description 单位管理
 * @author chen
 * @date 2016年12月18日
 */
@Controller
@RequestMapping(value = "admin/unit")
public class UnitController extends BaseController {
 
 
 
    // 数据字典
    @Resource
    private SystemDictionaryService currentService;
 
    @RequestMapping(value = "/showList")
    public @ResponseBody
    AjaxResult showList(HttpServletRequest request, SystemDictionary dictionary,
                        PaginationVO pageVo) {
 
        QueryUtil.setQueryLimit(dictionary);
        //设置类型为计量单位
        dictionary.setType(Dictionary.DICTIONARY_UNIT);
        return showList(currentService, dictionary, pageVo);
    }
 
    @RequestMapping(value = "/addOrModify")
    @RemoveRequestToken
    public @ResponseBody AjaxResult addOrModify(SystemDictionary dictionary) {
        if (dictionary.getId() != null) {
 
            return modify(currentService, dictionary, "计量单位");
        } else {
 
            QueryUtil.setQueryLimit(dictionary);
            dictionary.setType(Dictionary.DICTIONARY_UNIT);
            return add(currentService, dictionary, "计量单位");
        }
    }
 
    @RequestMapping(value = "/del")
    public @ResponseBody AjaxResult del(String keys) {
 
        return remove(currentService, keys);
    }
 
    @RequestMapping(value = "/editForm")
    @SaveRequestToken
    public String editForm(Long id, HttpServletRequest request) {
        SystemDictionary dictionary;
        if (id != null) {
            dictionary = currentService.findById(id);
            request.setAttribute("obj", dictionary);
        }
        return "admin/hive/store/unit-form";
    }
    @RequestMapping(value = "/getUnitName")
    public @ResponseBody AjaxResult getDictionaryType() {
        SystemDictionary data = new SystemDictionary();
        QueryUtil.setQueryLimit(data);
        data.setType(Dictionary.DICTIONARY_UNIT);
        List<SystemDictionary> dics = currentService.findByModel(data);
        return new AjaxResult(AjaxResult.STATUS_SUCCESS, dics, 0);
    }
}