mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-03 22:57:14 +08:00 
			
		
		
		
	fix: 删除用户同时删除用户历史密码
This commit is contained in:
		@@ -16,6 +16,8 @@
 | 
			
		||||
 | 
			
		||||
package top.continew.admin.system.service;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 用户历史密码业务接口
 | 
			
		||||
 *
 | 
			
		||||
@@ -33,6 +35,13 @@ public interface UserPasswordHistoryService {
 | 
			
		||||
     */
 | 
			
		||||
    void add(Long userId, String password, int count);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据用户 ID 删除
 | 
			
		||||
     *
 | 
			
		||||
     * @param userIds 用户 ID 列表
 | 
			
		||||
     */
 | 
			
		||||
    void deleteByUserIds(List<Long> userIds);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 密码是否为重复使用
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -52,6 +52,11 @@ public class UserPasswordHistoryServiceImpl implements UserPasswordHistoryServic
 | 
			
		||||
        baseMapper.deleteExpired(userId, count);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deleteByUserIds(List<Long> userIds) {
 | 
			
		||||
        baseMapper.lambdaUpdate().in(UserPasswordHistoryDO::getUserId, userIds).remove();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean isPasswordReused(Long userId, String password, int count) {
 | 
			
		||||
        // 查询近 N 个历史密码
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,6 @@ public class UserRoleServiceImpl implements UserRoleService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void deleteByUserIds(List<Long> userIds) {
 | 
			
		||||
        baseMapper.lambdaUpdate().in(UserRoleDO::getUserId, userIds).remove();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -345,6 +345,8 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes
 | 
			
		||||
            .getNickname());
 | 
			
		||||
        // 删除用户和角色关联
 | 
			
		||||
        userRoleService.deleteByUserIds(ids);
 | 
			
		||||
        // 删除历史密码
 | 
			
		||||
        userPasswordHistoryService.deleteByUserIds(ids);
 | 
			
		||||
        // 删除用户
 | 
			
		||||
        super.delete(ids);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user