fix: 企标列表权限和批量删除权限不对应问题

This commit is contained in:
2023-11-30 08:58:36 +08:00
parent 4cbf399b15
commit 823e167cd0
4 changed files with 233 additions and 28 deletions
@@ -585,21 +585,16 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl<Enterpris
if (StringUtils.isBlank(ids)) {
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "ids不能为空");
}
List<String> idList = Arrays.asList(ids.split(","));
// 管理员有所有权限
SysUser currentUser = sysUserService.getById(userId);
String username = currentUser.getUsername();
// 获取当前用户的角色roleCode
List<String> roleList = sysUserRoleService.getRole(currentUser.getUsername());
if (roleList != null && roleList.stream().anyMatch(adminRoleCodeList :: contains)) {
return true;
String[] idList = ids.split(",");
List<Map<String, Object>> records = new ArrayList<>();
for (String id : idList) {
Map<String, Object> map = new HashMap<>();
map.put(FieldCommon.ID, id);
records.add(map);
}
// 创建人可以删除
List<LawsEnterpriseStandard> list = enterpriseStandardService.list(new LambdaQueryWrapper<LawsEnterpriseStandard>().in(LawsEnterpriseStandard::getId, idList));
// 如果不是创建人,则直接返回false
for (LawsEnterpriseStandard es : list) {
if (!es.getCreateBy().equals(username)) {
this.delFlagSet(records);
for (Map<String, Object> map : records) {
if (!(boolean) map.get(FieldCommon.DEL_FLAG)) {
return false;
}
}