【8.0.2】【hr】更新一个批量获取组织机构名称

pull/57/head
fengshuonan 2023-11-02 10:23:07 +08:00
parent 9a893f8a73
commit 21a7772145
3 changed files with 51 additions and 0 deletions

View File

@ -1,6 +1,8 @@
package cn.stylefeng.roses.kernel.sys.modular.org.controller; package cn.stylefeng.roses.kernel.sys.modular.org.controller;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData; import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData; import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource; import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
@ -11,10 +13,12 @@ import cn.stylefeng.roses.kernel.sys.modular.org.pojo.request.CommonOrgTreeReque
import cn.stylefeng.roses.kernel.sys.modular.org.pojo.request.HrOrganizationRequest; import cn.stylefeng.roses.kernel.sys.modular.org.pojo.request.HrOrganizationRequest;
import cn.stylefeng.roses.kernel.sys.modular.org.pojo.response.CommonOrgTreeResponse; import cn.stylefeng.roses.kernel.sys.modular.org.pojo.response.CommonOrgTreeResponse;
import cn.stylefeng.roses.kernel.sys.modular.org.service.HrOrganizationService; import cn.stylefeng.roses.kernel.sys.modular.org.service.HrOrganizationService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
/** /**
* *
@ -55,4 +59,16 @@ public class CommonOrgController {
return new SuccessResponseData<>(hrOrganizationService.commonOrgPage(hrOrganizationRequest)); return new SuccessResponseData<>(hrOrganizationService.commonOrgPage(hrOrganizationRequest));
} }
/**
* id
*
* @author fengshuonan
* @since 2023/11/2 10:16
*/
@PostResource(name = "获取机构名称集合通过机构id的列表", path = "/common/org/getOrgListName")
public ResponseData<List<SimpleDict>> getOrgListName(
@RequestBody @Validated(BaseRequest.batchDelete.class) HrOrganizationRequest hrOrganizationRequest) {
return new SuccessResponseData<>(hrOrganizationService.getOrgListName(hrOrganizationRequest));
}
} }

View File

@ -1,6 +1,7 @@
package cn.stylefeng.roses.kernel.sys.modular.org.service; package cn.stylefeng.roses.kernel.sys.modular.org.service;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
import cn.stylefeng.roses.kernel.sys.api.OrganizationServiceApi; import cn.stylefeng.roses.kernel.sys.api.OrganizationServiceApi;
import cn.stylefeng.roses.kernel.sys.api.pojo.org.CompanyDeptDTO; import cn.stylefeng.roses.kernel.sys.api.pojo.org.CompanyDeptDTO;
import cn.stylefeng.roses.kernel.sys.api.remote.OrgInfoRemoteApi; import cn.stylefeng.roses.kernel.sys.api.remote.OrgInfoRemoteApi;
@ -144,4 +145,12 @@ public interface HrOrganizationService extends IService<HrOrganization>, Organiz
*/ */
Boolean getOrgHaveSubFlag(Long orgId); Boolean getOrgHaveSubFlag(Long orgId);
/**
*
*
* @author fengshuonan
* @since 2023/11/2 10:19
*/
List<SimpleDict> getOrgListName(HrOrganizationRequest hrOrganizationRequest);
} }

View File

@ -17,6 +17,7 @@ import cn.stylefeng.roses.kernel.event.sdk.publish.BusinessEventPublisher;
import cn.stylefeng.roses.kernel.log.api.util.BusinessLogUtil; import cn.stylefeng.roses.kernel.log.api.util.BusinessLogUtil;
import cn.stylefeng.roses.kernel.rule.constants.TreeConstants; import cn.stylefeng.roses.kernel.rule.constants.TreeConstants;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException; import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict;
import cn.stylefeng.roses.kernel.rule.tree.factory.DefaultTreeBuildFactory; import cn.stylefeng.roses.kernel.rule.tree.factory.DefaultTreeBuildFactory;
import cn.stylefeng.roses.kernel.sys.api.callback.RemoveOrgCallbackApi; import cn.stylefeng.roses.kernel.sys.api.callback.RemoveOrgCallbackApi;
import cn.stylefeng.roses.kernel.sys.api.constants.SysConstants; import cn.stylefeng.roses.kernel.sys.api.constants.SysConstants;
@ -473,6 +474,31 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
} }
} }
@Override
public List<SimpleDict> getOrgListName(HrOrganizationRequest hrOrganizationRequest) {
List<SimpleDict> dictList = new ArrayList<>();
if (ObjectUtil.isEmpty(hrOrganizationRequest) || ObjectUtil.isEmpty(hrOrganizationRequest.getOrgIdList())) {
return dictList;
}
LambdaQueryWrapper<HrOrganization> wrapper = new LambdaQueryWrapper<>();
wrapper.in(HrOrganization::getOrgId, hrOrganizationRequest.getOrgIdList());
wrapper.select(HrOrganization::getOrgName, HrOrganization::getOrgId, HrOrganization::getOrgCode);
List<HrOrganization> list = this.list(wrapper);
if (ObjectUtil.isEmpty(list)) {
return dictList;
}
for (HrOrganization hrOrganization : list) {
dictList.add(new SimpleDict(hrOrganization.getOrgId(), hrOrganization.getOrgName(), hrOrganization.getOrgCode()));
}
return dictList;
}
@Override @Override
public String getOrgNameById(Long orgId) { public String getOrgNameById(Long orgId) {