mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-04 09:01:37 +08:00 
			
		
		
		
	Merge branch 'dev' into 2.0.x
# Conflicts: # README.md
This commit is contained in:
		@@ -147,7 +147,7 @@ public class SaTokenRedisDaoImpl implements SaTokenDao {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<String> searchData(String prefix, String keyword, int start, int size, boolean sortType) {
 | 
			
		||||
        Collection<String> keys = RedisUtils.keys(prefix + "*" + keyword + "*");
 | 
			
		||||
        Collection<String> keys = RedisUtils.keys(String.format("%s*%s*", prefix, keyword));
 | 
			
		||||
        List<String> list = new ArrayList<>(keys);
 | 
			
		||||
        return SaFoxUtil.searchList(list, start, size, sortType);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -28,6 +28,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import org.springdoc.core.annotations.ParameterObject;
 | 
			
		||||
import org.springframework.format.annotation.DateTimeFormat;
 | 
			
		||||
 | 
			
		||||
import top.charles7c.cnadmin.common.constant.StringConsts;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 在线用户查询条件
 | 
			
		||||
 *
 | 
			
		||||
@@ -52,6 +54,6 @@ public class OnlineUserQuery implements Serializable {
 | 
			
		||||
     * 登录时间
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "登录时间")
 | 
			
		||||
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 | 
			
		||||
    @DateTimeFormat(pattern = StringConsts.NORM_DATE_TIME_PATTERN)
 | 
			
		||||
    private List<Date> loginTime;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -29,6 +29,7 @@ import org.springdoc.core.annotations.ParameterObject;
 | 
			
		||||
import org.springframework.format.annotation.DateTimeFormat;
 | 
			
		||||
 | 
			
		||||
import top.charles7c.cnadmin.common.annotation.Query;
 | 
			
		||||
import top.charles7c.cnadmin.common.constant.StringConsts;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 用户查询条件
 | 
			
		||||
@@ -63,7 +64,7 @@ public class UserQuery implements Serializable {
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "创建时间")
 | 
			
		||||
    @Query(type = Query.Type.BETWEEN)
 | 
			
		||||
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 | 
			
		||||
    @DateTimeFormat(pattern = StringConsts.NORM_DATE_TIME_PATTERN)
 | 
			
		||||
    private List<Date> createTime;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -38,13 +38,12 @@ public interface RoleDeptService {
 | 
			
		||||
    boolean save(List<Long> deptIds, Long roleId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据角色 ID 查询
 | 
			
		||||
     * 根据角色 ID 删除
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleId
 | 
			
		||||
     *            角色 ID
 | 
			
		||||
     * @return 部门 ID 列表
 | 
			
		||||
     * @param roleIds
 | 
			
		||||
     *            角色 ID 列表
 | 
			
		||||
     */
 | 
			
		||||
    List<Long> listDeptIdByRoleId(Long roleId);
 | 
			
		||||
    void deleteByRoleIds(List<Long> roleIds);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据部门 ID 删除
 | 
			
		||||
@@ -55,10 +54,11 @@ public interface RoleDeptService {
 | 
			
		||||
    void deleteByDeptIds(List<Long> deptIds);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据角色 ID 删除
 | 
			
		||||
     * 根据角色 ID 查询
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleIds
 | 
			
		||||
     *            角色 ID 列表
 | 
			
		||||
     * @param roleId
 | 
			
		||||
     *            角色 ID
 | 
			
		||||
     * @return 部门 ID 列表
 | 
			
		||||
     */
 | 
			
		||||
    void deleteByRoleIds(List<Long> roleIds);
 | 
			
		||||
    List<Long> listDeptIdByRoleId(Long roleId);
 | 
			
		||||
}
 | 
			
		||||
@@ -37,6 +37,14 @@ public interface RoleMenuService {
 | 
			
		||||
     */
 | 
			
		||||
    boolean save(List<Long> menuIds, Long roleId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据角色 ID 删除
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleIds
 | 
			
		||||
     *            角色 ID 列表
 | 
			
		||||
     */
 | 
			
		||||
    void deleteByRoleIds(List<Long> roleIds);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据角色 ID 查询
 | 
			
		||||
     *
 | 
			
		||||
@@ -45,12 +53,4 @@ public interface RoleMenuService {
 | 
			
		||||
     * @return 菜单 ID 列表
 | 
			
		||||
     */
 | 
			
		||||
    List<Long> listMenuIdByRoleIds(List<Long> roleIds);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据角色 ID 删除
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleIds
 | 
			
		||||
     *            角色 ID 列表
 | 
			
		||||
     */
 | 
			
		||||
    void deleteByRoleIds(List<Long> roleIds);
 | 
			
		||||
}
 | 
			
		||||
@@ -38,13 +38,12 @@ public interface UserRoleService {
 | 
			
		||||
    boolean save(List<Long> roleIds, Long userId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据角色 ID 列表查询
 | 
			
		||||
     * 根据用户 ID 删除
 | 
			
		||||
     *
 | 
			
		||||
     * @param roleIds
 | 
			
		||||
     *            角色 ID 列表
 | 
			
		||||
     * @return 总记录数
 | 
			
		||||
     * @param userIds
 | 
			
		||||
     *            用户 ID 列表
 | 
			
		||||
     */
 | 
			
		||||
    Long countByRoleIds(List<Long> roleIds);
 | 
			
		||||
    void deleteByUserIds(List<Long> userIds);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据用户 ID 查询
 | 
			
		||||
@@ -56,10 +55,11 @@ public interface UserRoleService {
 | 
			
		||||
    List<Long> listRoleIdByUserId(Long userId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据用户 ID 删除
 | 
			
		||||
     * 根据角色 ID 列表查询
 | 
			
		||||
     *
 | 
			
		||||
     * @param userIds
 | 
			
		||||
     *            用户 ID 列表
 | 
			
		||||
     * @param roleIds
 | 
			
		||||
     *            角色 ID 列表
 | 
			
		||||
     * @return 总记录数
 | 
			
		||||
     */
 | 
			
		||||
    void deleteByUserIds(List<Long> userIds);
 | 
			
		||||
    Long countByRoleIds(List<Long> roleIds);
 | 
			
		||||
}
 | 
			
		||||
@@ -22,6 +22,7 @@ import java.util.stream.Collectors;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.collection.CollUtil;
 | 
			
		||||
 | 
			
		||||
@@ -42,6 +43,7 @@ public class RoleDeptServiceImpl implements RoleDeptService {
 | 
			
		||||
    private final RoleDeptMapper roleDeptMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public boolean save(List<Long> deptIds, Long roleId) {
 | 
			
		||||
        // 检查是否有变更
 | 
			
		||||
        List<Long> oldDeptIdList = roleDeptMapper.lambdaQuery().select(RoleDeptDO::getDeptId)
 | 
			
		||||
@@ -58,17 +60,19 @@ public class RoleDeptServiceImpl implements RoleDeptService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<Long> listDeptIdByRoleId(Long roleId) {
 | 
			
		||||
        return roleDeptMapper.selectDeptIdByRoleId(roleId);
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void deleteByRoleIds(List<Long> roleIds) {
 | 
			
		||||
        roleDeptMapper.lambdaUpdate().in(RoleDeptDO::getRoleId, roleIds).remove();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void deleteByDeptIds(List<Long> deptIds) {
 | 
			
		||||
        roleDeptMapper.lambdaUpdate().in(RoleDeptDO::getDeptId, deptIds).remove();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deleteByRoleIds(List<Long> roleIds) {
 | 
			
		||||
        roleDeptMapper.lambdaUpdate().in(RoleDeptDO::getRoleId, roleIds).remove();
 | 
			
		||||
    public List<Long> listDeptIdByRoleId(Long roleId) {
 | 
			
		||||
        return roleDeptMapper.selectDeptIdByRoleId(roleId);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,7 @@ import java.util.stream.Collectors;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.collection.CollUtil;
 | 
			
		||||
 | 
			
		||||
@@ -43,6 +44,7 @@ public class RoleMenuServiceImpl implements RoleMenuService {
 | 
			
		||||
    private final RoleMenuMapper roleMenuMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public boolean save(List<Long> menuIds, Long roleId) {
 | 
			
		||||
        // 检查是否有变更
 | 
			
		||||
        List<Long> oldMenuIdList = roleMenuMapper.lambdaQuery().select(RoleMenuDO::getMenuId)
 | 
			
		||||
@@ -58,6 +60,12 @@ public class RoleMenuServiceImpl implements RoleMenuService {
 | 
			
		||||
        return roleMenuMapper.insertBatch(roleMenuList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void deleteByRoleIds(List<Long> roleIds) {
 | 
			
		||||
        roleMenuMapper.lambdaUpdate().in(RoleMenuDO::getRoleId, roleIds).remove();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<Long> listMenuIdByRoleIds(List<Long> roleIds) {
 | 
			
		||||
        if (CollUtil.isEmpty(roleIds)) {
 | 
			
		||||
@@ -65,9 +73,4 @@ public class RoleMenuServiceImpl implements RoleMenuService {
 | 
			
		||||
        }
 | 
			
		||||
        return roleMenuMapper.selectMenuIdByRoleIds(roleIds);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deleteByRoleIds(List<Long> roleIds) {
 | 
			
		||||
        roleMenuMapper.lambdaUpdate().in(RoleMenuDO::getRoleId, roleIds).remove();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -22,6 +22,7 @@ import java.util.stream.Collectors;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.collection.CollUtil;
 | 
			
		||||
 | 
			
		||||
@@ -42,6 +43,7 @@ public class UserRoleServiceImpl implements UserRoleService {
 | 
			
		||||
    private final UserRoleMapper userRoleMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public boolean save(List<Long> roleIds, Long userId) {
 | 
			
		||||
        // 检查是否有变更
 | 
			
		||||
        List<Long> oldRoleIdList = userRoleMapper.lambdaQuery().select(UserRoleDO::getRoleId)
 | 
			
		||||
@@ -58,8 +60,9 @@ public class UserRoleServiceImpl implements UserRoleService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public Long countByRoleIds(List<Long> roleIds) {
 | 
			
		||||
        return userRoleMapper.lambdaQuery().in(UserRoleDO::getRoleId, roleIds).count();
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void deleteByUserIds(List<Long> userIds) {
 | 
			
		||||
        userRoleMapper.lambdaUpdate().in(UserRoleDO::getUserId, userIds).remove();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
@@ -68,7 +71,7 @@ public class UserRoleServiceImpl implements UserRoleService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void deleteByUserIds(List<Long> userIds) {
 | 
			
		||||
        userRoleMapper.lambdaUpdate().in(UserRoleDO::getUserId, userIds).remove();
 | 
			
		||||
    public Long countByRoleIds(List<Long> roleIds) {
 | 
			
		||||
        return userRoleMapper.lambdaQuery().in(UserRoleDO::getRoleId, roleIds).count();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -185,6 +185,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserVO,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void updateBasicInfo(UpdateBasicInfoRequest request, Long id) {
 | 
			
		||||
        super.getById(id);
 | 
			
		||||
        baseMapper.lambdaUpdate().set(UserDO::getNickname, request.getNickname())
 | 
			
		||||
@@ -218,6 +219,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserVO,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void resetPassword(Long id) {
 | 
			
		||||
        UserDO user = super.getById(id);
 | 
			
		||||
        user.setPassword(SecureUtils.md5Salt(SysConsts.DEFAULT_PASSWORD, id.toString()));
 | 
			
		||||
@@ -226,6 +228,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserVO,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    public void updateRole(UpdateUserRoleRequest request, Long id) {
 | 
			
		||||
        super.getById(id);
 | 
			
		||||
        // 保存用户和角色关联
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user