update 修改List为Collection

This commit is contained in:
疯狂的狮子Li
2026-03-19 15:03:48 +08:00
parent 6c2958d54c
commit b9159de963
12 changed files with 57 additions and 36 deletions

View File

@@ -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 为部门 IDvalue 为对应的部门名称
*/
@Override
public Map<Long, String> selectDeptNamesByIds(List<Long> deptIds) {
public Map<Long, String> selectDeptNamesByIds(Collection<Long> deptIds) {
if (CollUtil.isEmpty(deptIds)) {
return Collections.emptyMap();
}

View File

@@ -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 为岗位 IDvalue 为对应的岗位名称
*/
@Override
public Map<Long, String> selectPostNamesByIds(List<Long> postIds) {
public Map<Long, String> selectPostNamesByIds(Collection<Long> postIds) {
if (CollUtil.isEmpty(postIds)) {
return Collections.emptyMap();
}

View File

@@ -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 为角色 IDvalue 为对应的角色名称
*/
@Override
public Map<Long, String> selectRoleNamesByIds(List<Long> roleIds) {
public Map<Long, String> selectRoleNamesByIds(Collection<Long> roleIds) {
if (CollUtil.isEmpty(roleIds)) {
return Collections.emptyMap();
}

View File

@@ -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 为用户 IDvalue 为对应的用户昵称
*/
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>()

View File

@@ -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);
}

View File

@@ -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);