From eaa61bc9ecd9158f192f9999845cb2f05e6970fb Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 21 八月 2025 02:09:02 +0800 Subject: [PATCH] 修改bug --- driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AgentServiceImpl.java | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AgentServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AgentServiceImpl.java index f82fba8..ff20422 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AgentServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AgentServiceImpl.java @@ -5,14 +5,18 @@ import com.supersavedriving.driver.modular.system.dao.AgentMapper; import com.supersavedriving.driver.modular.system.dao.TBranchOfficeAreaMapper; import com.supersavedriving.driver.modular.system.model.Agent; +import com.supersavedriving.driver.modular.system.model.BranchOffice; import com.supersavedriving.driver.modular.system.model.TBranchOfficeArea; import com.supersavedriving.driver.modular.system.service.IAgentService; +import com.supersavedriving.driver.modular.system.service.IBranchOfficeService; +import com.supersavedriving.driver.modular.system.service.ITBranchOfficeAreaService; import com.supersavedriving.driver.modular.system.warpper.OpenCityWarpper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * @author zhibing.pu @@ -24,6 +28,9 @@ @Autowired private TBranchOfficeAreaMapper branchOfficeAreaMapper; + @Autowired + private IBranchOfficeService branchOfficeService; + /** * 获取开通省市数据 * @return @@ -31,7 +38,14 @@ */ @Override public List<OpenCityWarpper> queryOpenCity() throws Exception { - List<TBranchOfficeArea> branchOfficeAreas = branchOfficeAreaMapper.selectList(new EntityWrapper<TBranchOfficeArea>()); + List<BranchOffice> branchOffices = branchOfficeService.selectList(new EntityWrapper<BranchOffice>().eq("status", 1)); + List<Integer> collect = new ArrayList<>(); + if(branchOffices.size() == 0){ + collect.add(-1); + }else{ + collect = branchOffices.stream().map(BranchOffice::getId).collect(Collectors.toList()); + } + List<TBranchOfficeArea> branchOfficeAreas = branchOfficeAreaMapper.selectList(new EntityWrapper<TBranchOfficeArea>().in("branchOfficeId", collect)); List<OpenCityWarpper> province = new ArrayList<>(); //遍历处理省级数据 -- Gitblit v1.7.1