处理部分公司不存在行业问题

This commit is contained in:
zk
2026-07-13 12:03:58 +08:00
parent 30b9a62d2a
commit 9e7897332b
@@ -111,7 +111,7 @@ public class IndustryService {
private Set<Long> getActiveIndustryIds(List<Industry> allIndustries) {
// 1. 查询有公司关联的末级行业ID
List<Company> companies = companyMapper.selectList(new LambdaQueryWrapper<Company>().select(Company::getIndustryId).eq(Company::getStatus, 1).groupBy(Company::getIndustryId));
Set<Long> leafActiveIds = companies.stream().map(Company::getIndustryId).filter(Objects::nonNull).collect(Collectors.toSet());
Set<Long> leafActiveIds = companies.stream().filter(Objects::nonNull).map(Company::getIndustryId).filter(Objects::nonNull).collect(Collectors.toSet());
// 2. 查全量行业,构建id->parentId映射
if (allIndustries == null) {