修改用户管理 把部门修改成了科室
This commit is contained in:
parent
b0dca6c6f7
commit
ea0d7222f9
@ -56,4 +56,8 @@ public interface InspectDepartmentService {
|
||||
获取所有的科室集合
|
||||
* */
|
||||
List<InspectDepartmentDO> getListDepartment();
|
||||
/*
|
||||
* 获取科室信息组
|
||||
* */
|
||||
List<InspectDepartmentDO> getDeptList(Collection<Long> ids);
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.inspect.service.inspectdepartment;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -76,4 +78,13 @@ public class InspectDepartmentServiceImpl implements InspectDepartmentService {
|
||||
{
|
||||
return departmentMapper.selectList(null);
|
||||
}
|
||||
@Override
|
||||
public List<InspectDepartmentDO> getDeptList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
QueryWrapper<InspectDepartmentDO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("departmentCode", ids); //
|
||||
return departmentMapper.selectList(queryWrapper);
|
||||
}
|
||||
}
|
@ -107,6 +107,12 @@
|
||||
<groupId>com.xingyuv</groupId>
|
||||
<artifactId>spring-boot-starter-captcha-plus</artifactId> <!-- 验证码,一般用于登录使用 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-inspect-biz</artifactId>
|
||||
<version>2.4.1-jdk8-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -6,7 +6,10 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectdepartment.InspectDepartmentDO;
|
||||
import cn.iocoder.yudao.module.inspect.service.inspectdepartment.InspectDepartmentService;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
|
||||
import cn.iocoder.yudao.module.system.convert.user.UserConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
@ -45,7 +48,8 @@ public class UserController {
|
||||
private AdminUserService userService;
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
|
||||
@Resource
|
||||
private InspectDepartmentService departmentService;
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "新增用户")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:create')")
|
||||
@ -96,10 +100,14 @@ public class UserController {
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return success(new PageResult<>(pageResult.getTotal()));
|
||||
}
|
||||
// 拼接数据
|
||||
Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
||||
convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
||||
return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
||||
// 拼接自己的科室数据
|
||||
List<InspectDepartmentDO> list = departmentService.getDeptList(convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
||||
Map<String, InspectDepartmentDO> deptMap = CollectionUtils.convertMap(list, InspectDepartmentDO::getDepartmentCode);
|
||||
|
||||
// 框架原本的拼接数据
|
||||
// Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
||||
// convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
||||
return success(new PageResult<>(UserConvert.INSTANCE.convertdeptList(pageResult.getList(), deptMap),
|
||||
pageResult.getTotal()));
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.system.convert.user;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.inspect.dal.dataobject.inspectdepartment.InspectDepartmentDO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleSimpleRespVO;
|
||||
@ -28,7 +29,9 @@ public interface UserConvert {
|
||||
default List<UserRespVO> convertList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap) {
|
||||
return CollectionUtils.convertList(list, user -> convert(user, deptMap.get(user.getDeptId())));
|
||||
}
|
||||
|
||||
default List<UserRespVO> convertdeptList(List<AdminUserDO> list, Map<String, InspectDepartmentDO> deptMap) {
|
||||
return CollectionUtils.convertList(list, user -> convertdept(user, deptMap.get(String.valueOf(user.getDeptId()))));
|
||||
}
|
||||
default UserRespVO convert(AdminUserDO user, DeptDO dept) {
|
||||
UserRespVO userVO = BeanUtils.toBean(user, UserRespVO.class);
|
||||
if (dept != null) {
|
||||
@ -36,6 +39,15 @@ public interface UserConvert {
|
||||
}
|
||||
return userVO;
|
||||
}
|
||||
default UserRespVO convertdept(AdminUserDO user, InspectDepartmentDO dept) {
|
||||
UserRespVO userVO = BeanUtils.toBean(user, UserRespVO.class);
|
||||
if (dept != null) {
|
||||
userVO.setDeptName(dept.getDepartmentName());
|
||||
}
|
||||
return userVO;
|
||||
}
|
||||
|
||||
|
||||
|
||||
default List<UserSimpleRespVO> convertSimpleList(List<AdminUserDO> list, Map<Long, DeptDO> deptMap) {
|
||||
return CollectionUtils.convertList(list, user -> {
|
||||
|
@ -364,10 +364,10 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
validateMobileUnique(id, mobile);
|
||||
// 校验邮箱唯一
|
||||
validateEmailUnique(id, email);
|
||||
// 校验部门处于开启状态
|
||||
deptService.validateDeptList(CollectionUtils.singleton(deptId));
|
||||
// 校验岗位处于开启状态
|
||||
postService.validatePostList(postIds);
|
||||
// 校验部门处于开启状态 部门改成科室 修改新增不在校验
|
||||
// deptService.validateDeptList(CollectionUtils.singleton(deptId));
|
||||
// 校验岗位处于开启状态 岗位同理
|
||||
// postService.validatePostList(postIds);
|
||||
return user;
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user