【add】用户角色分页接口返回格式修改
This commit is contained in:
parent
bb280237d9
commit
9dcbdad7f1
|
@ -2,13 +2,12 @@ package com.chint.application.dtos.system;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RolePageDto {
|
||||
private String name;
|
||||
private String employeeNo;
|
||||
private String roleName;
|
||||
private Long userId;
|
||||
private Long roleId;
|
||||
private Long roleUserId;
|
||||
private String roleDesc;
|
||||
List<RoleUserDto> roleUserDtos;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.chint.application.dtos.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoleUserDto {
|
||||
private String roleName;
|
||||
private Long roleId;
|
||||
private Long roleUserId;
|
||||
private String roleDesc;
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.chint.domain.service;
|
|||
|
||||
import com.chint.application.dtos.system.RolePageDto;
|
||||
import com.chint.application.dtos.system.RolePageQuery;
|
||||
import com.chint.application.dtos.system.RoleUserDto;
|
||||
import com.chint.domain.aggregates.user.Role;
|
||||
import com.chint.domain.aggregates.user.RoleUser;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
|
@ -54,13 +55,19 @@ public class UserDomainService {
|
|||
.filter(s -> s.getUserId().equals(temp.getUserId()))
|
||||
.toList();
|
||||
if(!roleUser.isEmpty()){
|
||||
obj.setRoleId(roleUser.get(0).getRoleId());
|
||||
obj.setRoleUserId(roleUser.get(0).getId());
|
||||
List<Role> roleList=roles.stream().filter(s->s.getId().equals(obj.getRoleId())).toList();
|
||||
List<RoleUserDto> roleUserDtos=new ArrayList<>();
|
||||
for(RoleUser roleUserObj : roleUser){
|
||||
RoleUserDto roleUserDto=new RoleUserDto();
|
||||
roleUserDto.setRoleId(roleUserObj.getRoleId());
|
||||
roleUserDto.setRoleUserId(roleUserObj.getId());
|
||||
List<Role> roleList=roles.stream().filter(s->s.getId().equals(roleUserDto.getRoleId())).toList();
|
||||
if(!roleList.isEmpty()){
|
||||
obj.setRoleName(roleList.get(0).getRoleName());
|
||||
obj.setRoleDesc(roleList.get(0).getRoleDesc());
|
||||
roleUserDto.setRoleName(roleList.get(0).getRoleName());
|
||||
roleUserDto.setRoleDesc(roleList.get(0).getRoleDesc());
|
||||
}
|
||||
roleUserDtos.add(roleUserDto);
|
||||
}
|
||||
obj.setRoleUserDtos(roleUserDtos);
|
||||
}
|
||||
return obj;
|
||||
}).toList();
|
||||
|
|
Loading…
Reference in New Issue