From 7501695a20a2345c2d3e68418a520e5814c1a955 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 21 Jan 2022 09:26:38 +0800 Subject: [PATCH] bug --- .../java/com/epmet/dao/IcServiceItemDictDao.java | 2 ++ .../service/impl/IcServiceItemDictServiceImpl.java | 7 +++---- .../main/resources/mapper/IcServiceItemDictDao.xml | 13 +++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceItemDictDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceItemDictDao.java index 5837b45aea..1e1fd873c9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceItemDictDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceItemDictDao.java @@ -34,4 +34,6 @@ import java.util.List; public interface IcServiceItemDictDao extends BaseDao { List pageList(String customerId); + + IcServiceItemDictEntity selectMax(String customerId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java index 1868076ade..2d5e5a530d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceItemDictServiceImpl.java @@ -74,6 +74,7 @@ public class IcServiceItemDictServiceImpl extends BaseServiceImpl nameQuery = new LambdaQueryWrapper<>(); nameQuery.eq(IcServiceItemDictEntity::getCustomerId, formDTO.getCustomerId()) @@ -90,10 +91,8 @@ public class IcServiceItemDictServiceImpl extends BaseServiceImpl maxQuery = new LambdaQueryWrapper<>(); - maxQuery.eq(IcServiceItemDictEntity::getCustomerId, formDTO.getCustomerId()) - .orderByDesc(IcServiceItemDictEntity::getCategoryCode).last("limit 1"); - IcServiceItemDictEntity max = baseDao.selectOne(maxQuery); + //如果说当前查询的编码是1022,但是库里面1023已经存在且del_flag='0'。这个时候新增的编码为1023就会报错。 + IcServiceItemDictEntity max = baseDao.selectMax(formDTO.getCustomerId()); // 获取编码 IcServiceItemDictEntity insert = new IcServiceItemDictEntity(); insert.setCustomerId(formDTO.getCustomerId()); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceItemDictDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceItemDictDao.xml index f89b3c6a83..787ccb9d66 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceItemDictDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceItemDictDao.xml @@ -18,4 +18,17 @@ d.SORT DESC + \ No newline at end of file