mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2026-04-23 10:58:34 +08:00
update 修改List为Collection
This commit is contained in:
@@ -2,6 +2,7 @@ package org.dromara.system.api;
|
||||
|
||||
import org.dromara.system.api.domain.vo.RemoteDeptVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -41,6 +42,6 @@ public interface RemoteDeptService {
|
||||
* @param deptIds 部门 ID 列表
|
||||
* @return Map,其中 key 为部门 ID,value 为对应的部门名称
|
||||
*/
|
||||
Map<Long, String> selectDeptNamesByIds(List<Long> deptIds);
|
||||
Map<Long, String> selectDeptNamesByIds(Collection<Long> deptIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.dromara.system.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -16,6 +17,6 @@ public interface RemotePostService {
|
||||
* @param postIds 岗位 ID 列表
|
||||
* @return Map,其中 key 为岗位 ID,value 为对应的岗位名称
|
||||
*/
|
||||
Map<Long, String> selectPostNamesByIds(List<Long> postIds);
|
||||
Map<Long, String> selectPostNamesByIds(Collection<Long> postIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.dromara.system.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -16,6 +17,6 @@ public interface RemoteRoleService {
|
||||
* @param roleIds 角色 ID 列表
|
||||
* @return Map,其中 key 为角色 ID,value 为对应的角色名称
|
||||
*/
|
||||
Map<Long, String> selectRoleNamesByIds(List<Long> roleIds);
|
||||
Map<Long, String> selectRoleNamesByIds(Collection<Long> roleIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.dromara.system.api.domain.vo.RemoteUserVo;
|
||||
import org.dromara.system.api.model.LoginUser;
|
||||
import org.dromara.system.api.model.XcxLoginUser;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -119,7 +120,7 @@ public interface RemoteUserService {
|
||||
* @param userIds 用户ids
|
||||
* @return 用户列表
|
||||
*/
|
||||
List<RemoteUserVo> selectListByIds(List<Long> userIds);
|
||||
List<RemoteUserVo> selectListByIds(Collection<Long> userIds);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询用户ID
|
||||
@@ -127,7 +128,7 @@ public interface RemoteUserService {
|
||||
* @param roleIds 角色ids
|
||||
* @return 用户ids
|
||||
*/
|
||||
List<Long> selectUserIdsByRoleIds(List<Long> roleIds);
|
||||
List<Long> selectUserIdsByRoleIds(Collection<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询用户
|
||||
@@ -135,7 +136,7 @@ public interface RemoteUserService {
|
||||
* @param roleIds 角色ids
|
||||
* @return 用户
|
||||
*/
|
||||
List<RemoteUserVo> selectUsersByRoleIds(List<Long> roleIds);
|
||||
List<RemoteUserVo> selectUsersByRoleIds(Collection<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 通过部门ID查询用户
|
||||
@@ -143,7 +144,7 @@ public interface RemoteUserService {
|
||||
* @param deptIds 部门ids
|
||||
* @return 用户
|
||||
*/
|
||||
List<RemoteUserVo> selectUsersByDeptIds(List<Long> deptIds);
|
||||
List<RemoteUserVo> selectUsersByDeptIds(Collection<Long> deptIds);
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询用户
|
||||
@@ -151,7 +152,7 @@ public interface RemoteUserService {
|
||||
* @param postIds 岗位ids
|
||||
* @return 用户
|
||||
*/
|
||||
List<RemoteUserVo> selectUsersByPostIds(List<Long> postIds);
|
||||
List<RemoteUserVo> selectUsersByPostIds(Collection<Long> postIds);
|
||||
|
||||
/**
|
||||
* 根据用户 ID 列表查询用户昵称映射关系
|
||||
@@ -159,6 +160,6 @@ public interface RemoteUserService {
|
||||
* @param userIds 用户 ID 列表
|
||||
* @return Map,其中 key 为用户 ID,value 为对应的用户昵称
|
||||
*/
|
||||
Map<Long, String> selectUserNicksByIds(List<Long> userIds);
|
||||
Map<Long, String> selectUserNicksByIds(Collection<Long> userIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
@@ -42,7 +43,7 @@ public class RemoteTaskAssigneeVo implements Serializable {
|
||||
* 将源列表转换为 TaskHandler 列表
|
||||
*
|
||||
* @param <T> 通用类型
|
||||
* @param sourceList 待转换的源列表
|
||||
* @param sourceCollection 待转换的源列表
|
||||
* @param storageId 提取 storageId 的函数
|
||||
* @param handlerCode 提取 handlerCode 的函数
|
||||
* @param handlerName 提取 handlerName 的函数
|
||||
@@ -51,13 +52,13 @@ public class RemoteTaskAssigneeVo implements Serializable {
|
||||
* @return 转换后的 TaskHandler 列表
|
||||
*/
|
||||
public static <T> List<TaskHandler> convertToHandlerList(
|
||||
List<T> sourceList,
|
||||
Collection<T> sourceCollection,
|
||||
Function<T, String> storageId,
|
||||
Function<T, String> handlerCode,
|
||||
Function<T, String> handlerName,
|
||||
Function<T, String> groupName,
|
||||
Function<T, Date> createTimeMapper) {
|
||||
return sourceList.stream()
|
||||
return sourceCollection.stream()
|
||||
.map(item -> new TaskHandler(
|
||||
storageId.apply(item),
|
||||
handlerCode.apply(item),
|
||||
|
||||
@@ -5,10 +5,10 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 分页结果对象
|
||||
* 表格分页数据对象
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@@ -27,27 +27,42 @@ public class PageResult<T> implements Serializable {
|
||||
/**
|
||||
* 列表数据
|
||||
*/
|
||||
private List<T> rows;
|
||||
private Collection<T> rows;
|
||||
|
||||
public PageResult(List<T> list, long total) {
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param list 列表数据
|
||||
* @param total 总记录数
|
||||
*/
|
||||
public PageResult(Collection<T> list, long total) {
|
||||
this.rows = list;
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public static <T> PageResult<T> build(List<T> list, long total) {
|
||||
/**
|
||||
* 根据分页对象构建表格分页数据对象
|
||||
*/
|
||||
public static <T> PageResult<T> build(Collection<T> list, long total) {
|
||||
PageResult<T> rspData = new PageResult<>();
|
||||
rspData.setRows(list);
|
||||
rspData.setTotal(total);
|
||||
return rspData;
|
||||
}
|
||||
|
||||
public static <T> PageResult<T> build(List<T> list) {
|
||||
/**
|
||||
* 根据数据列表构建表格分页数据对象
|
||||
*/
|
||||
public static <T> PageResult<T> build(Collection<T> list) {
|
||||
PageResult<T> rspData = new PageResult<>();
|
||||
rspData.setRows(list);
|
||||
rspData.setTotal(list.size());
|
||||
return rspData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建表格分页数据对象
|
||||
*/
|
||||
public static <T> PageResult<T> build() {
|
||||
return new PageResult<>();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.dromara.system.mapper.SysDeptMapper;
|
||||
import org.dromara.system.service.ISysDeptService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -75,7 +76,7 @@ public class RemoteDeptServiceImpl implements RemoteDeptService {
|
||||
* @return Map,其中 key 为部门 ID,value 为对应的部门名称
|
||||
*/
|
||||
@Override
|
||||
public Map<Long, String> selectDeptNamesByIds(List<Long> deptIds) {
|
||||
public Map<Long, String> selectDeptNamesByIds(Collection<Long> deptIds) {
|
||||
if (CollUtil.isEmpty(deptIds)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.dromara.system.domain.SysPost;
|
||||
import org.dromara.system.mapper.SysPostMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -33,7 +34,7 @@ public class RemotePostServiceImpl implements RemotePostService {
|
||||
* @return Map,其中 key 为岗位 ID,value 为对应的岗位名称
|
||||
*/
|
||||
@Override
|
||||
public Map<Long, String> selectPostNamesByIds(List<Long> postIds) {
|
||||
public Map<Long, String> selectPostNamesByIds(Collection<Long> postIds) {
|
||||
if (CollUtil.isEmpty(postIds)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.dromara.system.domain.SysRole;
|
||||
import org.dromara.system.mapper.SysRoleMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -33,7 +34,7 @@ public class RemoteRoleServiceImpl implements RemoteRoleService {
|
||||
* @return Map,其中 key 为角色 ID,value 为对应的角色名称
|
||||
*/
|
||||
@Override
|
||||
public Map<Long, String> selectRoleNamesByIds(List<Long> roleIds) {
|
||||
public Map<Long, String> selectRoleNamesByIds(Collection<Long> roleIds) {
|
||||
if (CollUtil.isEmpty(roleIds)) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
@@ -294,9 +294,9 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
* @see org.dromara.system.domain.convert.SysUserVoConvert
|
||||
*/
|
||||
@Override
|
||||
public List<RemoteUserVo> selectListByIds(List<Long> userIds) {
|
||||
public List<RemoteUserVo> selectListByIds(Collection<Long> userIds) {
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return new ArrayList<>();
|
||||
return List.of();
|
||||
}
|
||||
List<SysUserVo> list = userMapper.selectVoList(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getUserId, SysUser::getDeptId, SysUser::getUserName,
|
||||
@@ -315,9 +315,9 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
* @return 用户ids
|
||||
*/
|
||||
@Override
|
||||
public List<Long> selectUserIdsByRoleIds(List<Long> roleIds) {
|
||||
public List<Long> selectUserIdsByRoleIds(Collection<Long> roleIds) {
|
||||
if (CollUtil.isEmpty(roleIds)) {
|
||||
return new ArrayList<>();
|
||||
return List.of();
|
||||
}
|
||||
return userService.selectUserIdsByRoleIds(roleIds);
|
||||
}
|
||||
@@ -329,7 +329,7 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
* @return 用户
|
||||
*/
|
||||
@Override
|
||||
public List<RemoteUserVo> selectUsersByRoleIds(List<Long> roleIds) {
|
||||
public List<RemoteUserVo> selectUsersByRoleIds(Collection<Long> roleIds) {
|
||||
if (CollUtil.isEmpty(roleIds)) {
|
||||
return List.of();
|
||||
}
|
||||
@@ -351,7 +351,7 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
* @return 用户
|
||||
*/
|
||||
@Override
|
||||
public List<RemoteUserVo> selectUsersByDeptIds(List<Long> deptIds) {
|
||||
public List<RemoteUserVo> selectUsersByDeptIds(Collection<Long> deptIds) {
|
||||
if (CollUtil.isEmpty(deptIds)) {
|
||||
return List.of();
|
||||
}
|
||||
@@ -369,7 +369,7 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
* @return 用户
|
||||
*/
|
||||
@Override
|
||||
public List<RemoteUserVo> selectUsersByPostIds(List<Long> postIds) {
|
||||
public List<RemoteUserVo> selectUsersByPostIds(Collection<Long> postIds) {
|
||||
if (CollUtil.isEmpty(postIds)) {
|
||||
return List.of();
|
||||
}
|
||||
@@ -390,9 +390,9 @@ public class RemoteUserServiceImpl implements RemoteUserService {
|
||||
* @param userIds 用户 ID 列表
|
||||
* @return Map,其中 key 为用户 ID,value 为对应的用户昵称
|
||||
*/
|
||||
public Map<Long, String> selectUserNicksByIds(List<Long> userIds) {
|
||||
public Map<Long, String> selectUserNicksByIds(Collection<Long> userIds) {
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return Collections.emptyMap();
|
||||
return List.of();
|
||||
}
|
||||
List<SysUser> list = userMapper.selectList(
|
||||
new LambdaQueryWrapper<SysUser>()
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.dromara.system.domain.bo.SysUserBo;
|
||||
import org.dromara.system.domain.vo.SysUserExportVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -272,6 +273,6 @@ public interface ISysUserService {
|
||||
* @param roleIds 角色ids
|
||||
* @return 用户ids
|
||||
*/
|
||||
List<Long> selectUserIdsByRoleIds(List<Long> roleIds);
|
||||
List<Long> selectUserIdsByRoleIds(Collection<Long> roleIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -33,10 +33,7 @@ import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 用户 业务层处理
|
||||
@@ -557,7 +554,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectUserIdsByRoleIds(List<Long> roleIds) {
|
||||
public List<Long> selectUserIdsByRoleIds(Collection<Long> roleIds) {
|
||||
List<SysUserRole> userRoles = userRoleMapper.selectList(
|
||||
new LambdaQueryWrapper<SysUserRole>().in(SysUserRole::getRoleId, roleIds));
|
||||
return StreamUtils.toList(userRoles, SysUserRole::getUserId);
|
||||
|
||||
Reference in New Issue
Block a user