fix: 77917

新增--新增数据,提示标准编号已存在
This commit is contained in:
2023-11-01 16:01:17 +08:00
parent 39ec1c80c2
commit 1bd243aa96
2 changed files with 11 additions and 4 deletions
@@ -61,6 +61,9 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl<Enterpris
@Resource
private ISysRoleService sysRoleService;
@Resource
private ISysUserService sysUserRoleService;
// 注入draftDepartName
@Value("${draftDepartName}")
private String draftDepartName;
@@ -169,7 +172,9 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl<Enterpris
// 只有创建人和管理员才有维护的权限
String userId = UserUtils.getUserId();
SysUser currentUser = sysUserService.getById(userId);
if (currentUser.getRoleCode().equals(FieldCommon.ROLE_ADMIN)) {
// 获取当前用户的角色roleCode
List<String> roleList = sysUserRoleService.getRole(currentUser.getUsername());
if (roleList != null && roleList.contains(FieldCommon.ROLE_ADMIN)) {
records.forEach(kv -> kv.put(FieldCommon.EDIT_FLAG, true));
return;
}
@@ -249,8 +254,10 @@ public class EnterpriseStandardAuthUserServiceImpl extends ServiceImpl<Enterpris
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "ids不能为空");
}
// 管理员有所有权限
SysUser user = sysUserService.getById(userId);
if (user.getRoleCode().equals("admin")) {
SysUser currentUser = sysUserService.getById(userId);
// 获取当前用户的角色roleCode
List<String> roleList = sysUserRoleService.getRole(currentUser.getUsername());
if (roleList != null && roleList.contains(FieldCommon.ROLE_ADMIN)) {
return true;
}
// 创建人可以删除
@@ -60,7 +60,7 @@ public class EnterpriseStandardUtil {
.sorted()
.collect(Collectors.toList());
int expectedNumber = 0; // 我们期望的最大序列号初始化为0
int expectedNumber = 1;
if (!sortedNumbers.isEmpty()) {
expectedNumber = sortedNumbers.get(sortedNumbers.size() - 1) + 1; // 获取最大的数字并+1
}