Commit 552f41fe authored by hongguangwu's avatar hongguangwu

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

parent 567d6873
......@@ -74,6 +74,19 @@ public class SysRoleInfoController {
return sysRoleInfoService.getInfoById(fdId);
}
/**
* @param roleIdList 角色列表
* @Description: 给前端使用:根据角色id组合获取角色权限
* @Author: hgw
* @Date: 2023/9/8 9:29
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo>
**/
@Operation(summary = "给前端使用:根据角色id组合获取角色权限", description = "给前端使用:根据角色id组合获取角色权限")
@PostMapping("/getRoleDataAuthByRoleId")
public R<String> getRoleDataAuthByRoleId(@RequestBody List<String> roleIdList) {
return R.ok(sysRoleInfoService.getRoleDataAuthByRoleId(roleIdList));
}
/**
* 新增新权限-角色表
*
......
......@@ -141,4 +141,18 @@ public class SysUserInfoController {
sysUserInfoService.doRefreshEkpUser();
}
/**
* @Description: 手动同步并更新账号信息
* @Author: hgw
* @Date: 2023/9/5 16:14
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "测试权限sql", description = "测试权限sql")
@SysLog("测试权限sql")
@PostMapping("/testPermission")
public R<String> testPermission(@RequestParam String menuId, @RequestParam(required = false) String userId) {
sysUserInfoService.testPermission(menuId, userId);
return R.ok();
}
}
......@@ -41,8 +41,31 @@ public interface SysRoleInfoMapper extends BaseMapper<SysRoleInfo> {
*/
IPage<SysRoleInfo> getSysRoleInfoPage(Page<SysRoleInfo> page, @Param("sysRoleInfo") SysRoleInfoSearchVo sysRoleInfo);
/**
* @Description: 给前端使用:根据角色id组合获取角色权限
* @Author: hgw
* @Date: 2023/9/8 9:21
* @return: java.util.List<java.lang.String>
**/
List<String> getRoleDataAuthByRoleId(@Param("roleIdList") List<String> roleIdList);
/**
* @param userId
* @Description: 获取账号的所有权限
* @Author: hgw
* @Date: 2023/9/8 9:22
* @return: java.util.List<java.lang.String>
**/
List<String> getAllRoleDataAuthByUserId(@Param("userId") String userId);
/**
* @param roleName
* @param roleId
* @Description: 查找名称是否存在
* @Author: hgw
* @Date: 2023/9/8 9:22
* @return: int
**/
int checkExistenceRole(@Param("roleName") String roleName, @Param("roleId") String roleId);
}
......@@ -69,4 +69,13 @@ public interface SysRoleInfoService extends IService<SysRoleInfo> {
**/
String getAllRoleDataAuthByUserId(String userId);
/**
* @param roleIdList
* @Description: 给前端使用:根据角色id组合获取角色权限
* @Author: hgw
* @Date: 2023/9/8 9:25
* @return: java.lang.String
**/
String getRoleDataAuthByRoleId(List<String> roleIdList);
}
......@@ -20,7 +20,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysRoleInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo;
......@@ -69,4 +68,7 @@ public interface SysUserInfoService extends IService<SysUserInfo> {
* @return: void
**/
void doRefreshEkpUser();
void testPermission(String menuId, String userId);
}
......@@ -137,6 +137,23 @@ public class SysRoleInfoServiceImpl extends ServiceImpl<SysRoleInfoMapper, SysRo
@Override
public String getAllRoleDataAuthByUserId(String userId) {
List<String> authList = baseMapper.getAllRoleDataAuthByUserId(userId);
return this.getAuths(authList);
}
/**
* @param roleIdList
* @Description: 给前端使用:根据角色id组合获取角色权限
* @Author: hgw
* @Date: 2023/9/8 9:25
* @return: java.lang.String
**/
@Override
public String getRoleDataAuthByRoleId(List<String> roleIdList) {
List<String> authList = baseMapper.getRoleDataAuthByRoleId(roleIdList);
return this.getAuths(authList);
}
private String getAuths(List<String> authList) {
StringBuilder auths = new StringBuilder();
if (authList != null && !authList.isEmpty()) {
String[] authArr;
......
......@@ -22,13 +22,14 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysUserInfoMapper;
import com.yifu.cloud.plus.v1.permission.service.SysMenuService;
import com.yifu.cloud.plus.v1.permission.service.SysRoleInfoService;
import com.yifu.cloud.plus.v1.permission.service.SysUserInfoService;
import com.yifu.cloud.plus.v1.permission.service.SysUserRoleResService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysRoleMenuRes;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysMenu;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo;
......@@ -171,4 +172,17 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
this.saveOrUpdateBatch(ekpUser);
}
private final SysMenuService sysMenuService;
@Override
public void testPermission(String menuId, String userId) {
// 测试权限
SysMenu menu = sysMenuService.getById(menuId);
if (menu != null) {
}
}
}
......@@ -113,6 +113,17 @@
where a.delete_flag = 0 and r.user_id = #{userId}
</select>
<!-- 根据角色Id获取所有的角色的权限-->
<select id="getRoleDataAuthByRoleId" resultType="java.lang.String">
SELECT
a.data_auth
FROM sys_role_info a
where a.delete_flag = 0 and a.fd_id in
<foreach item="idStr" index="index" collection="roleIdList" open="(" separator="," close=")">
#{idStr}
</foreach>
</select>
<!-- 查找名称是否存在-->
<select id="checkExistenceRole" resultType="java.lang.Integer">
SELECT
......
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