From a49566e0150080d754967ba54d42a678e8109942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=98=8E=E6=A2=81?= <2429105222@qq.com> Date: Thu, 23 Mar 2023 10:32:17 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BA=A7=E5=93=81?= =?UTF-8?q?=E9=80=89=E5=85=A5bug=E4=BF=AE=E6=94=B9=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thrsys/ThrProductsAddDiController.java | 1 + .../glxp/api/dao/thrsys/ThrProductsAddDiDao.java | 2 ++ .../service/thrsys/ThrProductsAddDiService.java | 2 ++ .../thrsys/impl/ThrProductsAddDiServiceImpl.java | 5 +++++ .../thrsys/impl/ThrProductsServiceImpl.java | 8 +++++++- .../mybatis/mapper/thrsys/ThrProductsAddDiDao.xml | 14 ++++++++++++++ 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java index 906032a0..98427c13 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrProductsAddDiController.java @@ -302,6 +302,7 @@ public class ThrProductsAddDiController { if (null == thrProductsAdddiEntity) return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); + if (thrProductsService.isExit(thrProductsAdddiEntity.getCode(), thrProductsAdddiEntity.getThirdSysFk())) { return ResultVOUtils.error(500, "已存在相同产品编码,无法添加!"); } diff --git a/src/main/java/com/glxp/api/dao/thrsys/ThrProductsAddDiDao.java b/src/main/java/com/glxp/api/dao/thrsys/ThrProductsAddDiDao.java index a6fccd0e..6f3acc10 100644 --- a/src/main/java/com/glxp/api/dao/thrsys/ThrProductsAddDiDao.java +++ b/src/main/java/com/glxp/api/dao/thrsys/ThrProductsAddDiDao.java @@ -41,4 +41,6 @@ public interface ThrProductsAddDiDao { boolean insert(ThrProductsAddDiEntity thrProductsAddDiEntity); + + List filterThrProductsDiList(FilterThrProductsRequest filterThrProductsRequest); } diff --git a/src/main/java/com/glxp/api/service/thrsys/ThrProductsAddDiService.java b/src/main/java/com/glxp/api/service/thrsys/ThrProductsAddDiService.java index a3f0c248..95bfaf7d 100644 --- a/src/main/java/com/glxp/api/service/thrsys/ThrProductsAddDiService.java +++ b/src/main/java/com/glxp/api/service/thrsys/ThrProductsAddDiService.java @@ -34,4 +34,6 @@ public interface ThrProductsAddDiService { ThrProductsAddDiEntity filterThrProductsGetId( Integer id); boolean insertThrProducts(ThrProductsAddDiEntity thrProductsAddDiEntity); + + List filterThrProductsDiList(FilterThrProductsRequest filterThrProductsRequest); } diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsAddDiServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsAddDiServiceImpl.java index b967c061..b0c4cd23 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsAddDiServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsAddDiServiceImpl.java @@ -130,4 +130,9 @@ public class ThrProductsAddDiServiceImpl implements ThrProductsAddDiService { public boolean insertThrProducts(ThrProductsAddDiEntity thrProductsAddDiEntity) { return thrProductsAddDiDao.insert(thrProductsAddDiEntity); } + + @Override + public List filterThrProductsDiList(FilterThrProductsRequest filterThrProductsRequest) { + return thrProductsAddDiDao.filterThrProductsDiList(filterThrProductsRequest); + } } diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java index 486192ec..17e94271 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java @@ -7,7 +7,9 @@ import com.github.pagehelper.PageHelper; import com.glxp.api.entity.thrsys.ThrProductsEntity; import com.glxp.api.dao.thrsys.ThrProductsDao; import com.glxp.api.req.thrsys.FilterThrProductsRequest; +import com.glxp.api.res.thrsys.ThrProductsAddDiResponse; import com.glxp.api.res.thrsys.ThrProductsResponse; +import com.glxp.api.service.thrsys.ThrProductsAddDiService; import com.glxp.api.service.thrsys.ThrProductsService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.springframework.stereotype.Service; @@ -29,6 +31,8 @@ public class ThrProductsServiceImpl implements ThrProductsService { @Resource ThrProductsDao thrProductsDao; + @Resource + ThrProductsAddDiService thrProductsAddDiService; @Override public ThrProductsEntity selectByCode(String code) { @@ -98,11 +102,13 @@ public class ThrProductsServiceImpl implements ThrProductsService { @Override public Boolean isExit(String code, String thirdIdFk) { + //判断di表有没有该产品数据 FilterThrProductsRequest filterThrProductsRequest = new FilterThrProductsRequest(); filterThrProductsRequest.setThirdSysFk(thirdIdFk); filterThrProductsRequest.setCode(code); + List filterThrProductsDiList=thrProductsAddDiService.filterThrProductsDiList(filterThrProductsRequest); List data = thrProductsDao.selectThrProducts(filterThrProductsRequest); - if (CollUtil.isNotEmpty(data)) { + if (CollUtil.isNotEmpty(data) || CollUtil.isNotEmpty(filterThrProductsDiList)) { return true; } return false; diff --git a/src/main/resources/mybatis/mapper/thrsys/ThrProductsAddDiDao.xml b/src/main/resources/mybatis/mapper/thrsys/ThrProductsAddDiDao.xml index 7e9aedb5..93cd0189 100644 --- a/src/main/resources/mybatis/mapper/thrsys/ThrProductsAddDiDao.xml +++ b/src/main/resources/mybatis/mapper/thrsys/ThrProductsAddDiDao.xml @@ -183,5 +183,19 @@ ) + +