diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 0a2f8e6af..995bd2d60 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -111,8 +111,7 @@ public class SysDeptServiceImpl extends ServicePlusImpl() - .eq(SysDept::getParentId, deptId) - .last("limit 1")); + .eq(SysDept::getParentId, deptId)); return result > 0; } @@ -138,11 +137,11 @@ public class SysDeptServiceImpl extends ServicePlusImpl() + long count = count(new LambdaQueryWrapper() .eq(SysDept::getDeptName, dept.getDeptName()) .eq(SysDept::getParentId, dept.getParentId()) - .last("limit 1")); - if (StringUtils.isNotNull(info) && info.getDeptId().longValue() != deptId.longValue()) { + .ne(SysDept::getDeptId, deptId)); + if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index bb940c2b0..0cdce84c1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -225,10 +225,10 @@ public class SysDictTypeServiceImpl extends ServicePlusImpl() + long count = count(new LambdaQueryWrapper() .eq(SysDictType::getDictType, dict.getDictType()) - .last("limit 1")); - if (StringUtils.isNotNull(dictType) && dictType.getDictId().longValue() != dictId.longValue()) { + .ne(SysDictType::getDictId, dictId)); + if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java index 98236e90b..c8f193af1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysMenuServiceImpl.java @@ -262,11 +262,11 @@ public class SysMenuServiceImpl extends ServicePlusImpl() + long count = count(new LambdaQueryWrapper() .eq(SysMenu::getMenuName, menu.getMenuName()) .eq(SysMenu::getParentId, menu.getParentId()) - .last("limit 1")); - if (StringUtils.isNotNull(info) && info.getMenuId().longValue() != menuId.longValue()) { + .ne(SysMenu::getMenuId, menuId)); + if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java index 9681b3db4..4e04f3a19 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java @@ -93,9 +93,10 @@ public class SysPostServiceImpl extends ServicePlusImpl() - .eq(SysPost::getPostName, post.getPostName()).last("limit 1")); - if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) { + long count = count(new LambdaQueryWrapper() + .eq(SysPost::getPostName, post.getPostName()) + .ne(SysPost::getPostId, postId)); + if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -110,9 +111,10 @@ public class SysPostServiceImpl extends ServicePlusImpl() - .eq(SysPost::getPostCode, post.getPostCode()).last("limit 1")); - if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) { + long count = count(new LambdaQueryWrapper() + .eq(SysPost::getPostCode, post.getPostCode()) + .ne(SysPost::getPostId, postId)); + if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 7dd14af8f..7bad29746 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -141,9 +141,10 @@ public class SysRoleServiceImpl extends ServicePlusImpl() - .eq(SysRole::getRoleName, role.getRoleName()).last("limit 1")); - if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { + long count = count(new LambdaQueryWrapper() + .eq(SysRole::getRoleName, role.getRoleName()) + .ne(SysRole::getRoleId, roleId)); + if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -158,9 +159,10 @@ public class SysRoleServiceImpl extends ServicePlusImpl() - .eq(SysRole::getRoleKey, role.getRoleKey()).last("limit 1")); - if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) { + long count = count(new LambdaQueryWrapper() + .eq(SysRole::getRoleKey, role.getRoleKey()) + .ne(SysRole::getRoleId, roleId)); + if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 788992a9d..08724cbb7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -162,7 +162,7 @@ public class SysUserServiceImpl extends ServicePlusImpl().eq(SysUser::getUserName, userName).last("limit 1")); + long count = count(new LambdaQueryWrapper().eq(SysUser::getUserName, userName)); if (count > 0) { return UserConstants.NOT_UNIQUE; } @@ -178,10 +178,11 @@ public class SysUserServiceImpl extends ServicePlusImpl() + long count = count(new LambdaQueryWrapper() .select(SysUser::getUserId, SysUser::getPhonenumber) - .eq(SysUser::getPhonenumber, user.getPhonenumber()).last("limit 1")); - if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { + .eq(SysUser::getPhonenumber, user.getPhonenumber()) + .ne(SysUser::getUserId, userId)); + if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -196,10 +197,11 @@ public class SysUserServiceImpl extends ServicePlusImpl() + long count = count(new LambdaQueryWrapper() .select(SysUser::getUserId, SysUser::getEmail) - .eq(SysUser::getEmail, user.getEmail()).last("limit 1")); - if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) { + .eq(SysUser::getEmail, user.getEmail()) + .ne(SysUser::getUserId, userId)); + if (count > 0) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE;