Commit 8de9872ff8a65423ecf8e00193ff428e60acc35c

Authored by YunaiV
1 parent 9c5befaf

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

yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/dept/DeptApi.java
1 1 package cn.iocoder.yudao.module.system.api.dept;
2 2  
  3 +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
3 4 import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
4 5  
5 6 import java.util.Collection;
... ... @@ -45,6 +46,9 @@ public interface DeptApi {
45 46 * @param ids 部门编号数组
46 47 * @return 部门 Map
47 48 */
48   - Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids);
  49 + default Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
  50 + List<DeptRespDTO> list = getDepts(ids);
  51 + return CollectionUtils.convertMap(list, DeptRespDTO::getId);
  52 + }
49 53  
50 54 }
... ...
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;
9 9 import javax.annotation.Resource;
10 10 import java.util.Collection;
11 11 import java.util.List;
12   -import java.util.Map;
13   -import java.util.Set;
14 12  
15 13 /**
16 14 * 部门 API 实现类
... ... @@ -40,10 +38,4 @@ public class DeptApiImpl implements DeptApi {
40 38 deptService.validDepts(ids);
41 39 }
42 40  
43   - @Override
44   - public Map<Long, DeptRespDTO> getDeptMap(Set<Long> ids) {
45   - Map<Long, DeptDO> depts = deptService.getDeptMap(ids);
46   - return DeptConvert.INSTANCE.convertMap(depts);
47   - }
48   -
49 41 }
... ...
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 {
19 19 @NotNull(message = "日志类型不能为空")
20 20 private Integer logType;
21 21  
22   - @ApiModelProperty(value = "链路追踪编号", required = true, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
  22 + @ApiModelProperty(value = "链路追踪编号", example = "89aca178-a370-411c-ae02-3f0d672be4ab")
23 23 @NotEmpty(message = "链路追踪编号不能为空")
24 24 private String traceId;
25 25  
... ... @@ -36,8 +36,7 @@ public class LoginLogBaseVO {
36 36 @NotEmpty(message = "用户 IP 不能为空")
37 37 private String userIp;
38 38  
39   - @ApiModelProperty(value = "浏览器 UserAgent", required = true, example = "Mozilla/5.0")
40   - @NotEmpty(message = "浏览器 UserAgent 不能为空")
  39 + @ApiModelProperty(value = "浏览器 UserAgent", example = "Mozilla/5.0")
41 40 private String userAgent;
42 41  
43 42 }
... ...
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 {
18 18 @ApiModelProperty(value = "日志编号", required = true, example = "1024")
19 19 private Long id;
20 20  
21   - @ApiModelProperty(value = "用户编号", required = true, example = "666")
22   - @NotNull(message = "用户编号不能为空")
  21 + @ApiModelProperty(value = "用户编号", example = "666")
23 22 private Long userId;
24 23  
25 24 @ApiModelProperty(value = "用户类型", required = true, example = "2", notes = "参见 UserTypeEnum 枚举")
... ...
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 {
31 31  
32 32 DeptRespDTO convert03(DeptDO bean);
33 33  
34   - Map<Long, DeptRespDTO> convertMap(Map<Long, DeptDO> map);
35   -
36 34 }
... ...