mirror of https://gitee.com/stylefeng/roses
【7.2.2】更新公司树的查询
parent
715d3392b7
commit
20d9a48700
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright [2020-2030] [https://www.stylefeng.cn]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||||
|
*
|
||||||
|
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||||
|
* 2.请不要删除和修改Guns源码头部的版权声明。
|
||||||
|
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
|
||||||
|
* 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||||
|
*/
|
||||||
|
package cn.stylefeng.roses.kernel.system.api.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组织机构类型
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2022/5/21 11:26
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum OrgTypeEnum {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公司
|
||||||
|
*/
|
||||||
|
COMPANY(1),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门
|
||||||
|
*/
|
||||||
|
DEPT(2);
|
||||||
|
|
||||||
|
private final Integer code;
|
||||||
|
|
||||||
|
OrgTypeEnum(Integer code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -32,6 +32,7 @@ import cn.stylefeng.roses.kernel.rule.tree.ztree.ZTreeNode;
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
|
||||||
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
|
||||||
|
import cn.stylefeng.roses.kernel.system.api.enums.OrgTypeEnum;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.organization.HrOrganizationRequest;
|
import cn.stylefeng.roses.kernel.system.api.pojo.organization.HrOrganizationRequest;
|
||||||
import cn.stylefeng.roses.kernel.system.api.pojo.organization.OrganizationTreeNode;
|
import cn.stylefeng.roses.kernel.system.api.pojo.organization.OrganizationTreeNode;
|
||||||
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
|
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
|
||||||
|
@ -152,6 +153,18 @@ public class HrOrganizationController {
|
||||||
return new SuccessResponseData<>(hrOrganizationService.organizationTree(hrOrganizationRequest));
|
return new SuccessResponseData<>(hrOrganizationService.organizationTree(hrOrganizationRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公司管理组织机构树
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2022/5/21 11:24
|
||||||
|
*/
|
||||||
|
@GetResource(name = "获取公司管理组织机构树", path = "/hrOrganization/companyTree")
|
||||||
|
public ResponseData<List<OrganizationTreeNode>> companyTree(HrOrganizationRequest hrOrganizationRequest) {
|
||||||
|
hrOrganizationRequest.setOrgType(OrgTypeEnum.COMPANY.getCode());
|
||||||
|
return new SuccessResponseData<>(hrOrganizationService.organizationTree(hrOrganizationRequest));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取组织机构树(用于用户绑定数据范围,可以渲染是否选中信息)
|
* 获取组织机构树(用于用户绑定数据范围,可以渲染是否选中信息)
|
||||||
*
|
*
|
||||||
|
|
|
@ -392,6 +392,7 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
||||||
String orgCode = hrOrganizationRequest.getOrgCode();
|
String orgCode = hrOrganizationRequest.getOrgCode();
|
||||||
Long orgParentId = hrOrganizationRequest.getOrgParentId();
|
Long orgParentId = hrOrganizationRequest.getOrgParentId();
|
||||||
Long orgId = hrOrganizationRequest.getOrgId();
|
Long orgId = hrOrganizationRequest.getOrgId();
|
||||||
|
Integer orgType = hrOrganizationRequest.getOrgType();
|
||||||
|
|
||||||
// 拼接组织机构名称条件
|
// 拼接组织机构名称条件
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(orgName), HrOrganization::getOrgName, orgName);
|
queryWrapper.like(ObjectUtil.isNotEmpty(orgName), HrOrganization::getOrgName, orgName);
|
||||||
|
@ -399,6 +400,9 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
|
||||||
// 拼接组织机构编码条件
|
// 拼接组织机构编码条件
|
||||||
queryWrapper.like(ObjectUtil.isNotEmpty(orgCode), HrOrganization::getOrgCode, orgCode);
|
queryWrapper.like(ObjectUtil.isNotEmpty(orgCode), HrOrganization::getOrgCode, orgCode);
|
||||||
|
|
||||||
|
// 组织机构类型拼接
|
||||||
|
queryWrapper.eq(ObjectUtil.isNotEmpty(orgType), HrOrganization::getOrgType, orgType);
|
||||||
|
|
||||||
// 拼接父机构id查询条件
|
// 拼接父机构id查询条件
|
||||||
if (ObjectUtil.isNotEmpty(orgParentId)) {
|
if (ObjectUtil.isNotEmpty(orgParentId)) {
|
||||||
queryWrapper.and(qw -> {
|
queryWrapper.and(qw -> {
|
||||||
|
|
Loading…
Reference in New Issue