Explorar o código

feat:
字典新增批量查询方式
createTime、updateTime改为只读字段

18339543638 %!s(int64=2) %!d(string=hai) anos
pai
achega
f7876066b9

+ 16 - 0
tr-modules/tr-module-system/src/main/java/cn/tr/module/sys/dict/controller/SysDictItemController.java

@@ -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);
+    }
 }

+ 6 - 0
tr-plugins/tr-spring-boot-starter-plugin-mybatis/pom.xml

@@ -70,5 +70,11 @@
             <groupId>com.alibaba</groupId>
             <artifactId>druid-spring-boot-starter</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>com.github.xiaoymin</groupId>
+            <artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 </project>

+ 3 - 0
tr-plugins/tr-spring-boot-starter-plugin-mybatis/src/main/java/cn/tr/plugin/mybatis/pojo/BaseDTO.java

@@ -1,6 +1,7 @@
 package cn.tr.plugin.mybatis.pojo;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -20,11 +21,13 @@ public class BaseDTO implements Serializable {
      * 创建时间
      */
     @JsonIgnoreProperties(allowGetters = true)
+    @ApiModelProperty(readOnly = true)
     private Date createTime;
 
     /**
      * 最后更新时间
      */
     @JsonIgnoreProperties(allowGetters = true)
+    @ApiModelProperty(readOnly = true)
     private Date updateTime;
 }