Commit bfe2c0d7 by zhu.zewen

修复用户部门

parent db633520
...@@ -17,6 +17,9 @@ import static com.jmai.sys.service.UserService.KEY_ALL; ...@@ -17,6 +17,9 @@ import static com.jmai.sys.service.UserService.KEY_ALL;
@Data @Data
@ApiModel(description = "用户信息") @ApiModel(description = "用户信息")
public class FullUserDto extends UserDto implements IDataPerms { public class FullUserDto extends UserDto implements IDataPerms {
@ApiModelProperty(value = "组织名称")
private String deptName;
@ApiModelProperty(value = "授权组织(编号)列表(逗号隔开)") @ApiModelProperty(value = "授权组织(编号)列表(逗号隔开)")
private String authDeptIdList; private String authDeptIdList;
@ApiModelProperty(value = "授权组织(名称)列表(逗号隔开)") @ApiModelProperty(value = "授权组织(名称)列表(逗号隔开)")
......
...@@ -5,8 +5,8 @@ import lombok.Data; ...@@ -5,8 +5,8 @@ import lombok.Data;
@Data @Data
public class PageReq extends BaseReq { public class PageReq extends BaseReq {
@ApiModelProperty(value = "页码",notes = "默认页码为1") @ApiModelProperty(value = "页码",notes = "默认页码为1", example = "1")
private Integer pageNo = 1; private Integer pageNo = 1;
@ApiModelProperty(value = "大小",notes = "默认分页大小为10") @ApiModelProperty(value = "大小",notes = "默认分页大小为10", example = "10")
private Integer pageSize = 10; private Integer pageSize = 10;
} }
...@@ -122,7 +122,10 @@ public class UserServiceImpl extends AbstractService implements UserService { ...@@ -122,7 +122,10 @@ public class UserServiceImpl extends AbstractService implements UserService {
// 填充组织 // 填充组织
List<Long> deptIdList = dtoList.stream() List<Long> deptIdList = dtoList.stream()
.flatMap(user -> user.getAuthDeptAsList().stream()) .flatMap(user -> Stream.concat(
Stream.of(user.getDeptId()),
user.getAuthDeptAsList().stream()
))
.filter(ObjectUtil::isNotEmpty) .filter(ObjectUtil::isNotEmpty)
.distinct() .distinct()
.collect(Collectors.toList()); .collect(Collectors.toList());
...@@ -135,6 +138,8 @@ public class UserServiceImpl extends AbstractService implements UserService { ...@@ -135,6 +138,8 @@ public class UserServiceImpl extends AbstractService implements UserService {
Map<Long, RoleTypeDTO> roleMap = roles.stream().collect(Collectors.toMap(RoleTypeDTO::getId, Function.identity())); Map<Long, RoleTypeDTO> roleMap = roles.stream().collect(Collectors.toMap(RoleTypeDTO::getId, Function.identity()));
dtoList.forEach(dto -> { dtoList.forEach(dto -> {
dto.setDeptName(extractDeptNameList(Optional.ofNullable(dto.getDeptId()).map(Object::toString).orElse(""), deptMap));
dto.setAuthDeptIdList(extractDeptIdList(dto.getAuthDeptList(), deptMap)); dto.setAuthDeptIdList(extractDeptIdList(dto.getAuthDeptList(), deptMap));
dto.setAuthDeptNameList(extractDeptNameList(dto.getAuthDeptList(), deptMap)); dto.setAuthDeptNameList(extractDeptNameList(dto.getAuthDeptList(), deptMap));
...@@ -287,7 +292,7 @@ public class UserServiceImpl extends AbstractService implements UserService { ...@@ -287,7 +292,7 @@ public class UserServiceImpl extends AbstractService implements UserService {
// 按组织ID列表查询 // 按组织ID列表查询
List<Long> deptList = extractLongList(req.getDeptList()); List<Long> deptList = extractLongList(req.getDeptList());
query.eq(ObjectUtil.isNotEmpty(deptList), SysUser::getDeptId, deptList.get(0)); query.in(ObjectUtil.isNotEmpty(deptList), SysUser::getDeptId, deptList);
// 按角色ID列表查询 // 按角色ID列表查询
List<Long> roleList = extractLongList(req.getRoleList()); List<Long> roleList = extractLongList(req.getRoleList());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment