| | |
| | | package com.ruoyi.project.system.service.impl;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collections;
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | | import javax.validation.Validator;
|
| | |
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
| | | import com.ruoyi.project.system.domain.*;
|
| | | import com.ruoyi.project.system.mapper.*;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.beans.BeanUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.util.CollectionUtils;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.exception.ServiceException;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | |
| | | import com.ruoyi.common.utils.bean.BeanValidators;
|
| | | import com.ruoyi.common.utils.spring.SpringUtils;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
|
| | | import com.ruoyi.project.system.domain.*;
|
| | | import com.ruoyi.project.system.mapper.*;
|
| | | import com.ruoyi.project.system.service.ISysConfigService;
|
| | | import com.ruoyi.project.system.service.ISysDeptService;
|
| | | import com.ruoyi.project.system.service.ISysUserService;
|
| | | import jakarta.validation.Validator;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.util.CollectionUtils;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * 用户 业务层处理
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Service
|
| | | @RequiredArgsConstructor
|
| | | public class SysUserServiceImpl implements ISysUserService
|
| | | {
|
| | | @Autowired
|
| | | private SysUserDeptMapper sysUserDeptMapper;
|
| | |
|
| | | private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
| | |
|
| | | @Autowired
|
| | | private SysUserMapper userMapper;
|
| | |
|
| | | @Autowired
|
| | | private SysRoleMapper roleMapper;
|
| | |
|
| | | @Autowired
|
| | | private SysPostMapper postMapper;
|
| | |
|
| | | @Autowired
|
| | | private SysUserRoleMapper userRoleMapper;
|
| | |
|
| | | @Autowired
|
| | | private SysUserPostMapper userPostMapper;
|
| | |
|
| | | @Autowired
|
| | | private ISysConfigService configService;
|
| | |
|
| | | @Autowired
|
| | | private ISysDeptService deptService;
|
| | |
|
| | | @Autowired
|
| | | protected Validator validator;
|
| | | private final SysUserDeptMapper sysUserDeptMapper;
|
| | | private final SysUserMapper userMapper;
|
| | | private final SysRoleMapper roleMapper;
|
| | | private final SysPostMapper postMapper;
|
| | | private final SysUserRoleMapper userRoleMapper;
|
| | | private final SysUserPostMapper userPostMapper;
|
| | | private final ISysConfigService configService;
|
| | | protected final Validator validator;
|
| | |
|
| | | /**
|
| | | * 根据条件分页查询用户列表
|
| | |
| | |
|
| | | /**
|
| | | * 批量删除用户信息
|
| | | * |
| | | *
|
| | | * @param userIds 需要删除的用户ID
|
| | | * @return 结果
|
| | | */
|
| | |
| | | userRoleMapper.deleteUserRole(userIds);
|
| | | // 删除用户与岗位关联
|
| | | userPostMapper.deleteUserPost(userIds);
|
| | | // 删除用户与部门数据
|
| | | sysUserDeptMapper.delete(new LambdaQueryWrapper<SysUserDept>()
|
| | | .in(SysUserDept::getUserId, userIds));
|
| | | return userMapper.deleteUserByIds(userIds);
|
| | | }
|
| | |
|