1. 新增查询所有本人加下属公司列表接口
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -32,7 +32,7 @@
|
|||||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>3.0.31</revision>
|
<revision>3.0.33</revision>
|
||||||
<!-- Maven 相关 -->
|
<!-- Maven 相关 -->
|
||||||
<java.version>17</java.version>
|
<java.version>17</java.version>
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>3.0.31</revision>
|
<revision>3.0.33</revision>
|
||||||
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
|
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
|
||||||
<!-- 统一依赖管理 -->
|
<!-- 统一依赖管理 -->
|
||||||
<spring.boot.version>3.4.5</spring.boot.version>
|
<spring.boot.version>3.4.5</spring.boot.version>
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ public interface DeptApi {
|
|||||||
@Operation(summary = "获得公司精简信息列表")
|
@Operation(summary = "获得公司精简信息列表")
|
||||||
CommonResult<List<DeptSimpleRespDTO>> getSimpleCompanyList();
|
CommonResult<List<DeptSimpleRespDTO>> getSimpleCompanyList();
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/all-company-list")
|
||||||
|
@Operation(summary = "获得所有公司精简信息列表")
|
||||||
|
CommonResult<List<DeptSimpleRespDTO>> getAllCompanyList();
|
||||||
|
|
||||||
@GetMapping(PREFIX + "/get")
|
@GetMapping(PREFIX + "/get")
|
||||||
@Operation(summary = "获得部门信息")
|
@Operation(summary = "获得部门信息")
|
||||||
@Parameter(name = "id", description = "部门编号", example = "1024", required = true)
|
@Parameter(name = "id", description = "部门编号", example = "1024", required = true)
|
||||||
|
|||||||
@@ -66,6 +66,17 @@ public class DeptApiImpl implements DeptApi {
|
|||||||
return success(BeanUtils.toBean(companies, DeptSimpleRespDTO.class));
|
return success(BeanUtils.toBean(companies, DeptSimpleRespDTO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<List<DeptSimpleRespDTO>> getAllCompanyList() {
|
||||||
|
List<DeptDO> allCompanies = deptService.getAllCompanyList();
|
||||||
|
// 还需要把用户归属的公司加上
|
||||||
|
List<DeptDO> userCompanyList = deptService.getUserCompanyList();
|
||||||
|
allCompanies.addAll(userCompanyList);
|
||||||
|
// 去重
|
||||||
|
List<DeptDO> companies = allCompanies.stream().distinct().toList();
|
||||||
|
return success(BeanUtils.toBean(companies, DeptSimpleRespDTO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<DeptRespDTO> getDept(Long id) {
|
public CommonResult<DeptRespDTO> getDept(Long id) {
|
||||||
DeptDO dept = deptService.getDept(id);
|
DeptDO dept = deptService.getDept(id);
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package cn.iocoder.yudao.module.system.controller.admin.dept;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CompanyDeptInfo;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import cn.iocoder.yudao.module.system.api.dept.dto.CompanyDeptInfoRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSaveReqVO;
|
||||||
@@ -20,6 +22,7 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@@ -78,12 +81,27 @@ public class DeptController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = {"/list-company-simple", "/simple-company-list"})
|
@GetMapping(value = {"/list-company-simple", "/simple-company-list"})
|
||||||
@Operation(summary = "获取公司精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
|
@Operation(summary = "获取用户所属公司精简信息列表", description = "只包含被开启的部门,主要用于前端的下拉选项")
|
||||||
public CommonResult<List<DeptSimpleRespVO>> getSimpleCompanyList() {
|
public CommonResult<List<DeptSimpleRespVO>> getSimpleCompanyList() {
|
||||||
List<DeptDO> list = deptService.getUserCompanyList();
|
List<DeptDO> list = deptService.getUserCompanyList();
|
||||||
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = {"/list-all-company", "/all-company-list"})
|
||||||
|
@Operation(summary = "获取所有公司精简信息列表", description = "只包含被开启的公司部门,主要用于前端的下拉选项")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
||||||
|
public CommonResult<List<DeptSimpleRespVO>> getAllCompanyList() {
|
||||||
|
List<DeptDO> list = deptService.getAllCompanyList();
|
||||||
|
// 还需要把用户归属的公司加上
|
||||||
|
List<DeptDO> userCompanyList = deptService.getUserCompanyList();
|
||||||
|
list.addAll(userCompanyList);
|
||||||
|
// 去重
|
||||||
|
list = list.stream().distinct().toList();
|
||||||
|
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/top-level-list")
|
@GetMapping("/top-level-list")
|
||||||
@Operation(summary = "获取顶级部门列表", description = "用于懒加载,只返回没有父部门的顶级部门")
|
@Operation(summary = "获取顶级部门列表", description = "用于懒加载,只返回没有父部门的顶级部门")
|
||||||
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
||||||
@@ -110,4 +128,13 @@ public class DeptController {
|
|||||||
return success(BeanUtils.toBean(dept, DeptRespVO.class));
|
return success(BeanUtils.toBean(dept, DeptRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/company-dept-info")
|
||||||
|
@Operation(summary = "获得指定用户的公司部门信息")
|
||||||
|
@Parameter(name = "userId", description = "用户编号", required = true, example = "1")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
||||||
|
public CommonResult<Set<CompanyDeptInfoRespDTO>> getCompanyDeptInfoListByUserId(@RequestParam("userId") Long userId) {
|
||||||
|
Set<CompanyDeptInfo> companyDeptInfos = deptService.getCompanyDeptInfoListByUserId(userId);
|
||||||
|
return success(BeanUtils.toBean(companyDeptInfos, CompanyDeptInfoRespDTO.class));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,4 +98,18 @@ public interface DeptMapper extends BaseMapperX<DeptDO> {
|
|||||||
return selectOne(DeptDO::getCode, code);
|
return selectOne(DeptDO::getCode, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询所有公司列表
|
||||||
|
*
|
||||||
|
* @param status 状态
|
||||||
|
* @return 公司列表
|
||||||
|
*/
|
||||||
|
default List<DeptDO> selectAllCompanyList(Integer status) {
|
||||||
|
return selectList(new LambdaQueryWrapperX<DeptDO>()
|
||||||
|
.eq(DeptDO::getIsCompany, true)
|
||||||
|
.eqIfPresent(DeptDO::getStatus, status)
|
||||||
|
.orderByAsc(DeptDO::getSort)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,4 +135,11 @@ public interface DeptService {
|
|||||||
* @return 直接子部门列表
|
* @return 直接子部门列表
|
||||||
*/
|
*/
|
||||||
List<DeptDO> getDirectChildDeptList(Long parentId);
|
List<DeptDO> getDirectChildDeptList(Long parentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有公司列表
|
||||||
|
*
|
||||||
|
* @return 公司列表
|
||||||
|
*/
|
||||||
|
List<DeptDO> getAllCompanyList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -347,4 +347,10 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
return deptMapper.selectListByParentId(parentId, CommonStatusEnum.ENABLE.getStatus());
|
return deptMapper.selectListByParentId(parentId, CommonStatusEnum.ENABLE.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeptDO> getAllCompanyList() {
|
||||||
|
// 查询所有启用状态的公司部门
|
||||||
|
return deptMapper.selectAllCompanyList(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user