|
|
@@ -1,5 +1,8 @@
|
|
|
package cn.tr.module.sys.dict.controller;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import cn.tr.core.exception.ServiceException;
|
|
|
+import cn.tr.core.exception.TRExcCode;
|
|
|
import cn.tr.core.pojo.CommonResult;
|
|
|
import cn.tr.module.sys.dict.dto.SysDictQueryDTO;
|
|
|
import cn.tr.module.sys.dict.dto.SysDictSmallDTO;
|
|
|
@@ -33,4 +36,17 @@ public class SysDictItemController extends BaseController {
|
|
|
return CommonResult.success(dictService.selectChildrenDictsByDictCode(query.getDictCode()));
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/query/batch/list")
|
|
|
+ @ApiOperationSupport(author = "lf")
|
|
|
+ @ApiOperation(value = "批量查询相应字典下所有字典项",notes = "一次查询不能超过50个")
|
|
|
+ public CommonResult<Map<String,List<SysDictSmallDTO>>> selectBatchList(@RequestBody Set<String> codes){
|
|
|
+ Map<String, List<SysDictSmallDTO>> result = new HashMap<>();
|
|
|
+ if(CollectionUtil.size(codes)>50){
|
|
|
+ throw new ServiceException(TRExcCode.SYSTEM_ERROR_B0001,"一次批量查询字典的数量不能超过50");
|
|
|
+ }
|
|
|
+ for (String code : codes) {
|
|
|
+ result.put(code,dictService.selectChildrenDictsByDictCode(code));
|
|
|
+ }
|
|
|
+ return CommonResult.success(result);
|
|
|
+ }
|
|
|
}
|