From faf12be8dd5e9b74365d200944808e9140167398 Mon Sep 17 00:00:00 2001 From: "java_cuibaocheng@163.com" Date: Tue, 14 Nov 2023 10:15:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=8F=A3=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF-=E7=9F=9B=E7=9B=BE=E7=BA=A0=E7=BA=B7(=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E4=BF=AE=E6=94=B9=E5=9C=A8list=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E4=B8=AD=E8=BF=9B=E8=A1=8CSelect=E7=9A=84SQL=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dispute/impl/DisputeServiceImpl.java | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/cm/population/service/dispute/impl/DisputeServiceImpl.java b/src/main/java/com/cm/population/service/dispute/impl/DisputeServiceImpl.java index 18aa689..d510402 100644 --- a/src/main/java/com/cm/population/service/dispute/impl/DisputeServiceImpl.java +++ b/src/main/java/com/cm/population/service/dispute/impl/DisputeServiceImpl.java @@ -147,25 +147,54 @@ public class DisputeServiceImpl extends AbstractService implements IDisputeServi @Override public List list(Map params) { List list = disputeDao.list(params); + // 修改于2023年11月14日09:50:18 + // 以后不能在循环中进行SQL查询 + List castType = dataDictionaryService.listDictionaryByParentId("698e0684-b245-403b-9df9-c10eee1b465b"); // 事件类型 + List caseScale = dataDictionaryService.listDictionaryByParentId("075f2815-4e7d-478c-837d-a826810e7383"); // 事件规模 + List caseEstimate = dataDictionaryService.listDictionaryByParentId("e1b8a4cf-90be-4597-a45d-cd520f6b37ee"); // 案件评估 for(DisputeDTO dto : list) { - buiderData(dto); + buiderData(castType, caseScale, caseEstimate, dto); } return list; } - private void buiderData(DisputeDTO dto) { + private void buiderData(List castType, List caseScale, List caseEstimate, DisputeDTO dto) { if (!StringUtils.isEmpty(dto.getCaseType())) { - DataDictionaryDTO data = dataDictionaryService.getDictionaryById(dto.getCaseType()); - if(data != null) dto.setCaseTypeName(data.getDictionaryName()); + for(DataDictionaryDTO data : castType) { + if (data.getDictionaryId().equals(dto.getCaseType())) { + dto.setCaseTypeName(data.getDictionaryName()); + break; + } + } } if (!StringUtils.isEmpty(dto.getCaseScale())) { - DataDictionaryDTO data = dataDictionaryService.getDictionaryById(dto.getCaseScale()); - if(data != null) dto.setCaseScaleName(data.getDictionaryName()); + for(DataDictionaryDTO data : caseScale) { + if (data.getDictionaryId().equals(dto.getCaseScale())) { + dto.setCaseScaleName(data.getDictionaryName()); + break; + } + } } if (!StringUtils.isEmpty(dto.getCaseEstimate())) { - DataDictionaryDTO data = dataDictionaryService.getDictionaryById(dto.getCaseEstimate()); - if(data != null) dto.setCaseEstimateName(data.getDictionaryName()); + for(DataDictionaryDTO data : caseEstimate) { + if (data.getDictionaryId().equals(dto.getCaseEstimate())) { + dto.setCaseEstimateName(data.getDictionaryName()); + break; + } + } } +// if (!StringUtils.isEmpty(dto.getCaseType())) { +// DataDictionaryDTO data = dataDictionaryService.getDictionaryById(dto.getCaseType()); +// if(data != null) dto.setCaseTypeName(data.getDictionaryName()); +// } +// if (!StringUtils.isEmpty(dto.getCaseScale())) { +// DataDictionaryDTO data = dataDictionaryService.getDictionaryById(dto.getCaseScale()); +// if(data != null) dto.setCaseScaleName(data.getDictionaryName()); +// } +// if (!StringUtils.isEmpty(dto.getCaseEstimate())) { +// DataDictionaryDTO data = dataDictionaryService.getDictionaryById(dto.getCaseEstimate()); +// if(data != null) dto.setCaseEstimateName(data.getDictionaryName()); +// } } @Override