mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】【user】用户列表增加组织机构查询条件
parent
c811de7ace
commit
d90b99ecea
|
@ -63,4 +63,14 @@ public interface SysUserServiceApi {
|
||||||
*/
|
*/
|
||||||
List<UserOrgDTO> getUserOrgList(Long userId);
|
List<UserOrgDTO> getUserOrgList(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某个机构下的所有用户id集合
|
||||||
|
*
|
||||||
|
* @param orgId 组织机构id
|
||||||
|
* @param containSubOrgFlag 是否包含指定机构的子集机构,true-包含子集,false-不包含
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/11 21:46
|
||||||
|
*/
|
||||||
|
List<Long> getOrgUserIdList(Long orgId, Boolean containSubOrgFlag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package cn.stylefeng.roses.kernel.sys.modular.user.biz;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.sys.api.SysUserServiceApi;
|
||||||
|
import cn.stylefeng.roses.kernel.sys.api.pojo.SimpleUserDTO;
|
||||||
|
import cn.stylefeng.roses.kernel.sys.api.pojo.UserOrgDTO;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户相关的综合业务
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/11 21:44
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserIntegrationService implements SysUserServiceApi {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SimpleUserDTO getUserInfoByUserId(Long userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserOrgDTO getUserMainOrgInfo(Long userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<UserOrgDTO> getUserOrgList(Long userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> getOrgUserIdList(Long orgId, Boolean containSubOrgFlag) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -126,29 +126,14 @@ public class SysUserRequest extends BaseRequest {
|
||||||
@ChineseDescription("对接外部主数据的用户id")
|
@ChineseDescription("对接外部主数据的用户id")
|
||||||
private String masterUserId;
|
private String masterUserId;
|
||||||
|
|
||||||
/**
|
//-------------------------------非实体字段-------------------------------
|
||||||
* 拓展字段
|
//-------------------------------非实体字段-------------------------------
|
||||||
*/
|
//-------------------------------非实体字段-------------------------------
|
||||||
@ChineseDescription("拓展字段")
|
|
||||||
private String expandField;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 乐观锁
|
* 组织机构id查询条件
|
||||||
*/
|
*/
|
||||||
@ChineseDescription("乐观锁")
|
@ChineseDescription("组织机构id查询条件")
|
||||||
private Long versionFlag;
|
private Long orgIdCondition;
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除标记:Y-已删除,N-未删除
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "删除标记:Y-已删除,N-未删除不能为空", groups = {add.class, edit.class})
|
|
||||||
@ChineseDescription("删除标记:Y-已删除,N-未删除")
|
|
||||||
private String delFlag;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 租户号
|
|
||||||
*/
|
|
||||||
@ChineseDescription("租户号")
|
|
||||||
private Long tenantId;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,6 @@ import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
|
||||||
import cn.stylefeng.roses.kernel.sys.api.SysUserServiceApi;
|
import cn.stylefeng.roses.kernel.sys.api.SysUserServiceApi;
|
||||||
import cn.stylefeng.roses.kernel.sys.api.pojo.SimpleUserDTO;
|
|
||||||
import cn.stylefeng.roses.kernel.sys.api.pojo.UserOrgDTO;
|
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.user.entity.SysUser;
|
import cn.stylefeng.roses.kernel.sys.modular.user.entity.SysUser;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.user.enums.SysUserExceptionEnum;
|
import cn.stylefeng.roses.kernel.sys.modular.user.enums.SysUserExceptionEnum;
|
||||||
import cn.stylefeng.roses.kernel.sys.modular.user.mapper.SysUserMapper;
|
import cn.stylefeng.roses.kernel.sys.modular.user.mapper.SysUserMapper;
|
||||||
|
@ -20,6 +18,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +28,10 @@ import java.util.List;
|
||||||
* @date 2023/06/10 21:26
|
* @date 2023/06/10 21:26
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService, SysUserServiceApi {
|
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysUserServiceApi sysUserServiceApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(SysUserRequest sysUserRequest) {
|
public void add(SysUserRequest sysUserRequest) {
|
||||||
|
@ -63,11 +65,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
// 只查询需要的字段
|
// 只查询需要的字段
|
||||||
wrapper.select(SysUser::getUserId, SysUser::getRealName, SysUser::getAccount, SysUser::getSex, SysUser::getStatusFlag, BaseEntity::getCreateTime);
|
wrapper.select(SysUser::getUserId, SysUser::getRealName, SysUser::getAccount, SysUser::getSex, SysUser::getStatusFlag, BaseEntity::getCreateTime);
|
||||||
|
|
||||||
|
// 分页查询
|
||||||
Page<SysUser> sysUserPage = this.page(PageFactory.defaultPage(), wrapper);
|
Page<SysUser> sysUserPage = this.page(PageFactory.defaultPage(), wrapper);
|
||||||
|
|
||||||
// 遍历查询结果,增加对用户部门信息的返回
|
// 遍历查询结果,增加对用户部门信息的返回
|
||||||
for (SysUser record : sysUserPage.getRecords()) {
|
for (SysUser record : sysUserPage.getRecords()) {
|
||||||
record.setUserOrgDTO(this.getUserMainOrgInfo(record.getUserId()));
|
record.setUserOrgDTO(sysUserServiceApi.getUserMainOrgInfo(record.getUserId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return PageResultFactory.createPageResult(sysUserPage);
|
return PageResultFactory.createPageResult(sysUserPage);
|
||||||
|
@ -79,21 +82,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
return this.list(wrapper);
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SimpleUserDTO getUserInfoByUserId(Long userId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UserOrgDTO getUserMainOrgInfo(Long userId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<UserOrgDTO> getUserOrgList(Long userId) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取信息
|
* 获取信息
|
||||||
*
|
*
|
||||||
|
@ -122,6 +110,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
if (ObjectUtil.isNotEmpty(searchText)) {
|
if (ObjectUtil.isNotEmpty(searchText)) {
|
||||||
queryWrapper.like(SysUser::getRealName, searchText);
|
queryWrapper.like(SysUser::getRealName, searchText);
|
||||||
queryWrapper.or().like(SysUser::getAccount, searchText);
|
queryWrapper.or().like(SysUser::getAccount, searchText);
|
||||||
|
queryWrapper.or().like(SysUser::getPhone, searchText);
|
||||||
|
queryWrapper.or().like(SysUser::getTel, searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据状态进行查询
|
// 根据状态进行查询
|
||||||
|
@ -131,6 +121,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
// 按用户排序字段排序
|
// 按用户排序字段排序
|
||||||
queryWrapper.orderByAsc(SysUser::getUserSort);
|
queryWrapper.orderByAsc(SysUser::getUserSort);
|
||||||
|
|
||||||
|
// 如果传递了组织机构id查询条件,则查询对应机构id下有哪些用户,再拼接用户查询条件
|
||||||
|
if (ObjectUtil.isNotEmpty(sysUserRequest.getOrgIdCondition())) {
|
||||||
|
List<Long> orgUserIdList = this.sysUserServiceApi.getOrgUserIdList(sysUserRequest.getOrgIdCondition(), true);
|
||||||
|
queryWrapper.in(SysUser::getUserId, orgUserIdList);
|
||||||
|
}
|
||||||
|
|
||||||
return queryWrapper;
|
return queryWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue