update 优化 角色权限支持仅本人权限查看 解决无法查看自己创建的角色问题

feature/model
疯狂的狮子Li 1 year ago
parent beaf3efdf5
commit 508882d21e

@ -20,7 +20,8 @@ import java.util.List;
public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> {
@DataPermission({
@DataColumn(key = "deptName", value = "d.dept_id")
@DataColumn(key = "deptName", value = "d.dept_id"),
@DataColumn(key = "userName", value = "r.create_by")
})
Page<SysRoleVo> selectPageRoleList(@Param("page") Page<SysRole> page, @Param(Constants.WRAPPER) Wrapper<SysRole> queryWrapper);
@ -31,12 +32,14 @@ public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> {
* @return
*/
@DataPermission({
@DataColumn(key = "deptName", value = "d.dept_id")
@DataColumn(key = "deptName", value = "d.dept_id"),
@DataColumn(key = "userName", value = "r.create_by")
})
List<SysRoleVo> selectRoleList(@Param(Constants.WRAPPER) Wrapper<SysRole> queryWrapper);
@DataPermission({
@DataColumn(key = "deptName", value = "d.dept_id")
@DataColumn(key = "deptName", value = "d.dept_id"),
@DataColumn(key = "userName", value = "r.create_by")
})
SysRoleVo selectRoleById(Long roleId);

@ -49,7 +49,13 @@
</select>
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
<include refid="selectRoleVo"/>
select r.role_id,
r.role_name,
r.role_key,
r.role_sort,
from sys_role r
left join sys_user_role sur on sur.role_id = r.role_id
left join sys_user u on u.user_id = sur.user_id
WHERE r.del_flag = '0' and u.user_name = #{userName}
</select>

Loading…
Cancel
Save