Pārlūkot izejas kodu

统一 DeptApi 的封装,与 yudao-cloud~

YunaiV 3 gadi atpakaļ
vecāks
revīzija
8de9872ff8

+ 5 - 1
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApi.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.system.api.dept;
 
+import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
 
 import java.util.Collection;
@@ -45,6 +46,9 @@ public interface DeptApi {
      * @param ids 部门编号数组
      * @return 部门 Map
      */
-    Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids);
+    default Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
+        List<DeptRespDTO> list = getDepts(ids);
+        return CollectionUtils.convertMap(list, DeptRespDTO::getId);
+    }
 
 }

+ 0 - 8
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApiImpl.java

@@ -9,8 +9,6 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
 
 /**
  * 部门 API 实现类
@@ -40,10 +38,4 @@ public class DeptApiImpl implements DeptApi {
         deptService.validDepts(ids);
     }
 
-    @Override
-    public Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
-        Map<Long, DeptDO> depts = deptService.getDeptMap(ids);
-        return DeptConvert.INSTANCE.convertMap(depts);
-    }
-
 }

+ 2 - 3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogBaseVO.java

@@ -19,7 +19,7 @@ public class LoginLogBaseVO {
     @NotNull(message = "日志类型不能为空")
     private Integer logType;
 
-    @ApiModelProperty(value = "链路追踪编号", required = true, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
+    @ApiModelProperty(value = "链路追踪编号", example = "89aca178-a370-411c-ae02-3f0d672be4ab")
     @NotEmpty(message = "链路追踪编号不能为空")
     private String traceId;
 
@@ -36,8 +36,7 @@ public class LoginLogBaseVO {
     @NotEmpty(message = "用户 IP 不能为空")
     private String userIp;
 
-    @ApiModelProperty(value = "浏览器 UserAgent", required = true, example = "Mozilla/5.0")
-    @NotEmpty(message = "浏览器 UserAgent 不能为空")
+    @ApiModelProperty(value = "浏览器 UserAgent", example = "Mozilla/5.0")
     private String userAgent;
 
 }

+ 1 - 2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogRespVO.java

@@ -18,8 +18,7 @@ public class LoginLogRespVO extends LoginLogBaseVO {
     @ApiModelProperty(value = "日志编号", required = true, example = "1024")
     private Long id;
 
-    @ApiModelProperty(value = "用户编号", required = true, example = "666")
-    @NotNull(message = "用户编号不能为空")
+    @ApiModelProperty(value = "用户编号", example = "666")
     private Long userId;
 
     @ApiModelProperty(value = "用户类型", required = true, example = "2", notes = "参见 UserTypeEnum 枚举")

+ 0 - 2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/dept/DeptConvert.java

@@ -31,6 +31,4 @@ public interface DeptConvert {
 
     DeptRespDTO convert03(DeptDO bean);
 
-    Map<Long, DeptRespDTO> convertMap(Map<Long, DeptDO> map);
-
 }