feat:用户管理界面新增加roles字段回显用户对应的角色信息
This commit is contained in:
parent
c65e9b72a7
commit
0ff9cd194d
|
@ -130,7 +130,6 @@ public class SysUserController {
|
|||
}
|
||||
//update-end---author:wangshuai ---date:20221223 for:[QQYUN-3371]租户逻辑改造,改成关系表------------
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------
|
||||
return sysUserService.queryPageList(req, queryWrapper, pageSize, pageNo);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -200,6 +201,9 @@ public class SysUser implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String postText;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<SysRole> roles;
|
||||
|
||||
/**
|
||||
* 流程状态
|
||||
*/
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.system.mapper;
|
|||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.jeecg.modules.system.entity.SysRole;
|
||||
import org.jeecg.modules.system.entity.SysUserRole;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
|
@ -32,4 +33,11 @@ public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
|
|||
@Select("select id from sys_role where id in (select role_id from sys_user_role where user_id = (select id from sys_user where username=#{username}))")
|
||||
List<String> getRoleIdByUserName(@Param("username") String username);
|
||||
|
||||
/**
|
||||
* 通过用户账号查询角色集合
|
||||
* @param username 用户账号名称
|
||||
* @return List<String>
|
||||
*/
|
||||
@Select("select id,role_name from sys_role where id in (select role_id from sys_user_role where user_id = (select id from sys_user where username=#{username}))")
|
||||
List<SysRole> getRolesByUserName(@Param("username") String username);
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
}
|
||||
//update-end---author:wangshuai ---date:20220322 for:[issues/I4XTYB]查询用户时,当部门id 下没有分配用户时接口报错------------
|
||||
}
|
||||
|
||||
//用户ID
|
||||
String code = req.getParameter("code");
|
||||
if (oConvertUtils.isNotEmpty(code)) {
|
||||
|
@ -151,12 +152,13 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
} else {
|
||||
item.setRelTenantIds("");
|
||||
}
|
||||
List<SysRole> userRoles = sysUserRoleMapper.getRolesByUserName(item.getUsername());
|
||||
item.setRoles(userRoles);
|
||||
});
|
||||
}
|
||||
|
||||
result.setSuccess(true);
|
||||
result.setResult(pageList);
|
||||
//log.info(pageList.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user