Commit 9936c6e3ea84c631b96ab093deaad95f08ed7930
1 parent
3e6da677
增加字典明细表查询接口
Showing
1 changed file
with
22 additions
and
0 deletions
jeecg-boot-master/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysDictItemController.java
... | ... | @@ -3,19 +3,25 @@ package org.jeecg.modules.system.controller; |
3 | 3 | |
4 | 4 | import java.util.Arrays; |
5 | 5 | import java.util.Date; |
6 | +import java.util.List; | |
6 | 7 | |
7 | 8 | import javax.servlet.http.HttpServletRequest; |
8 | 9 | |
9 | 10 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
11 | +import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |
12 | +import io.swagger.annotations.Api; | |
10 | 13 | import io.swagger.annotations.ApiOperation; |
11 | 14 | import org.apache.commons.lang.StringUtils; |
12 | 15 | import org.apache.shiro.authz.annotation.RequiresRoles; |
13 | 16 | import org.jeecg.common.api.vo.Result; |
17 | +import org.jeecg.common.aspect.annotation.AutoLog; | |
14 | 18 | import org.jeecg.common.constant.CacheConstant; |
15 | 19 | import org.jeecg.common.system.query.QueryGenerator; |
16 | 20 | import org.jeecg.common.util.oConvertUtils; |
21 | +import org.jeecg.modules.system.entity.SysDict; | |
17 | 22 | import org.jeecg.modules.system.entity.SysDictItem; |
18 | 23 | import org.jeecg.modules.system.service.ISysDictItemService; |
24 | +import org.jeecg.modules.system.service.ISysDictService; | |
19 | 25 | import org.springframework.beans.factory.annotation.Autowired; |
20 | 26 | import org.springframework.cache.annotation.CacheEvict; |
21 | 27 | import org.springframework.web.bind.annotation.RequestBody; |
... | ... | @@ -38,6 +44,7 @@ import lombok.extern.slf4j.Slf4j; |
38 | 44 | * @Author zhangweijian |
39 | 45 | * @since 2018-12-28 |
40 | 46 | */ |
47 | +@Api(tags="字典明细表") | |
41 | 48 | @RestController |
42 | 49 | @RequestMapping("/sys/dictItem") |
43 | 50 | @Slf4j |
... | ... | @@ -46,6 +53,9 @@ public class SysDictItemController { |
46 | 53 | @Autowired |
47 | 54 | private ISysDictItemService sysDictItemService; |
48 | 55 | |
56 | + @Autowired | |
57 | + private ISysDictService sysDictService; | |
58 | + | |
49 | 59 | /** |
50 | 60 | * @功能:查询字典数据 |
51 | 61 | * @param sysDictItem |
... | ... | @@ -67,6 +77,18 @@ public class SysDictItemController { |
67 | 77 | return result; |
68 | 78 | } |
69 | 79 | |
80 | + @AutoLog(value = "字典表明细-查询") | |
81 | + @ApiOperation(value="字典表明细-查询", notes="根据字典名称查所有明细") | |
82 | + @RequestMapping(value = "/listByDictCode", method = RequestMethod.GET) | |
83 | + public Result<List<SysDictItem>> listByDictCode(String dictCode, HttpServletRequest req) { | |
84 | + LambdaQueryWrapper<SysDict> query = Wrappers.lambdaQuery(); | |
85 | + query.eq(SysDict::getDictCode, dictCode); | |
86 | + SysDict dict = sysDictService.getOne(query); | |
87 | + LambdaQueryWrapper<SysDictItem> itemQuery = Wrappers.lambdaQuery(); | |
88 | + itemQuery.eq(SysDictItem::getDictId, dict.getId()).orderByAsc(SysDictItem::getSortOrder); | |
89 | + return Result.ok(sysDictItemService.list(itemQuery)); | |
90 | + } | |
91 | + | |
70 | 92 | /** |
71 | 93 | * @功能:新增 |
72 | 94 | * @return |
... | ... |