Commit ec54df36 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.5.8' into MVP1.5.8

parents 5fd3f109 68d017a8
...@@ -39,6 +39,12 @@ public class SysUserPermission extends BaseEntity { ...@@ -39,6 +39,12 @@ public class SysUserPermission extends BaseEntity {
@Schema(description = "登录账号") @Schema(description = "登录账号")
private String empLoginName; private String empLoginName;
/**
* 用户id
*/
@Schema(description = "用户id")
private String userId;
/** /**
* 所在部门 * 所在部门
*/ */
...@@ -46,7 +52,8 @@ public class SysUserPermission extends BaseEntity { ...@@ -46,7 +52,8 @@ public class SysUserPermission extends BaseEntity {
private String empDept; private String empDept;
/** /**
* 权限类型 * 权限类型 客户、商机、报价单、
* 1客户权限;2商机;3报价单;4合同;5项目;6BU;7条线;8部门;9收入归属
*/ */
@Schema(description = "权限类型") @Schema(description = "权限类型")
private String permissionType; private String permissionType;
......
...@@ -17,6 +17,7 @@ package com.yifu.cloud.plus.v1.yifu.permission.entity;/* ...@@ -17,6 +17,7 @@ package com.yifu.cloud.plus.v1.yifu.permission.entity;/*
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
...@@ -63,4 +64,10 @@ public class SysUserRoleRes { ...@@ -63,4 +64,10 @@ public class SysUserRoleRes {
@Schema(description = "角色ID") @Schema(description = "角色ID")
private String roleId; private String roleId;
@TableField(exist = false)
private String roleName;
@TableField(exist = false)
private String userName;
} }
...@@ -36,6 +36,14 @@ public class SysUserPermissionVo extends RowIndex implements Serializable { ...@@ -36,6 +36,14 @@ public class SysUserPermissionVo extends RowIndex implements Serializable {
@Schema(description = "登录账号") @Schema(description = "登录账号")
@ExcelProperty("登录账号") @ExcelProperty("登录账号")
private String empLoginName; private String empLoginName;
/**
* 用户id
*/
@Schema(description = "用户id")
@ExcelAttribute(name = "用户id",isExport = false)
private String userId;
/** /**
* 所属部门 * 所属部门
*/ */
......
...@@ -151,8 +151,19 @@ public class SysUserInfoController { ...@@ -151,8 +151,19 @@ public class SysUserInfoController {
@SysLog("测试权限sql") @SysLog("测试权限sql")
@PostMapping("/testPermission") @PostMapping("/testPermission")
public R<String> testPermission(@RequestParam String menuId, @RequestParam(required = false) String userId) { public R<String> testPermission(@RequestParam String menuId, @RequestParam(required = false) String userId) {
sysUserInfoService.testPermission(menuId, userId); return R.ok(sysUserInfoService.testPermission(menuId, userId));
return R.ok();
} }
/**
* 简单分页查询
*
* @param page 分页对象
* @param code 新权限-账号管理表
* @return
*/
@Operation(description = "根据编码或者登录名简单分页查询")
@GetMapping("/getUserByCodeOrLoginName")
public R<IPage<SysUserInfo>> getUserByCodeOrLoginName(Page<SysUserInfo> page, String code) {
return new R<>(sysUserInfoService.getUserByCodeOrLoginName(page, code));
}
} }
...@@ -42,7 +42,7 @@ public class SysUserPermissionController { ...@@ -42,7 +42,7 @@ public class SysUserPermissionController {
* @param sysUserPermission 新权限-用户权限表 * @param sysUserPermission 新权限-用户权限表
* @return * @return
*/ */
@Operation(description = "简单分页查询") @Operation(summary = "简单分页查询",description = "简单分页查询")
@GetMapping("/page") @GetMapping("/page")
public R<IPage<SysUserPermission>> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission) { public R<IPage<SysUserPermission>> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission) {
return new R<>(sysUserPermissionService.getSysUserPermissionPage(page, sysUserPermission)); return new R<>(sysUserPermissionService.getSysUserPermissionPage(page, sysUserPermission));
...@@ -66,7 +66,7 @@ public class SysUserPermissionController { ...@@ -66,7 +66,7 @@ public class SysUserPermissionController {
* @param sysUserPermission 新权限-用户权限表 * @param sysUserPermission 新权限-用户权限表
* @return R * @return R
*/ */
@Operation(description = "新增用户权限表:hasPermission('permission_sysuserpermission_add')") @Operation(summary = "新增用户权限表",description = "新增用户权限表:hasPermission('permission_sysuserpermission_add')")
@SysLog("新增用户权限表") @SysLog("新增用户权限表")
@PostMapping("/savePermission") @PostMapping("/savePermission")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission_add')") @PreAuthorize("@pms.hasPermission('permission_sysuserpermission_add')")
...@@ -80,7 +80,7 @@ public class SysUserPermissionController { ...@@ -80,7 +80,7 @@ public class SysUserPermissionController {
* @param sysUserPermissionList 用户权限表list * @param sysUserPermissionList 用户权限表list
* @return R * @return R
*/ */
@Operation(description = "修改用户权限表:hasPermission('permission_sysuserpermission_edit')") @Operation(summary = "修改用户权限表",description = "修改用户权限表:hasPermission('permission_sysuserpermission_edit')")
@SysLog("修改用户权限表") @SysLog("修改用户权限表")
@PostMapping("/updatePermission") @PostMapping("/updatePermission")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission_edit')") @PreAuthorize("@pms.hasPermission('permission_sysuserpermission_edit')")
...@@ -97,7 +97,7 @@ public class SysUserPermissionController { ...@@ -97,7 +97,7 @@ public class SysUserPermissionController {
* @param idList * @param idList
* @return R * @return R
*/ */
@Operation(description = "通过id删除用户权限表:hasPermission('permission_sysuserpermission_del')") @Operation(summary = "通过id删除用户权限表",description = "通过id删除用户权限表:hasPermission('permission_sysuserpermission_del')")
@SysLog("通过id删除用户权限表") @SysLog("通过id删除用户权限表")
@PostMapping("/deleteByIds") @PostMapping("/deleteByIds")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission_del')") @PreAuthorize("@pms.hasPermission('permission_sysuserpermission_del')")
...@@ -112,7 +112,7 @@ public class SysUserPermissionController { ...@@ -112,7 +112,7 @@ public class SysUserPermissionController {
* @date 2023-08-29 14:49:40 * @date 2023-08-29 14:49:40
**/ **/
@SneakyThrows @SneakyThrows
@Operation(description = "批量新增用户权限表 hasPermission('permission_sysuserpermission-batch-import')") @Operation(summary = "批量新增用户权限表",description = "批量新增用户权限表 hasPermission('permission_sysuserpermission-batch-import')")
@SysLog("批量新增用户权限表") @SysLog("批量新增用户权限表")
@PostMapping("/importListAdd") @PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission-batch-import')") @PreAuthorize("@pms.hasPermission('permission_sysuserpermission-batch-import')")
...@@ -126,7 +126,7 @@ public class SysUserPermissionController { ...@@ -126,7 +126,7 @@ public class SysUserPermissionController {
* @author hyc * @author hyc
* @date 2023-08-29 14:49:40 * @date 2023-08-29 14:49:40
**/ **/
@Operation(description = "导出用户权限表") @Operation(summary = "导出用户权限表",description = "导出用户权限表")
@PostMapping("/export") @PostMapping("/export")
@SysLog("批量导出用户权限表") @SysLog("批量导出用户权限表")
public void export(HttpServletResponse response, @RequestBody SysUserPermissionSearchVo searchVo) { public void export(HttpServletResponse response, @RequestBody SysUserPermissionSearchVo searchVo) {
...@@ -140,7 +140,7 @@ public class SysUserPermissionController { ...@@ -140,7 +140,7 @@ public class SysUserPermissionController {
* @param searchVo 新权限-用户权限表 * @param searchVo 新权限-用户权限表
* @return * @return
*/ */
@Operation(description = "根据名称,编码模糊搜索") @Operation(summary = "根据名称,编码模糊搜索",description = "根据名称,编码模糊搜索")
@GetMapping("/customerPage") @GetMapping("/customerPage")
public R<IPage<SysUserDeptVo>> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo) { public R<IPage<SysUserDeptVo>> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo) {
return new R<>(sysUserPermissionService.getNameCodePage(page,searchVo)); return new R<>(sysUserPermissionService.getNameCodePage(page,searchVo));
...@@ -152,7 +152,7 @@ public class SysUserPermissionController { ...@@ -152,7 +152,7 @@ public class SysUserPermissionController {
* @param type 字典类型 * @param type 字典类型
* @return * @return
*/ */
@Operation(description = "根据类型查询字典值") @Operation(summary = "根据类型查询字典值",description = "根据类型查询字典值")
@PostMapping("/selectDictByType") @PostMapping("/selectDictByType")
public R<List<SysDictVo>> selectDictByType(@RequestParam String type) { public R<List<SysDictVo>> selectDictByType(@RequestParam String type) {
return new R<>(sysUserPermissionService.selectDictByType(type)); return new R<>(sysUserPermissionService.selectDictByType(type));
......
...@@ -56,6 +56,16 @@ public class SysUserRoleResController { ...@@ -56,6 +56,16 @@ public class SysUserRoleResController {
return R.ok(sysUserRoleResService.noPageDiy(sysUserRoleRes)); return R.ok(sysUserRoleResService.noPageDiy(sysUserRoleRes));
} }
/**
* 根据角色id获取被使用的账号名称
* @return
*/
@Operation(summary = "根据角色id获取被使用的账号名称", description = "根据角色id获取被使用的账号名称")
@GetMapping("/getSysUserByRoleId")
public R<List<String>> getSysUserByRoleId(@RequestParam String roleId) {
return R.ok(sysUserRoleResService.getSysUserByRoleId(roleId));
}
/** /**
* 通过id查询新权限-账号-角色关联表 * 通过id查询新权限-账号-角色关联表
* *
......
...@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.SysUserInfo;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -49,4 +50,23 @@ public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> { ...@@ -49,4 +50,23 @@ public interface SysUserInfoMapper extends BaseMapper<SysUserInfo> {
**/ **/
List<SysUserInfo> getEkpUser(); List<SysUserInfo> getEkpUser();
List<SysUserRoleRes> getResAndRoleNameUserId(@Param("userId") String userId);
/**
* @Description: 获取列表是否全量的权限
* @Author: hgw
* @Date: 2023/9/8 17:00
* @return: java.lang.int
**/
int getAuthByUserIdAndMenuId(@Param("menuId") String menuId, @Param("userId") String userId);
/**
* @Description: 根据编码或者登录名简单分页查询
* @Author: huyc
* @Date: 2023/9/11 10:00
* @return:
**/
IPage<SysUserInfo> getUserByCodeOrLoginName(Page<SysUserInfo> page, @Param("code") String code);
} }
...@@ -109,6 +109,14 @@ public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> { ...@@ -109,6 +109,14 @@ public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
*/ */
List<SysDictVo> selectDictByType(@Param("type") String type); List<SysDictVo> selectDictByType(@Param("type") String type);
/**
* 根据类型查询字典值
*
* @param type 类型
* @return
*/
List<SysDictVo> selectDictByTypeOne(@Param("type") String type,@Param("userId") String userId);
/** /**
* 根据类型和名称判断字典值是否存在 * 根据类型和名称判断字典值是否存在
* *
......
...@@ -22,6 +22,8 @@ import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes; ...@@ -22,6 +22,8 @@ import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserRoleRes;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 新权限-账号-角色关联表 * 新权限-账号-角色关联表
* *
...@@ -38,6 +40,15 @@ public interface SysUserRoleResMapper extends BaseMapper<SysUserRoleRes> { ...@@ -38,6 +40,15 @@ public interface SysUserRoleResMapper extends BaseMapper<SysUserRoleRes> {
*/ */
IPage<SysUserRoleRes> getSysUserRoleResPage(Page<SysUserRoleRes> page, @Param("sysUserRoleRes") SysUserRoleRes sysUserRoleRes); IPage<SysUserRoleRes> getSysUserRoleResPage(Page<SysUserRoleRes> page, @Param("sysUserRoleRes") SysUserRoleRes sysUserRoleRes);
/**
* @param roleId
* @Description: 根据角色id获取被使用的账号名称
* @Author: hgw
* @Date: 2023/9/8 17:38
* @return: java.util.List<java.lang.String>
**/
List<String> getSysUserByRoleId(@Param("roleId") String roleId);
boolean deleteByUserId(@Param("userId") String userId); boolean deleteByUserId(@Param("userId") String userId);
boolean deleteByRoleId(@Param("roleId") String roleId); boolean deleteByRoleId(@Param("roleId") String roleId);
......
...@@ -69,6 +69,14 @@ public interface SysUserInfoService extends IService<SysUserInfo> { ...@@ -69,6 +69,14 @@ public interface SysUserInfoService extends IService<SysUserInfo> {
**/ **/
void doRefreshEkpUser(); void doRefreshEkpUser();
void testPermission(String menuId, String userId); /**
* @Description: 给EKP用的,获取权限
* @Author: hgw
* @Date: 2023/9/8 16:35
* @return: java.lang.String
**/
String testPermission(String menuId, String userId);
IPage<SysUserInfo> getUserByCodeOrLoginName(Page<SysUserInfo> page, String code);
} }
...@@ -25,6 +25,15 @@ public interface SysUserRoleResService extends IService<SysUserRoleRes> { ...@@ -25,6 +25,15 @@ public interface SysUserRoleResService extends IService<SysUserRoleRes> {
List<SysUserRoleRes> noPageDiy(SysUserRoleResSearchVo searchVo); List<SysUserRoleRes> noPageDiy(SysUserRoleResSearchVo searchVo);
/**
* @param roleId
* @Description: 根据角色id获取被使用的账号名称
* @Author: hgw
* @Date: 2023/9/8 17:38
* @return: java.util.List<java.lang.String>
**/
List<String> getSysUserByRoleId(String roleId);
/** /**
* @param userId * @param userId
* @Description: 根据账号删除关联表 * @Description: 根据账号删除关联表
......
...@@ -76,7 +76,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl ...@@ -76,7 +76,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
if (errorStr.length() > 0) { if (errorStr.length() > 0) {
return R.failed(errorStr.substring(0, errorStr.lastIndexOf(";"))); return R.failed(errorStr.substring(0, errorStr.lastIndexOf(";")));
} }
menu.setPermissionType(permissionType.substring(0, errorStr.lastIndexOf("、"))); menu.setPermissionType(permissionType.substring(0, permissionType.lastIndexOf("、")));
int res = baseMapper.insert(menu); int res = baseMapper.insert(menu);
if (res <= CommonConstants.ZERO_INT) { if (res <= CommonConstants.ZERO_INT) {
return R.failed(); return R.failed();
...@@ -95,7 +95,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl ...@@ -95,7 +95,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
if (errorStr.length() > 0) { if (errorStr.length() > 0) {
return R.failed(errorStr.substring(0, errorStr.lastIndexOf(";"))); return R.failed(errorStr.substring(0, errorStr.lastIndexOf(";")));
} }
menu.setPermissionType(permissionType.substring(0, errorStr.lastIndexOf("、"))); menu.setPermissionType(permissionType.substring(0, permissionType.lastIndexOf("、")));
baseMapper.updateById(menu); baseMapper.updateById(menu);
return R.ok(); return R.ok();
} }
......
...@@ -34,7 +34,6 @@ import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserInfo; ...@@ -34,7 +34,6 @@ 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.entity.SysUserRoleRes;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSaveVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo; import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserRoleResSearchVo;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -120,9 +119,7 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs ...@@ -120,9 +119,7 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
SysUserInfoSaveVo vo = new SysUserInfoSaveVo(); SysUserInfoSaveVo vo = new SysUserInfoSaveVo();
SysUserInfo user = this.getById(fdId); SysUserInfo user = this.getById(fdId);
if (user != null && Common.isNotNull(user.getFdId())) { if (user != null && Common.isNotNull(user.getFdId())) {
SysUserRoleResSearchVo sysRoleMenuRes = new SysUserRoleResSearchVo(); List<SysUserRoleRes> resList = baseMapper.getResAndRoleNameUserId(user.getFdId());
sysRoleMenuRes.setUserId(user.getFdId());
List<SysUserRoleRes> resList = sysUserRoleResService.noPageDiy(sysRoleMenuRes);
vo.setUser(user); vo.setUser(user);
if (resList != null && !resList.isEmpty()) { if (resList != null && !resList.isEmpty()) {
// 各种角色的权限融合 // 各种角色的权限融合
...@@ -175,14 +172,64 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs ...@@ -175,14 +172,64 @@ public class SysUserInfoServiceImpl extends ServiceImpl<SysUserInfoMapper, SysUs
private final SysMenuService sysMenuService; private final SysMenuService sysMenuService;
/**
* @param menuId
* @param userId
* @Description: 给EKP用的,获取权限
* @Author: hgw
* @Date: 2023/9/8 16:04
* @return: void
**/
@Override @Override
public void testPermission(String menuId, String userId) { public String testPermission(String menuId, String userId) {
//1:获取菜单是否已配置,是:第2步;否:结束,用EKP本身权限;
//2:获取账号,有:第3步;无:结束,用EKP;
//3:检测账号的角色 是否有 对应的菜单,有,第4不,无:结束,用ekp;
//4:查询角色的数据权限,如果是全量或部分全量,检测当前菜单是否有对应维度,有,直接查全量,无,第5步;
//5:查询用户当前菜单数据权限,拼接sql:
//and ((客户字段 in (客户1,客户2))
//or (商机字段 in (商机1,商机2))
//)——最后一个括号放在最后合上,此处可以去掉
//6:判断创建人权限;
//or (docCreateUser = 账号id)
//7:部门权限
//如果有部门权限,先查部门以及下属部门的所有账号id;
//第6步的sql要改为:
//or (docCreateUser in (账号id,其他账号id))
String sql = "";
// 测试权限 // 测试权限
SysMenu menu = sysMenuService.getById(menuId); SysMenu menu = sysMenuService.getById(menuId);
if (menu != null) { if (menu != null) {
// 返回0:无配置;1:全量;2:继续下一步,找数据权限配置
int allAuth = baseMapper.getAuthByUserIdAndMenuId(menuId, userId);
if (allAuth == 0) {
sql = " 1=2 ";
} else if (allAuth == 1) {
sql = " 1=1 ";
} else {
// TODO-继续下一步,找数据权限配置
} }
} }
if (Common.isNotNull(sql)) {
return " or (" + sql + " ) ";
}
return "";
}
/**
* 新权限-账号管理表简单分页查询
*
* @param code
* @return
*/
@Override
public IPage<SysUserInfo> getUserByCodeOrLoginName(Page<SysUserInfo> page, String code) {
return baseMapper.getUserByCodeOrLoginName(page, code);
}
} }
...@@ -181,8 +181,13 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM ...@@ -181,8 +181,13 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
@Override @Override
public List<SysDictVo> selectDictByType(String type) { public List<SysDictVo> selectDictByType(String type) {
YifuUser user = SecurityUtils.getUser();
if ("permission".equals(type) && !CommonConstants.ONE_STRING.equals(user.getId())) {
return baseMapper.selectDictByTypeOne(type,CommonConstants.ZERO_STRING);
} else {
return baseMapper.selectDictByType(type); return baseMapper.selectDictByType(type);
} }
}
@Override @Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) { public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
...@@ -273,6 +278,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM ...@@ -273,6 +278,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
SysUserInfo sysUserInfo = userInfo.get(0); SysUserInfo sysUserInfo = userInfo.get(0);
excel.setEmpDept(sysUserInfo.getFdDeptName()); excel.setEmpDept(sysUserInfo.getFdDeptName());
excel.setEmpName(sysUserInfo.getFdName()); excel.setEmpName(sysUserInfo.getFdName());
excel.setUserId(sysUserInfo.getFdId());
//判断表格权限类型是否正确 //判断表格权限类型是否正确
if (typeMap.isEmpty()) { if (typeMap.isEmpty()) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "获取权限类型字典值异常", excel)); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "获取权限类型字典值异常", excel));
......
...@@ -63,6 +63,18 @@ public class SysUserRoleResServiceImpl extends ServiceImpl<SysUserRoleResMapper, ...@@ -63,6 +63,18 @@ public class SysUserRoleResServiceImpl extends ServiceImpl<SysUserRoleResMapper,
return baseMapper.selectList(wrapper); return baseMapper.selectList(wrapper);
} }
/**
* @param roleId
* @Description: 根据角色id获取被使用的账号名称
* @Author: hgw
* @Date: 2023/9/8 17:38
* @return: java.util.List<java.lang.String>
**/
@Override
public List<String> getSysUserByRoleId(String roleId) {
return baseMapper.getSysUserByRoleId(roleId);
}
@Override @Override
public boolean deleteByUserId(String userId) { public boolean deleteByUserId(String userId) {
return baseMapper.deleteByUserId(userId); return baseMapper.deleteByUserId(userId);
......
...@@ -31,11 +31,21 @@ ...@@ -31,11 +31,21 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
a.ID, a.ID,
a.MENU_NAME, a.MENU_NAME,
a.MODEL_ID,
a.MENU_NAME_PARENT, a.MENU_NAME_PARENT,
a.MENU_PARENT_ID, a.MENU_PARENT_ID,
a.PERMISSION_TYPE, a.PERMISSION_TYPE,
a.PERMISSION_STATUS, a.PERMISSION_STATUS,
a.DELETE_STATUS, a.DELETE_STATUS,
a.INCOME_ID,
a.CUSTOMER_ID,
a.CONTRACT_ID,
a.BUSSINESS_ID,
a.QUOTATION_ID,
a.DOMAIN_ID,
a.BU_ID,
a.LINE_ID,
a.DEPT_ID,
a.CREATE_TIME a.CREATE_TIME
</sql> </sql>
<sql id="sysMenu_where"> <sql id="sysMenu_where">
......
...@@ -81,9 +81,6 @@ ...@@ -81,9 +81,6 @@
<if test="sysUserInfo.status != null"> <if test="sysUserInfo.status != null">
AND a.status = #{sysUserInfo.status} AND a.status = #{sysUserInfo.status}
</if> </if>
<if test="sysUserInfo.roleNames != null and sysUserInfo.roleNames.trim() != ''">
AND r.role_name like concat('%',#{sysUserInfo.roleNames},'%')
</if>
<if test="sysUserInfo.createBy != null and sysUserInfo.createBy.trim() != ''"> <if test="sysUserInfo.createBy != null and sysUserInfo.createBy.trim() != ''">
AND a.CREATE_BY = #{sysUserInfo.createBy} AND a.CREATE_BY = #{sysUserInfo.createBy}
</if> </if>
...@@ -103,6 +100,22 @@ ...@@ -103,6 +100,22 @@
</sql> </sql>
<!--sysUserInfo简单分页查询--> <!--sysUserInfo简单分页查询-->
<select id="getSysUserInfoPage" resultMap="sysUserInfoMap"> <select id="getSysUserInfoPage" resultMap="sysUserInfoMap">
SELECT
a.fd_id,
a.fd_name,
a.fd_login_name,
a.fd_ldap_dn,
a.fd_dept_name,
a.fd_mobile_no,
a.fd_email,
a.status,
a.role_names,
a.CREATE_BY,
a.CREATE_NAME,
a.CREATE_TIME,
a.UPDATE_BY,
a.UPDATE_TIME
from (
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM sys_user_info a FROM sys_user_info a
...@@ -113,8 +126,13 @@ ...@@ -113,8 +126,13 @@
<include refid="sysUserInfo_where"/> <include refid="sysUserInfo_where"/>
</where> </where>
GROUP BY a.fd_id GROUP BY a.fd_id
) a
<if test="sysUserInfo != null">
<if test="sysUserInfo.roleNames != null and sysUserInfo.roleNames.trim() != ''">
where a.role_names like concat('%',#{sysUserInfo.roleNames},'%')
</if>
</if>
order by a.CREATE_TIME desc order by a.CREATE_TIME desc
</select> </select>
<!--list--> <!--list-->
...@@ -126,4 +144,68 @@ ...@@ -126,4 +144,68 @@
where e.fd_is_available = '1' where e.fd_is_available = '1'
</select> </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>
<!--给EKP用的,获取列表是否全量的权限-->
<!--#全量0;部分全量1;数据权限2;客户a;商机b;报价单c;合同d;项目e;BUf;条线g;收入归属h;)-->
<select id="getAuthByUserIdAndMenuId" resultType="java.lang.Integer">
select
case
when a.data_auth is null then 0
when a.data_auth like "%0%" then 1
when a.data_auth like "%a%" and a.CUSTOMER_ID is not null then 1
when a.data_auth like "%b%" and a.BUSSINESS_ID is not null then 1
when a.data_auth like "%c%" and a.QUOTATION_ID is not null then 1
when a.data_auth like "%d%" and a.CONTRACT_ID is not null then 1
when a.data_auth like "%e%" and a.DOMAIN_ID is not null then 1
when a.data_auth like "%f%" and a.BU_ID is not null then 1
when a.data_auth like "%g%" and a.LINE_ID is not null then 1
when a.data_auth like "%h%" and a.INCOME_ID is not null then 1
else 2 end
from (
SELECT
GROUP_CONCAT(DISTINCT a.data_auth) as data_auth
,b.INCOME_ID
,b.CUSTOMER_ID
,b.CONTRACT_ID
,b.BUSSINESS_ID
,b.QUOTATION_ID
,b.DOMAIN_ID
,b.BU_ID
,b.LINE_ID
FROM
sys_menu b
join sys_role_menu_res m on b.id=m.menu_id
join sys_role_info a on m.role_id = a.fd_id
join sys_user_role_res r on r.role_id = a.fd_id
where a.delete_flag = 0 and a.status = 0 and b.DELETE_STATUS='1' and b.PERMISSION_STATUS='0'
and r.user_id = #{userId} and b.MODEL_ID=#{menuId}
) a
</select>
<select id="getUserByCodeOrLoginName" resultMap="sysUserInfoMap">
SELECT
a.fd_id,
a.fd_name,
a.fd_login_name,
a.fd_dept_name
FROM sys_user_info a
<where>
1=1
<if test="code != null and code != ''">
AND (a.fd_login_name like concat('%',#{code},'%') or a.fd_name like concat('%',#{code},'%'))
</if>
</where>
order by a.CREATE_TIME desc
</select>
</mapper> </mapper>
...@@ -212,6 +212,13 @@ ...@@ -212,6 +212,13 @@
where a.dict_type = #{type} where a.dict_type = #{type}
</select> </select>
<select id="selectDictByTypeOne" resultMap="dictMap">
SELECT
a.dict_id as id,a.name
from permission_type a
where a.dict_type = #{type} and a.user_id = #{userId}
</select>
<!--针对BU归属和条线类型时的存在判断--> <!--针对BU归属和条线类型时的存在判断-->
<select id="selectDictByName" resultType="java.lang.Integer"> <select id="selectDictByName" resultType="java.lang.Integer">
SELECT SELECT
......
...@@ -57,6 +57,15 @@ ...@@ -57,6 +57,15 @@
</where> </where>
</select> </select>
<!--sysUserRoleRes简单分页查询-->
<select id="getSysUserByRoleId" resultType="java.lang.String">
SELECT
DISTINCT u.fd_name
FROM sys_user_role_res a
join sys_user_info u on a.user_id=u.fd_id
where a.role_id = #{roleId}
</select>
<!-- 根据账号删除关联表 --> <!-- 根据账号删除关联表 -->
<delete id="deleteByUserId"> <delete id="deleteByUserId">
delete from sys_user_role_res where user_id = #{userId} delete from sys_user_role_res where user_id = #{userId}
......
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