This commit is contained in:
2023-08-30 12:44:12 +08:00
parent 4c115337fb
commit da374bcccf
4 changed files with 18 additions and 1 deletions

View File

@@ -52,4 +52,7 @@ public class UserVO extends UserParam implements Serializable {
@ApiModelProperty("头像")
private String headSculpture;
@ApiModelProperty("角色编码")
private List<String> roleCode;
}

View File

@@ -39,6 +39,13 @@ public interface IRoleService extends IService<Role> {
*/
List<String> getIdByUserId(String id);
/**
* 根据角色id获取角色code
* @param list
* @return 角色名集合
*/
List<String> getCodeByList(List<String> list);
/**
* 分页查询角色列表
* @param queryParam

View File

@@ -98,6 +98,11 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
return userRoleService.getUserRoleByUserId(id).stream().map(UserRole::getRoleId).distinct().collect(Collectors.toList());
}
@Override
public List<String> getCodeByList(List<String> list) {
return this.lambdaQuery().in(Role::getId,list).list().stream().map(Role::getCode).distinct().collect(Collectors.toList());
}
@Override
public Page<RoleVO> listRole(RoleParam.QueryParam queryParam) {
QueryWrapper<RoleVO> queryWrapper = new QueryWrapper<>();

View File

@@ -269,8 +269,10 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
userVO.setDeptName(deptService.getNameByDeptId(user.getDeptId()));
userVO.setDeptLevel(dept.getPids().split(StrUtil.COMMA).length);
}
userVO.setRoleList(roleService.getIdByUserId(id));
List<String> roleList = roleService.getIdByUserId(id);
userVO.setRoleList(roleList);
userVO.setRole(roleService.getNameByUserId(id));
userVO.setRoleCode(roleService.getCodeByList(roleList));
return userVO;
}