liuxiaolong
2019-05-06 f99bc8c6a1d10610373738edd7d0aa0181c81d99
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package com.cloud.user.controller;
 
import com.cloud.model.common.Result;
import com.cloud.model.sys.SysDict;
import com.cloud.user.filter.AuthNoneIgnore;
import com.cloud.user.service.SysDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
 
import java.util.Map;
 
/**
 *学校组织机构字典控制层
 */
@Slf4j
@Api(value = "SysDictController", description = "学校组织机构字典控制层")
@RequestMapping("/data/api-u/")
@RestController
public class SysDictController {
 
    @Autowired
    private SysDictService sysDictService;
 
    /**
     * 查询系统字典集合
     * @param params
     * @return
     */
    @ApiOperation(value = "查询系统字典集合", notes = "查询系统字典集合", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orgId", value = "登录人的orgId", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "字典类型", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "module", value = "字典所属模块", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "start", value = "起始页", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "length", value = "长度", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "name", value = "字典名称模糊查询", required = true, dataType = "String", paramType = "query")
    })
    @RequestMapping("/dict/getSysDicts")
    public Map<String,Object> getSysDicts(@RequestParam Map<String,Object> params){
 
        return sysDictService.getSysDicts(params);
    }
 
    /**
     * 系统字典集合添加
     * @param sysDict
     * @return
     */
    @ApiOperation(value = "系统字典集合添加", notes = "系统字典集合添加", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orgId", value = "学校id或登录人orgId", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "parentId", value = "父级ID", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "value", value = "value值字典值", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "lable", value = "lable值字典名称", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "字典类型", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "module", value = "字典所属模块", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sort", value = "字典排序值", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "scope", value = "系统级还是用户级", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "description", value = "字典描述信息", required = true, dataType = "String", paramType = "query"),
    })
    @PostMapping("/dict/SysDicts/save")
    public Map<String,Object> saveSysDict(@RequestBody SysDict sysDict){
 
        return sysDictService.saveSysDicts(sysDict);
    }
 
    /**
     * 系统字典修改
     * @param sysDict
     * @return
     */
    @ApiOperation(value = "系统字典修改", notes = "系统字典修改", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "字典id", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "parentId", value = "父级ID", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "value", value = "value值字典值", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "lable", value = "lable值字典名称", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "字典类型", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "module", value = "字典所属模块", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "sort", value = "字典排序值", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "scope", value = "系统级还是用户级", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "description", value = "字典描述信息", required = true, dataType = "String", paramType = "query"),
    })
    @PostMapping("/dict/SysDicts/update")
    public Map<String,Object> updateSysDict(@RequestBody SysDict sysDict){
 
        return sysDictService.updateSysDicts(sysDict);
    }
 
    /**
     * 系统字典修改回显
     * @param id
     * @return
     */
    @ApiOperation(value = "系统字典修改回显", notes = "系统字典修改回显", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "字典id", required = true, dataType = "String", paramType = "query"),
    })
    @GetMapping("/dict/SysDicts/findSysById")
    public Result findSysById(@RequestParam("id") Integer id){
        SysDict sysDict = sysDictService.findSysById(id);
        if(sysDict != null){
            return Result.custom("查询成功!",0,true,sysDict);
        }
        return Result.custom("暂无数据!",1,false,sysDict);
    }
 
    /**
     * 系统字典删除
     * @param id
     * @return
     */
    @ApiOperation(value = "系统字典删除", notes = "系统字典删除", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "字典id", required = true, dataType = "String", paramType = "query"),
    })
    @GetMapping("/dict/SysDicts/delete")
    public Map<String,Object> deleteSysDict(@RequestParam("id") Integer id){
        return sysDictService.deleteSysDicts(id);
    }
 
    /**
     * 系统字典展示查询
     * @param params
     * @return id,value,lable
     */
    @ApiOperation(value = "系统字典展示查询", notes = "系统字典展示查询", httpMethod = "GET", produces = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orgId", value = "组织机构id", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "字典类型", required = true, dataType = "String", paramType = "query"),
            @ApiImplicitParam(name = "module", value = "字典所属模块", required = false, dataType = "String", paramType = "query")
    })
    @GetMapping("/dict/getSysDictByType")
    public Map<String,Object> getSysDictByType(@RequestParam Map<String,Object> params){
 
        return sysDictService.getSysDictByType(params);
    }
 
}