refactor(system): 优化部门信息获取功能

- 修改了 DeptService 接口,增加了 method 参数以
This commit is contained in:
furongxin 2025-01-09 10:10:16 +08:00
parent 1fcb34677e
commit 0e8ca79912
6 changed files with 13 additions and 10 deletions

View File

@ -132,7 +132,7 @@ public class DeptApiImpl implements DeptApi {
@Override @Override
@DataPermission(enable = false) @DataPermission(enable = false)
public CommonResult<List<DeptRespDTO>> getCompanyDept() { public CommonResult<List<DeptRespDTO>> getCompanyDept() {
List<DeptDO> deptDOS = deptService.getCompanyDept(); List<DeptDO> deptDOS = deptService.getCompanyDept(2);
return success(BeanUtils.toBean(deptDOS, DeptRespDTO.class)); return success(BeanUtils.toBean(deptDOS, DeptRespDTO.class));
} }

View File

@ -271,9 +271,10 @@ public class DeptController {
@GetMapping("/getCompanyDept") @GetMapping("/getCompanyDept")
@Operation(summary = "获取部门类型为公司的部门信息") @Operation(summary = "获取部门类型为公司的部门信息")
@Parameter(name = "method", description = "查询类型 | 1全部 2真实公司 3隐藏公司")
@DataPermission(enable = false) @DataPermission(enable = false)
public CommonResult<List<DeptSimpleRespVO>> getCompanyDept() { public CommonResult<List<DeptSimpleRespVO>> getCompanyDept(@RequestParam(name = "method", required = false, defaultValue = "2") Integer method) {
List<DeptDO> list = deptService.getCompanyDept(); List<DeptDO> list = deptService.getCompanyDept(method);
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class)); return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
} }

View File

@ -75,7 +75,7 @@ public class AttendancePunchRecordController {
@GetMapping("/getMissingCardRecord") @GetMapping("/getMissingCardRecord")
@Operation(summary = "获得本月用户缺卡记录") @Operation(summary = "获得本月用户缺卡记录")
@PreAuthorize("@ss.hasPermission('attendance:punch-record:query')") // @PreAuthorize("@ss.hasPermission('attendance:punch-record:query')")
public CommonResult<List<AttendancePunchRecordRespVO>> getPunchRecord() { public CommonResult<List<AttendancePunchRecordRespVO>> getPunchRecord() {
// 获取当前用户已申请的补卡记录 // 获取当前用户已申请的补卡记录

View File

@ -178,7 +178,7 @@ public class LogInstanceController {
public CommonResult<List<DeptRespVO>> getReadCompanyDept() { public CommonResult<List<DeptRespVO>> getReadCompanyDept() {
// 获得公司编号列表 // 获得公司编号列表
List<DeptDO> companyDeptDOs = deptService.getCompanyDept(); List<DeptDO> companyDeptDOs = deptService.getCompanyDept(2);
// 获得用户角色 // 获得用户角色
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(getLoginUserId())); List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(getLoginUserId()));

View File

@ -138,7 +138,7 @@ public interface DeptService {
* *
* @return 部门信息列表 * @return 部门信息列表
*/ */
List<DeptDO> getCompanyDept(); List<DeptDO> getCompanyDept(Integer method);
/** /**
* 获取所有工厂部门 * 获取所有工厂部门

View File

@ -330,14 +330,16 @@ public class DeptServiceImpl implements DeptService {
@Override @Override
@DataPermission(enable = false) @DataPermission(enable = false)
public List<DeptDO> getCompanyDept() { public List<DeptDO> getCompanyDept(Integer method) {
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>() return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
.eq(method == 2, DeptDO::getVirtuallyStatus, 0)
.eq(method == 3, DeptDO::getVirtuallyStatus, 1)
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus())
.eq(DeptDO::getType, DeptTypeEnum.COMPANY.getValue()) .eq(DeptDO::getType, DeptTypeEnum.COMPANY.getValue())
.or() .or()
.eq(DeptDO::getType, DeptTypeEnum.HEAD_COMPANY.getValue()) .eq(DeptDO::getType, DeptTypeEnum.HEAD_COMPANY.getValue()));
.eq(DeptDO::getVirtuallyStatus, 0)
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
} }
@Override @Override