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

This commit is contained in:
YunaiV 2022-06-16 08:53:09 +08:00
parent 9c5befaf9d
commit 8de9872ff8
5 changed files with 8 additions and 16 deletions

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.api.dept; 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 cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import java.util.Collection; import java.util.Collection;
@ -45,6 +46,9 @@ public interface DeptApi {
* @param ids 部门编号数组 * @param ids 部门编号数组
* @return 部门 Map * @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);
}
} }

View File

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

View File

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

View File

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

View File

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