Commit 80541317 authored by hongguangwu's avatar hongguangwu

1.5.8-hgw-权限-角色-账号

parent 18e092d7
......@@ -17,6 +17,7 @@ package com.yifu.cloud.plus.v1.yifu.permission.entity;/*
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
......@@ -63,4 +64,7 @@ public class SysUserRoleRes {
@Schema(description = "角色ID")
private String roleId;
@TableField(exist = false)
private String roleName;
}
......@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -49,4 +50,12 @@ public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> {
**/
List<SysUserInfo> getEkpUser();
List<SysUserRoleRes> getResAndRoleNameUserId(@Param("userId") String userId);
List<SysUserInfo> getAuthByUserAndMenu(@Param("menuId") String menuId, @Param("userId") String userId);
}
......@@ -120,9 +120,7 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
SysUserInfoSaveVo vo = new SysUserInfoSaveVo();
SysUserInfo user = this.getById(fdId);
if (user != null && Common.isNotNull(user.getFdId())) {
SysUserRoleResSearchVo sysRoleMenuRes = new SysUserRoleResSearchVo();
sysRoleMenuRes.setUserId(user.getFdId());
List<SysUserRoleRes> resList = sysUserRoleResService.noPageDiy(sysRoleMenuRes);
List<SysUserRoleRes> resList = baseMapper.getResAndRoleNameUserId(user.getFdId());
vo.setUser(user);
if (resList != null && !resList.isEmpty()) {
// 各种角色的权限融合
......@@ -180,6 +178,8 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
// 测试权限
SysMenu menu = sysMenuService.getById(menuId);
if (menu != null) {
// TODO
baseMapper.getAuthByUserAndMenu(menuId, userId);
}
......
......@@ -126,4 +126,26 @@
where e.fd_is_available = '1'
</select>
<!--list-->
<select id="getResAndRoleNameUserId" resultType="com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes">
SELECT
a.fd_id as fdId
,a.user_id as userId
,a.role_id as roleId
,r.role_name as roleName
FROM sys_user_role_res a
LEFT JOIN sys_role_info r on a.role_id=r.fd_id and r.delete_flag = 0 and r.status = 0
where a.user_id=#{userId}
</select>
<!--list-->
<select id="getAuthByUserAndMenu" resultMap="sysUserInfoMap">
SELECT
a.*
FROM sys_user_info a
LEFT JOIN sys_user_role_res res on a.fd_id=res.user_id
LEFT JOIN sys_role_info r on res.role_id=r.fd_id and r.delete_flag = 0 and r.status = 0
where a.fd_id=#{userId} and a.fd_id=#{menuId}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment