Commit f755efd8 authored by chenzhao's avatar chenzhao

优化人员模板下载

parent 80fe0f99
...@@ -1649,17 +1649,25 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -1649,17 +1649,25 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return null; return null;
} }
List<CompanyPerson> tempList = new ArrayList<CompanyPerson>(); List<CompanyPerson> tempList = new ArrayList<CompanyPerson>();
for (Long tempId : ids) { //4.24优化 原有方法不断循环查库 接口太慢 将数据一次捞出由java层组装
// BUG 2740 机场单位主键varchar 导致 通过主键搜索返回多条数据 2021 - 09 - 09by kongfm //获取指定单位
OrgUsr org = getById(tempId.toString()); LambdaQueryWrapper<OrgUsr> companyWrapper = new LambdaQueryWrapper<>();
if (ObjectUtils.isEmpty(org)) { companyWrapper.in(BaseEntity::getSequenceNbr,ids);
continue; List<OrgUsr> companys = this.orgUsrMapper.selectList(companyWrapper);
} //获取指定单位下所有人员
LambdaQueryWrapper<OrgUsr> personWrapper = new LambdaQueryWrapper<>();
personWrapper.in(OrgUsr::getParentId,ids);
personWrapper.eq(OrgUsr::getBizOrgType,OrgPersonEnum.人员.getKey());
personWrapper.eq(BaseEntity::getIsDelete,false);
List<OrgUsr> persons = this.orgUsrMapper.selectList(personWrapper);
//将各单位人员数据组装
companys.stream().forEach(e->{
List<OrgUsr> list = persons.stream().filter(p -> p.getParentId().equals(e.getSequenceNbr().toString())).collect(Collectors.toList());
CompanyPerson company = new CompanyPerson(); CompanyPerson company = new CompanyPerson();
BeanUtils.copyProperties(org, company); BeanUtils.copyProperties(e, company);
company.setPersons(this.queryForListByParentIdAndOrgType(org.getSequenceNbr(), OrgPersonEnum.人员.getKey())); company.setPersons(Bean.toModels(list, this.getModelClass()));
tempList.add(company); tempList.add(company);
} });
return tempList; return tempList;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment