feat: 查询License管理员的用户列表
This commit is contained in:
@@ -13,7 +13,7 @@ public enum RoleCodeEnum {
|
||||
|
||||
SUPER_ADMIN("super_admin", "超级管理员"),
|
||||
TENANT_ADMIN("tenant_admin", "租户管理员"),
|
||||
CRM_ADMIN("crm_admin", "CRM 管理员"); // CRM 系统专用
|
||||
LICENSE_ADMIN("license_admin", "License管理员"); // CRM 系统专用
|
||||
;
|
||||
|
||||
/**
|
||||
|
||||
@@ -103,6 +103,13 @@ public class UserController {
|
||||
pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@GetMapping({"/list-license-admin"})
|
||||
@Operation(summary = "获取License管理员的用户列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
|
||||
public CommonResult<List<UserSimpleRespVO>> getLicenseAdminList() {
|
||||
List<AdminUserDO> list = userService.getUserList();
|
||||
return success(UserConvert.INSTANCE.convertSimpleList(list));
|
||||
}
|
||||
|
||||
@GetMapping({"/list-all-simple", "/simple-list"})
|
||||
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
|
||||
public CommonResult<List<UserSimpleRespVO>> getSimpleUserList() {
|
||||
|
||||
@@ -36,6 +36,8 @@ public interface UserConvert {
|
||||
return userVO;
|
||||
}
|
||||
|
||||
List<UserSimpleRespVO> convertSimpleList(List<AdminUserDO> list);
|
||||
|
||||
default List<UserSimpleRespVO> convertSimpleList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap) {
|
||||
return CollectionUtils.convertList(list, user -> {
|
||||
UserSimpleRespVO userVO = BeanUtils.toBean(user, UserSimpleRespVO.class);
|
||||
|
||||
@@ -36,6 +36,13 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
.orderByDesc(AdminUserDO::getId));
|
||||
}
|
||||
|
||||
default List<AdminUserDO> selectList(Integer status, Collection<Long> userIds) {
|
||||
return selectList(new LambdaQueryWrapperX<AdminUserDO>()
|
||||
.eqIfPresent(AdminUserDO::getStatus, status)
|
||||
.inIfPresent(AdminUserDO::getId, userIds)
|
||||
.orderByDesc(AdminUserDO::getId));
|
||||
}
|
||||
|
||||
default List<AdminUserDO> selectListByNickname(String nickname) {
|
||||
return selectList(new LambdaQueryWrapperX<AdminUserDO>().like(AdminUserDO::getNickname, nickname));
|
||||
}
|
||||
|
||||
@@ -119,6 +119,13 @@ public interface AdminUserService {
|
||||
*/
|
||||
PageResult<AdminUserDO> getUserPage(UserPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得用户列表
|
||||
*
|
||||
* @return 列表
|
||||
*/
|
||||
List<AdminUserDO> getUserList();
|
||||
|
||||
/**
|
||||
* 通过用户 ID 查询用户
|
||||
*
|
||||
|
||||
@@ -21,9 +21,12 @@ import org.agt.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||
import org.agt.module.system.controller.admin.user.vo.user.UserSaveReqVO;
|
||||
import org.agt.module.system.dal.dataobject.dept.DeptDO;
|
||||
import org.agt.module.system.dal.dataobject.dept.UserPostDO;
|
||||
import org.agt.module.system.dal.dataobject.permission.RoleDO;
|
||||
import org.agt.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import org.agt.module.system.dal.mysql.dept.UserPostMapper;
|
||||
import org.agt.module.system.dal.mysql.permission.RoleMapper;
|
||||
import org.agt.module.system.dal.mysql.user.AdminUserMapper;
|
||||
import org.agt.module.system.enums.permission.RoleCodeEnum;
|
||||
import org.agt.module.system.service.dept.DeptService;
|
||||
import org.agt.module.system.service.dept.PostService;
|
||||
import org.agt.module.system.service.permission.PermissionService;
|
||||
@@ -35,6 +38,7 @@ import com.mzt.logapi.starter.annotation.LogRecord;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -81,6 +85,8 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
|
||||
@Resource
|
||||
private ConfigApi configApi;
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -268,6 +274,20 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
return userMapper.selectPage(reqVO, getDeptCondition(reqVO.getDeptId()), userIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdminUserDO> getUserList() {
|
||||
// 如果有角色编号,查询角色对应的用户编号
|
||||
RoleDO roleDO = roleMapper.selectByCode(RoleCodeEnum.LICENSE_ADMIN.getCode());
|
||||
Set<Long> userIds = roleDO.getId() != null ?
|
||||
permissionService.getUserRoleIdListByRoleId(singleton(roleDO.getId())) : null;
|
||||
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 查询
|
||||
return userMapper.selectList(CommonStatusEnum.ENABLE.getStatus(), userIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminUserDO getUser(Long id) {
|
||||
return userMapper.selectById(id);
|
||||
|
||||
Reference in New Issue
Block a user