mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	@@ -111,8 +111,7 @@ public class SysDeptServiceImpl extends ServicePlusImpl<SysDeptMapper, SysDept,
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean hasChildByDeptId(Long deptId) {
 | 
			
		||||
        long result = count(new LambdaQueryWrapper<SysDept>()
 | 
			
		||||
            .eq(SysDept::getParentId, deptId)
 | 
			
		||||
            .last("limit 1"));
 | 
			
		||||
            .eq(SysDept::getParentId, deptId));
 | 
			
		||||
        return result > 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -138,11 +137,11 @@ public class SysDeptServiceImpl extends ServicePlusImpl<SysDeptMapper, SysDept,
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkDeptNameUnique(SysDept dept) {
 | 
			
		||||
        Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
 | 
			
		||||
        SysDept info = getOne(new LambdaQueryWrapper<SysDept>()
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysDept>()
 | 
			
		||||
            .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;
 | 
			
		||||
 
 | 
			
		||||
@@ -225,10 +225,10 @@ public class SysDictTypeServiceImpl extends ServicePlusImpl<SysDictTypeMapper, S
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkDictTypeUnique(SysDictType dict) {
 | 
			
		||||
        Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
 | 
			
		||||
        SysDictType dictType = getOne(new LambdaQueryWrapper<SysDictType>()
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysDictType>()
 | 
			
		||||
                .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;
 | 
			
		||||
 
 | 
			
		||||
@@ -262,11 +262,11 @@ public class SysMenuServiceImpl extends ServicePlusImpl<SysMenuMapper, SysMenu,
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkMenuNameUnique(SysMenu menu) {
 | 
			
		||||
        Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
 | 
			
		||||
        SysMenu info = getOne(new LambdaQueryWrapper<SysMenu>()
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysMenu>()
 | 
			
		||||
            .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;
 | 
			
		||||
 
 | 
			
		||||
@@ -93,9 +93,10 @@ public class SysPostServiceImpl extends ServicePlusImpl<SysPostMapper, SysPost,
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkPostNameUnique(SysPost post) {
 | 
			
		||||
        Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
 | 
			
		||||
        SysPost info = getOne(new LambdaQueryWrapper<SysPost>()
 | 
			
		||||
                .eq(SysPost::getPostName, post.getPostName()).last("limit 1"));
 | 
			
		||||
        if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysPost>()
 | 
			
		||||
                .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<SysPostMapper, SysPost,
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkPostCodeUnique(SysPost post) {
 | 
			
		||||
        Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
 | 
			
		||||
        SysPost info = getOne(new LambdaQueryWrapper<SysPost>()
 | 
			
		||||
                .eq(SysPost::getPostCode, post.getPostCode()).last("limit 1"));
 | 
			
		||||
        if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) {
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysPost>()
 | 
			
		||||
                .eq(SysPost::getPostCode, post.getPostCode())
 | 
			
		||||
                .ne(SysPost::getPostId, postId));
 | 
			
		||||
        if (count > 0) {
 | 
			
		||||
            return UserConstants.NOT_UNIQUE;
 | 
			
		||||
        }
 | 
			
		||||
        return UserConstants.UNIQUE;
 | 
			
		||||
 
 | 
			
		||||
@@ -141,9 +141,10 @@ public class SysRoleServiceImpl extends ServicePlusImpl<SysRoleMapper, SysRole,
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkRoleNameUnique(SysRole role) {
 | 
			
		||||
        Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
 | 
			
		||||
        SysRole info = getOne(new LambdaQueryWrapper<SysRole>()
 | 
			
		||||
                .eq(SysRole::getRoleName, role.getRoleName()).last("limit 1"));
 | 
			
		||||
        if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysRole>()
 | 
			
		||||
                .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<SysRoleMapper, SysRole,
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkRoleKeyUnique(SysRole role) {
 | 
			
		||||
        Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
 | 
			
		||||
        SysRole info = getOne(new LambdaQueryWrapper<SysRole>()
 | 
			
		||||
                .eq(SysRole::getRoleKey, role.getRoleKey()).last("limit 1"));
 | 
			
		||||
        if (StringUtils.isNotNull(info) && info.getRoleId().longValue() != roleId.longValue()) {
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysRole>()
 | 
			
		||||
                .eq(SysRole::getRoleKey, role.getRoleKey())
 | 
			
		||||
                .ne(SysRole::getRoleId, roleId));
 | 
			
		||||
        if (count > 0) {
 | 
			
		||||
            return UserConstants.NOT_UNIQUE;
 | 
			
		||||
        }
 | 
			
		||||
        return UserConstants.UNIQUE;
 | 
			
		||||
 
 | 
			
		||||
@@ -162,7 +162,7 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkUserNameUnique(String userName) {
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, userName).last("limit 1"));
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUserName, userName));
 | 
			
		||||
        if (count > 0) {
 | 
			
		||||
            return UserConstants.NOT_UNIQUE;
 | 
			
		||||
        }
 | 
			
		||||
@@ -178,10 +178,11 @@ public class SysUserServiceImpl extends ServicePlusImpl<SysUserMapper, SysUser,
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkPhoneUnique(SysUser user) {
 | 
			
		||||
        Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
 | 
			
		||||
        SysUser info = getOne(new LambdaQueryWrapper<SysUser>()
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysUser>()
 | 
			
		||||
                .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<SysUserMapper, SysUser,
 | 
			
		||||
    @Override
 | 
			
		||||
    public String checkEmailUnique(SysUser user) {
 | 
			
		||||
        Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
 | 
			
		||||
        SysUser info = getOne(new LambdaQueryWrapper<SysUser>()
 | 
			
		||||
        long count = count(new LambdaQueryWrapper<SysUser>()
 | 
			
		||||
                .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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user