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

2.X
疯狂的狮子Li 2 years ago
parent 8ad5f79870
commit caa58fa28c

@ -20,7 +20,8 @@ import java.util.List;
public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> { public interface SysRoleMapper extends BaseMapperPlus<SysRole, SysRoleVo> {
@DataPermission({ @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); 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 * @return
*/ */
@DataPermission({ @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); List<SysRoleVo> selectRoleList(@Param(Constants.WRAPPER) Wrapper<SysRole> queryWrapper);
@DataPermission({ @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); SysRoleVo selectRoleById(Long roleId);

@ -49,7 +49,13 @@
</select> </select>
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult"> <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} WHERE r.del_flag = '0' and u.user_name = #{userName}
</select> </select>

Loading…
Cancel
Save