|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import javax.validation.Validator;
|
|
|
|
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
@ -36,8 +37,7 @@ import com.ruoyi.system.service.ISysUserService;
|
|
|
|
|
* @author ruoyi
|
|
|
|
|
*/
|
|
|
|
|
@Service
|
|
|
|
|
public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
{
|
|
|
|
|
public class SysUserServiceImpl implements ISysUserService {
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@ -68,9 +68,8 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 用户信息集合信息
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DataScope(deptAlias = "d", userAlias = "u",tenantAlias = "u")
|
|
|
|
|
public List<SysUser> selectUserList(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
@DataScope(deptAlias = "d", userAlias = "u", tenantAlias = "u")
|
|
|
|
|
public List<SysUser> selectUserList(SysUser user) {
|
|
|
|
|
return userMapper.selectUserList(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -82,8 +81,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DataScope(deptAlias = "d", userAlias = "u")
|
|
|
|
|
public List<SysUser> selectAllocatedList(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public List<SysUser> selectAllocatedList(SysUser user) {
|
|
|
|
|
return userMapper.selectAllocatedList(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -95,8 +93,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@DataScope(deptAlias = "d", userAlias = "u")
|
|
|
|
|
public List<SysUser> selectUnallocatedList(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public List<SysUser> selectUnallocatedList(SysUser user) {
|
|
|
|
|
return userMapper.selectUnallocatedList(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -107,8 +104,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 用户对象信息
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public SysUser selectUserByUserName(String userName)
|
|
|
|
|
{
|
|
|
|
|
public SysUser selectUserByUserName(String userName) {
|
|
|
|
|
return userMapper.selectUserByUserName(userName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -119,8 +115,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 用户对象信息
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public SysUser selectUserById(Long userId)
|
|
|
|
|
{
|
|
|
|
|
public SysUser selectUserById(Long userId) {
|
|
|
|
|
return userMapper.selectUserById(userId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -131,11 +126,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public String selectUserRoleGroup(String userName)
|
|
|
|
|
{
|
|
|
|
|
public String selectUserRoleGroup(String userName) {
|
|
|
|
|
List<SysRole> list = roleMapper.selectRolesByUserName(userName);
|
|
|
|
|
if (CollectionUtils.isEmpty(list))
|
|
|
|
|
{
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
return StringUtils.EMPTY;
|
|
|
|
|
}
|
|
|
|
|
return list.stream().map(SysRole::getRoleName).collect(Collectors.joining(","));
|
|
|
|
@ -148,11 +141,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public String selectUserPostGroup(String userName)
|
|
|
|
|
{
|
|
|
|
|
public String selectUserPostGroup(String userName) {
|
|
|
|
|
List<SysPost> list = postMapper.selectPostsByUserName(userName);
|
|
|
|
|
if (CollectionUtils.isEmpty(list))
|
|
|
|
|
{
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
return StringUtils.EMPTY;
|
|
|
|
|
}
|
|
|
|
|
return list.stream().map(SysPost::getPostName).collect(Collectors.joining(","));
|
|
|
|
@ -165,12 +156,10 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public boolean checkUserNameUnique(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public boolean checkUserNameUnique(SysUser user) {
|
|
|
|
|
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
|
|
|
|
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
|
|
|
|
|
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
|
|
|
|
return UserConstants.NOT_UNIQUE;
|
|
|
|
|
}
|
|
|
|
|
return UserConstants.UNIQUE;
|
|
|
|
@ -183,12 +172,10 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public boolean checkPhoneUnique(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public boolean checkPhoneUnique(SysUser user) {
|
|
|
|
|
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
|
|
|
|
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
|
|
|
|
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
|
|
|
|
return UserConstants.NOT_UNIQUE;
|
|
|
|
|
}
|
|
|
|
|
return UserConstants.UNIQUE;
|
|
|
|
@ -201,12 +188,10 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public boolean checkEmailUnique(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public boolean checkEmailUnique(SysUser user) {
|
|
|
|
|
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
|
|
|
|
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
|
|
|
|
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue())
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
|
|
|
|
|
return UserConstants.NOT_UNIQUE;
|
|
|
|
|
}
|
|
|
|
|
return UserConstants.UNIQUE;
|
|
|
|
@ -218,10 +203,8 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @param user 用户信息
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void checkUserAllowed(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin())
|
|
|
|
|
{
|
|
|
|
|
public void checkUserAllowed(SysUser user) {
|
|
|
|
|
if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) {
|
|
|
|
|
throw new ServiceException("不允许操作超级管理员用户");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -232,15 +215,12 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @param userId 用户id
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void checkUserDataScope(Long userId)
|
|
|
|
|
{
|
|
|
|
|
if (!SysUser.isAdmin(SecurityUtils.getUserId()))
|
|
|
|
|
{
|
|
|
|
|
public void checkUserDataScope(Long userId) {
|
|
|
|
|
if (!SysUser.isAdmin(SecurityUtils.getUserId())) {
|
|
|
|
|
SysUser user = new SysUser();
|
|
|
|
|
user.setUserId(userId);
|
|
|
|
|
List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
|
|
|
|
|
if (StringUtils.isEmpty(users))
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isEmpty(users)) {
|
|
|
|
|
throw new ServiceException("没有权限访问用户数据!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -254,8 +234,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int insertUser(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public int insertUser(SysUser user) {
|
|
|
|
|
// 新增用户信息
|
|
|
|
|
int rows = userMapper.insertUser(user);
|
|
|
|
|
// 新增用户岗位关联
|
|
|
|
@ -272,8 +251,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public boolean registerUser(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public boolean registerUser(SysUser user) {
|
|
|
|
|
return userMapper.insertUser(user) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -285,8 +263,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int updateUser(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public int updateUser(SysUser user) {
|
|
|
|
|
Long userId = user.getUserId();
|
|
|
|
|
// 删除用户与角色关联
|
|
|
|
|
userRoleMapper.deleteUserRoleByUserId(userId);
|
|
|
|
@ -302,13 +279,12 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
/**
|
|
|
|
|
* 用户授权角色
|
|
|
|
|
*
|
|
|
|
|
* @param userId 用户ID
|
|
|
|
|
* @param userId 用户ID
|
|
|
|
|
* @param roleIds 角色组
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void insertUserAuth(Long userId, Long[] roleIds)
|
|
|
|
|
{
|
|
|
|
|
public void insertUserAuth(Long userId, Long[] roleIds) {
|
|
|
|
|
userRoleMapper.deleteUserRoleByUserId(userId);
|
|
|
|
|
insertUserRole(userId, roleIds);
|
|
|
|
|
}
|
|
|
|
@ -320,8 +296,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int updateUserStatus(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public int updateUserStatus(SysUser user) {
|
|
|
|
|
return userMapper.updateUser(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -332,8 +307,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int updateUserProfile(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public int updateUserProfile(SysUser user) {
|
|
|
|
|
return userMapper.updateUser(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -341,12 +315,11 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* 修改用户头像
|
|
|
|
|
*
|
|
|
|
|
* @param userName 用户名
|
|
|
|
|
* @param avatar 头像地址
|
|
|
|
|
* @param avatar 头像地址
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public boolean updateUserAvatar(String userName, String avatar)
|
|
|
|
|
{
|
|
|
|
|
public boolean updateUserAvatar(String userName, String avatar) {
|
|
|
|
|
return userMapper.updateUserAvatar(userName, avatar) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -357,8 +330,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int resetPwd(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public int resetPwd(SysUser user) {
|
|
|
|
|
return userMapper.updateUser(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -370,8 +342,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public int resetUserPwd(String userName, String password)
|
|
|
|
|
{
|
|
|
|
|
public int resetUserPwd(String userName, String password) {
|
|
|
|
|
return userMapper.resetUserPwd(userName, password);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -380,8 +351,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
*
|
|
|
|
|
* @param user 用户对象
|
|
|
|
|
*/
|
|
|
|
|
public void insertUserRole(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public void insertUserRole(SysUser user) {
|
|
|
|
|
this.insertUserRole(user.getUserId(), user.getRoleIds());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -390,15 +360,12 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
*
|
|
|
|
|
* @param user 用户对象
|
|
|
|
|
*/
|
|
|
|
|
public void insertUserPost(SysUser user)
|
|
|
|
|
{
|
|
|
|
|
public void insertUserPost(SysUser user) {
|
|
|
|
|
Long[] posts = user.getPostIds();
|
|
|
|
|
if (StringUtils.isNotEmpty(posts))
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNotEmpty(posts)) {
|
|
|
|
|
// 新增用户与岗位管理
|
|
|
|
|
List<SysUserPost> list = new ArrayList<SysUserPost>();
|
|
|
|
|
for (Long postId : posts)
|
|
|
|
|
{
|
|
|
|
|
for (Long postId : posts) {
|
|
|
|
|
SysUserPost up = new SysUserPost();
|
|
|
|
|
up.setUserId(user.getUserId());
|
|
|
|
|
up.setPostId(postId);
|
|
|
|
@ -411,17 +378,14 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
/**
|
|
|
|
|
* 新增用户角色信息
|
|
|
|
|
*
|
|
|
|
|
* @param userId 用户ID
|
|
|
|
|
* @param userId 用户ID
|
|
|
|
|
* @param roleIds 角色组
|
|
|
|
|
*/
|
|
|
|
|
public void insertUserRole(Long userId, Long[] roleIds)
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNotEmpty(roleIds))
|
|
|
|
|
{
|
|
|
|
|
public void insertUserRole(Long userId, Long[] roleIds) {
|
|
|
|
|
if (StringUtils.isNotEmpty(roleIds)) {
|
|
|
|
|
// 新增用户与角色管理
|
|
|
|
|
List<SysUserRole> list = new ArrayList<SysUserRole>();
|
|
|
|
|
for (Long roleId : roleIds)
|
|
|
|
|
{
|
|
|
|
|
for (Long roleId : roleIds) {
|
|
|
|
|
SysUserRole ur = new SysUserRole();
|
|
|
|
|
ur.setUserId(userId);
|
|
|
|
|
ur.setRoleId(roleId);
|
|
|
|
@ -439,8 +403,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int deleteUserById(Long userId)
|
|
|
|
|
{
|
|
|
|
|
public int deleteUserById(Long userId) {
|
|
|
|
|
// 删除用户与角色关联
|
|
|
|
|
userRoleMapper.deleteUserRoleByUserId(userId);
|
|
|
|
|
// 删除用户与岗位表
|
|
|
|
@ -456,10 +419,8 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public int deleteUserByIds(Long[] userIds)
|
|
|
|
|
{
|
|
|
|
|
for (Long userId : userIds)
|
|
|
|
|
{
|
|
|
|
|
public int deleteUserByIds(Long[] userIds) {
|
|
|
|
|
for (Long userId : userIds) {
|
|
|
|
|
checkUserAllowed(new SysUser(userId));
|
|
|
|
|
checkUserDataScope(userId);
|
|
|
|
|
}
|
|
|
|
@ -473,16 +434,14 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
/**
|
|
|
|
|
* 导入用户数据
|
|
|
|
|
*
|
|
|
|
|
* @param userList 用户数据列表
|
|
|
|
|
* @param userList 用户数据列表
|
|
|
|
|
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
|
|
|
|
* @param operName 操作用户
|
|
|
|
|
* @param operName 操作用户
|
|
|
|
|
* @return 结果
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName)
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNull(userList) || userList.size() == 0)
|
|
|
|
|
{
|
|
|
|
|
public String importUser(List<SysUser> userList, Boolean isUpdateSupport, String operName) {
|
|
|
|
|
if (StringUtils.isNull(userList) || userList.size() == 0) {
|
|
|
|
|
throw new ServiceException("导入用户数据不能为空!");
|
|
|
|
|
}
|
|
|
|
|
int successNum = 0;
|
|
|
|
@ -490,23 +449,18 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
StringBuilder successMsg = new StringBuilder();
|
|
|
|
|
StringBuilder failureMsg = new StringBuilder();
|
|
|
|
|
String password = configService.selectConfigByKey("sys.user.initPassword");
|
|
|
|
|
for (SysUser user : userList)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
for (SysUser user : userList) {
|
|
|
|
|
try {
|
|
|
|
|
// 验证是否存在这个用户
|
|
|
|
|
SysUser u = userMapper.selectUserByUserName(user.getUserName());
|
|
|
|
|
if (StringUtils.isNull(u))
|
|
|
|
|
{
|
|
|
|
|
if (StringUtils.isNull(u)) {
|
|
|
|
|
BeanValidators.validateWithException(validator, user);
|
|
|
|
|
user.setPassword(SecurityUtils.encryptPassword(password));
|
|
|
|
|
user.setCreateBy(operName);
|
|
|
|
|
userMapper.insertUser(user);
|
|
|
|
|
successNum++;
|
|
|
|
|
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
|
|
|
|
|
}
|
|
|
|
|
else if (isUpdateSupport)
|
|
|
|
|
{
|
|
|
|
|
} else if (isUpdateSupport) {
|
|
|
|
|
BeanValidators.validateWithException(validator, user);
|
|
|
|
|
checkUserAllowed(u);
|
|
|
|
|
checkUserDataScope(u.getUserId());
|
|
|
|
@ -515,31 +469,43 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
|
|
userMapper.updateUser(user);
|
|
|
|
|
successNum++;
|
|
|
|
|
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
failureNum++;
|
|
|
|
|
failureMsg.append("<br/>" + failureNum + "、账号 " + user.getUserName() + " 已存在");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
failureNum++;
|
|
|
|
|
String msg = "<br/>" + failureNum + "、账号 " + user.getUserName() + " 导入失败:";
|
|
|
|
|
failureMsg.append(msg + e.getMessage());
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (failureNum > 0)
|
|
|
|
|
{
|
|
|
|
|
if (failureNum > 0) {
|
|
|
|
|
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
|
|
|
|
throw new ServiceException(failureMsg.toString());
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
} else {
|
|
|
|
|
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
|
|
|
|
}
|
|
|
|
|
return successMsg.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param: tenantId
|
|
|
|
|
* @description 根据租户ID获取用户ID数组
|
|
|
|
|
* @author xins
|
|
|
|
|
* @date 2023-09-27 10:08
|
|
|
|
|
* @return Long[]
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Long[] getUserIdsByTenantId(Long tenantId) {
|
|
|
|
|
SysUser queryUser = new SysUser();
|
|
|
|
|
queryUser.setTenantId(tenantId);
|
|
|
|
|
List<SysUser> users = userMapper.selectUserList(queryUser);
|
|
|
|
|
if (users != null && !users.isEmpty()) {
|
|
|
|
|
return users.stream().
|
|
|
|
|
map(SysUser::getUserId).toArray(Long[]::new);
|
|
|
|
|
}
|
|
|
|
|
return new Long[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|