From 2e7a107e933c6a472755f84e1a4798eff5f3ef66 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Fri, 11 Mar 2022 14:09:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2=E8=B4=A8?= =?UTF-8?q?=E6=A3=80=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/xkrs/newpro/dao/QcSourceDao.java | 2 +- .../com/xkrs/newpro/service/impl/QcSourceServiceImpl.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java b/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java index cb1d55b..65e6a1f 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java @@ -12,7 +12,7 @@ import java.util.Map; @Component public interface QcSourceDao extends JpaRepository, JpaSpecificationExecutor { - @Query(value = "SELECT id, batch_no AS batchNo, machine_no AS machineNo, material_no AS materialNo, mould_no AS mouldNo, variety_no AS varietyNo, qc_item_no AS qcItemNo, qc_value AS qcValue FROM qc_source WHERE batch_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND mould_no = ?4 AND variety_no = ?5 ORDER BY create_time DESC", nativeQuery = true) + @Query(value = "SELECT id, batch_no AS batchNo, machine_no AS machineNo, material_no AS materialNo, mould_no AS mouldNo, variety_no AS varietyNo, qc_item_no AS qcItemNo, qc_value AS qcValue FROM qc_source WHERE batch_no LIKE %?1% AND machine_no LIKE %?2% AND material_no LIKE %?3% AND mould_no LIKE %?4% AND variety_no LIKE %?5% ORDER BY create_time DESC", nativeQuery = true) List> queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo); } \ No newline at end of file diff --git a/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java b/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java index 02fc604..548b4a2 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java @@ -11,7 +11,9 @@ import com.xkrs.newpro.utils.LocalStringUtils; import org.springframework.context.i18n.LocaleContextHolder; import javax.annotation.Resource; +import java.util.List; import java.util.Locale; +import java.util.Map; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -61,8 +63,10 @@ public class QcSourceServiceImpl implements QcSourceService { String materialNo = queryQo.getMaterialNo(); String mouldNo = queryQo.getMouldNo(); String varietyNo = queryQo.getVarietyNo(); - qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo)); - + List> resultList = qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo)); + if (resultList == null || resultList.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验项目的信息!", locale); + } return null; }