From 02fdb63a795b01d315ec03d789a3dc9459a04d2e Mon Sep 17 00:00:00 2001 From: kylin L <452061493@qq.com> Date: Sun, 2 Jun 2024 22:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8lambda=20=E8=BF=9B=E8=A1=8CList=20?= =?UTF-8?q?=E8=BD=ACmap=E6=8A=A5=E9=94=99.=20=E6=94=B9=E6=88=90for?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnterpriseMerchantAuthorizationServiceImpl.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseMerchantAuthorizationServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseMerchantAuthorizationServiceImpl.java index 1e8d528e..804d2dd1 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseMerchantAuthorizationServiceImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseMerchantAuthorizationServiceImpl.java @@ -1,5 +1,6 @@ package com.zdxt.code.service.impl; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.Function; @@ -63,8 +64,14 @@ public class EnterpriseMerchantAuthorizationServiceImpl implements IEnterpriseMe List enterpriseInformations = enterpriseInformationMapper.selectEnterpriseInformationList(enterpriseInformation); //list转Map - Map collect1 = - enterpriseInformations.stream().collect(Collectors.toMap(EnterpriseInformation::getEnterpriseNumber, Function.identity())); +// Map collect1 = +// enterpriseInformations.stream().collect(Collectors.toMap(EnterpriseInformation::getEnterpriseNumber, Function.identity())); + Map collect1 = new HashMap<>(); + for (EnterpriseInformation entity : enterpriseInformations) { + if (entity.getEnterpriseNumber() != null) { + collect1.put(entity.getEnterpriseNumber(), entity); + } + } //赋值企业名称 enterpriseMerchantAuthorizations.forEach(res ->{ EnterpriseInformation enterpriseInformation1 = collect1.get(res.getEnterpriseNumber());