【7.2.2】更新公司树的查询

pull/29/head
fengshuonan 2022-05-21 11:50:41 +08:00
parent 715d3392b7
commit 20d9a48700
3 changed files with 71 additions and 0 deletions

View File

@ -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.
*
* GunsAPACHE 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;
}
}

View File

@ -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));
}
/** /**
* *
* *

View File

@ -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 -> {