From 020a201381f9d80671d72732edc21abdfc520b4d Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Tue, 17 Aug 2021 11:23:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datareal/impl/DataRealServiceImpl.java | 75 ++++++++++--------- .../mapper/datareal/datareal-mapper.xml | 6 -- .../resources/templates/datareal/list.html | 2 +- 3 files changed, 41 insertions(+), 42 deletions(-) diff --git a/src/main/java/com/cm/tenlion/pollutantdata/service/datareal/impl/DataRealServiceImpl.java b/src/main/java/com/cm/tenlion/pollutantdata/service/datareal/impl/DataRealServiceImpl.java index ac01b7c..cbd2535 100644 --- a/src/main/java/com/cm/tenlion/pollutantdata/service/datareal/impl/DataRealServiceImpl.java +++ b/src/main/java/com/cm/tenlion/pollutantdata/service/datareal/impl/DataRealServiceImpl.java @@ -158,41 +158,7 @@ public class DataRealServiceImpl extends AbstractService implements IDataRealSer @Override public List list(Map params) { List dataRealDTOs = dataMinuteDao.list(params); - - Set enterpriseIdSet = new HashSet<>(); - Set instrumentIdSet = new HashSet<>(); - - for (DataRealDTO dataRealDTO : dataRealDTOs) { - enterpriseIdSet.add(dataRealDTO.getEnterpriseId()); - instrumentIdSet.add(dataRealDTO.getInstrumentId()); - } - - List enterprisePOs = enterpriseService.listPO(new ArrayList<>(enterpriseIdSet)); - List instrumentPOs = instrumentService.listPO(new ArrayList<>(instrumentIdSet)); - List pollPOs = pollService.listPO(new HashMap<>()); - - for (DataRealDTO dataRealDTO : dataRealDTOs) { - for (EnterprisePO enterprisePO : enterprisePOs) { - if (StringUtils.equals(dataRealDTO.getEnterpriseId(), enterprisePO.getEnterpriseId())) { - dataRealDTO.setEnterpriseName(enterprisePO.getEnterpriseName()); - break; - } - } - for (InstrumentPO instrumentPO : instrumentPOs) { - if (StringUtils.equals(dataRealDTO.getInstrumentId(), instrumentPO.getInstrumentId())) { - dataRealDTO.setInstrumentName(instrumentPO.getInstrumentName()); - break; - } - } - for (PollPO pollPO : pollPOs) { - if (StringUtils.equals(dataRealDTO.getPollId(), pollPO.getPollNo()) || - StringUtils.equals(dataRealDTO.getPollId(), pollPO.getPollNoOld())) { - dataRealDTO.setPollName(pollPO.getPollName()); - break; - } - } - } - + setDataRealInfo(dataRealDTOs); return dataRealDTOs; } @@ -300,4 +266,43 @@ public class DataRealServiceImpl extends AbstractService implements IDataRealSer return listLastData; } + private void setDataRealInfo(List dataRealDTOs) { + if (dataRealDTOs.isEmpty()) { + return; + } + Set enterpriseIdSet = new HashSet<>(); + Set instrumentIdSet = new HashSet<>(); + + for (DataRealDTO dataRealDTO : dataRealDTOs) { + enterpriseIdSet.add(dataRealDTO.getEnterpriseId()); + instrumentIdSet.add(dataRealDTO.getInstrumentId()); + } + + List enterprisePOs = enterpriseService.listPO(new ArrayList<>(enterpriseIdSet)); + List instrumentPOs = instrumentService.listPO(new ArrayList<>(instrumentIdSet)); + List pollPOs = pollService.listPO(new HashMap<>()); + + for (DataRealDTO dataRealDTO : dataRealDTOs) { + for (EnterprisePO enterprisePO : enterprisePOs) { + if (StringUtils.equals(dataRealDTO.getEnterpriseId(), enterprisePO.getEnterpriseId())) { + dataRealDTO.setEnterpriseName(enterprisePO.getEnterpriseName()); + break; + } + } + for (InstrumentPO instrumentPO : instrumentPOs) { + if (StringUtils.equals(dataRealDTO.getInstrumentId(), instrumentPO.getInstrumentId())) { + dataRealDTO.setInstrumentName(instrumentPO.getInstrumentName()); + break; + } + } + for (PollPO pollPO : pollPOs) { + if (StringUtils.equals(dataRealDTO.getPollId(), pollPO.getPollNo()) || + StringUtils.equals(dataRealDTO.getPollId(), pollPO.getPollNoOld())) { + dataRealDTO.setPollName(pollPO.getPollName()); + break; + } + } + } + } + } \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/datareal/datareal-mapper.xml b/src/main/resources/mybatis/mapper/datareal/datareal-mapper.xml index 4b7163e..f7ed8e6 100644 --- a/src/main/resources/mybatis/mapper/datareal/datareal-mapper.xml +++ b/src/main/resources/mybatis/mapper/datareal/datareal-mapper.xml @@ -263,12 +263,6 @@ AND ( t1.poll_id LIKE CONCAT('%', #{keywords}, '%') - OR - jt1.enterprise_name LIKE CONCAT('%', #{keywords}, '%') - OR - jt2.instrument_name LIKE CONCAT('%', #{keywords}, '%') - OR - jt3.poll_name LIKE CONCAT('%', #{keywords}, '%') ) diff --git a/src/main/resources/templates/datareal/list.html b/src/main/resources/templates/datareal/list.html index 5035d60..f0c460d 100644 --- a/src/main/resources/templates/datareal/list.html +++ b/src/main/resources/templates/datareal/list.html @@ -18,7 +18,7 @@
- +