CustomDictController.java
2.1 KB
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
package com.skua.modules.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
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.RestController;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.api.vo.TreeData;
import com.skua.modules.system.entity.CustomDictVO;
import com.skua.modules.system.service.ICustomDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
/**
* 自定义字典查询
*/
@Api(tags="自定义字典查询")
@ApiIgnore
@RestController
@RequestMapping("/v1/sys/customDict")
public class CustomDictController {
@Autowired
private ICustomDictService customDictService;
/**
* 根据字典类型获取字典项
* @param dictCode
* @param req
* @return
*/
@AutoLog(value = "获取字典项")
@ApiOperation(value="获取字典项", notes="获取字典项")
@GetMapping(value = "/queryDictItemsByCode")
public Result<List<CustomDictVO>> queryDictItemsByCode(String dictCode,HttpServletRequest req) {
Result<List<CustomDictVO>> result = new Result<List<CustomDictVO>>();
List<CustomDictVO> dictItems = customDictService.queryDictItemsByCode(dictCode);
result.setSuccess(true);
result.setResult(dictItems);
return result;
}
/**
* 根据字典类型获取树形字典结构
* @param dictCode
* @param req
* @return
*/
@AutoLog(value = "获取树形结构字典")
@ApiOperation(value="获取树形结构字典", notes="获取树形结构字典")
@GetMapping(value = "/dictTree")
public Result<List<TreeData>> queryDictTree(String dictCode,HttpServletRequest req) {
Result<List<TreeData>> result = new Result<List<TreeData>>();
List<TreeData> treeDates = customDictService.queryDictItemsTreeByCode(dictCode);
result.setSuccess(true);
result.setResult(treeDates);
return result;
}
}