From 37666b4471d0695ca1e8217f5ca5ec4935106445 Mon Sep 17 00:00:00 2001
From: chenhao <852066789@qq.com>
Date: Mon, 19 May 2025 11:03:54 +0800
Subject: [PATCH] =?UTF-8?q?feat(sip):=20=E5=A2=9E=E5=8A=A0=E7=BC=96?=
=?UTF-8?q?=E7=A0=81=E5=94=AF=E4=B8=80=E6=80=A7=E6=A0=A1=E9=AA=8C=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在 AgentInfo、CustomerInfo、PartnerInfo 和 ProductInfo 表中添加编码唯一性校验方法
- 在对应的 Mapper 中添加 selectCountByCode 方法用于查询重复编码数量- 在 ServiceImpl 中实现插入和更新时的编码唯一性检查逻辑
- 修改订单编辑页面,将代表处和客户名称的字段改为 orderAgentName 和 orderPartnerName
---
.../main/resources/templates/manage/order/edit.html | 6 +++---
.../java/com/ruoyi/sip/mapper/AgentInfoMapper.java | 1 +
.../java/com/ruoyi/sip/mapper/CustomerInfoMapper.java | 1 +
.../java/com/ruoyi/sip/mapper/PartnerInfoMapper.java | 2 ++
.../java/com/ruoyi/sip/mapper/ProductInfoMapper.java | 1 +
.../ruoyi/sip/service/impl/AgentInfoServiceImpl.java | 11 +++++++++++
.../sip/service/impl/CustomerInfoServiceImpl.java | 9 +++++++++
.../sip/service/impl/PartnerInfoServiceImpl.java | 10 ++++++++++
.../sip/service/impl/ProductInfoServiceImpl.java | 9 +++++++++
.../resources/mapper/manage/CustomerInfoMapper.xml | 4 ++++
.../main/resources/mapper/system/AgentInfoMapper.xml | 5 +++++
.../resources/mapper/system/PartnerInfoMapper.xml | 4 ++++
.../resources/mapper/system/ProductInfoMapper.xml | 6 ++++++
13 files changed, 66 insertions(+), 3 deletions(-)
diff --git a/ruoyi-admin/src/main/resources/templates/manage/order/edit.html b/ruoyi-admin/src/main/resources/templates/manage/order/edit.html
index 481ce03e..e92d947b 100644
--- a/ruoyi-admin/src/main/resources/templates/manage/order/edit.html
+++ b/ruoyi-admin/src/main/resources/templates/manage/order/edit.html
@@ -61,8 +61,8 @@
@@ -74,7 +74,7 @@
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/AgentInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/AgentInfoMapper.java
index ba143dfa..d2b58766 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/AgentInfoMapper.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/AgentInfoMapper.java
@@ -58,4 +58,5 @@ public interface AgentInfoMapper
* @return 结果
*/
public int deleteAgentInfoByIds(String[] ids);
+ public int selectCountByCode(AgentInfo agentInfo);
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java
index 6cdd058d..63764fc8 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/CustomerInfoMapper.java
@@ -60,4 +60,5 @@ public interface CustomerInfoMapper
* @return 结果
*/
public int deleteCustomerInfoByIds(String[] ids);
+ public int selectCountByCode(CustomerInfo customerInfo);
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/PartnerInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/PartnerInfoMapper.java
index aba65fb4..0d4a7db0 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/PartnerInfoMapper.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/PartnerInfoMapper.java
@@ -58,4 +58,6 @@ public interface PartnerInfoMapper
* @return 结果
*/
public int deletePartnerInfoByIds(String[] ids);
+ public int selectCountByCode(PartnerInfo partnerInfo);
+
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProductInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProductInfoMapper.java
index 6be1c80c..5c3586ab 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProductInfoMapper.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProductInfoMapper.java
@@ -61,6 +61,7 @@ public interface ProductInfoMapper
* @return 结果
*/
public int deleteProductInfoByIds(String[] ids);
+ public int selectCountByCode(ProductInfo productInfo);
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/AgentInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/AgentInfoServiceImpl.java
index d35a70e0..2ffb317b 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/AgentInfoServiceImpl.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/AgentInfoServiceImpl.java
@@ -1,6 +1,8 @@
package com.ruoyi.sip.service.impl;
import java.util.List;
+
+import com.ruoyi.common.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.AgentInfoMapper;
@@ -53,6 +55,11 @@ public class AgentInfoServiceImpl implements IAgentInfoService
@Override
public int insertAgentInfo(AgentInfo agentInfo)
{
+ int i = agentInfoMapper.selectCountByCode(agentInfo);
+ if (i>0){
+ throw new ServiceException("该编码已存在");
+ }
+
return agentInfoMapper.insertAgentInfo(agentInfo);
}
@@ -65,6 +72,10 @@ public class AgentInfoServiceImpl implements IAgentInfoService
@Override
public int updateAgentInfo(AgentInfo agentInfo)
{
+ int i = agentInfoMapper.selectCountByCode(agentInfo);
+ if (i>0){
+ throw new ServiceException("该编码已存在");
+ }
return agentInfoMapper.updateAgentInfo(agentInfo);
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java
index 95e3f5ed..98bc23d1 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/CustomerInfoServiceImpl.java
@@ -2,6 +2,7 @@ package com.ruoyi.sip.service.impl;
import java.util.List;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.sip.domain.CustomerInfo;
import com.ruoyi.sip.mapper.CustomerInfoMapper;
import com.ruoyi.sip.service.ICustomerInfoService;
@@ -55,6 +56,10 @@ public class CustomerInfoServiceImpl implements ICustomerInfoService
@Override
public int insertCustomerInfo(CustomerInfo customerInfo)
{
+ int i = customerInfoMapper.selectCountByCode(customerInfo);
+ if (i > 0){
+ throw new ServiceException("客户编码已存在");
+ }
return customerInfoMapper.insertCustomerInfo(customerInfo);
}
@@ -67,6 +72,10 @@ public class CustomerInfoServiceImpl implements ICustomerInfoService
@Override
public int updateCustomerInfo(CustomerInfo customerInfo)
{
+ int i = customerInfoMapper.selectCountByCode(customerInfo);
+ if (i > 0){
+ throw new ServiceException("客户编码已存在");
+ }
return customerInfoMapper.updateCustomerInfo(customerInfo);
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java
index 91ca4b2f..cf0a8ad9 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/PartnerInfoServiceImpl.java
@@ -1,6 +1,8 @@
package com.ruoyi.sip.service.impl;
import java.util.List;
+
+import com.ruoyi.common.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sip.mapper.PartnerInfoMapper;
@@ -53,6 +55,10 @@ public class PartnerInfoServiceImpl implements IPartnerInfoService
@Override
public int insertPartnerInfo(PartnerInfo partnerInfo)
{
+ int i = partnerInfoMapper.selectCountByCode(partnerInfo);
+ if (i>0){
+ throw new ServiceException("该编码已存在");
+ }
return partnerInfoMapper.insertPartnerInfo(partnerInfo);
}
@@ -65,6 +71,10 @@ public class PartnerInfoServiceImpl implements IPartnerInfoService
@Override
public int updatePartnerInfo(PartnerInfo partnerInfo)
{
+ int i = partnerInfoMapper.selectCountByCode(partnerInfo);
+ if (i>0){
+ throw new ServiceException("该编码已存在");
+ }
return partnerInfoMapper.updatePartnerInfo(partnerInfo);
}
diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProductInfoServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProductInfoServiceImpl.java
index 5bfbda85..937dca29 100644
--- a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProductInfoServiceImpl.java
+++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/ProductInfoServiceImpl.java
@@ -2,6 +2,7 @@ package com.ruoyi.sip.service.impl;
import java.util.List;
+import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.sip.domain.MaintenanceRecordsDto;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +57,10 @@ public class ProductInfoServiceImpl implements IProductInfoService
@Override
public int insertProductInfo(ProductInfo productInfo)
{
+ int i = productInfoMapper.selectCountByCode(productInfo);
+ if (i>0){
+ throw new ServiceException("BOM编码已存在");
+ }
return productInfoMapper.insertProductInfo(productInfo);
}
@@ -68,6 +73,10 @@ public class ProductInfoServiceImpl implements IProductInfoService
@Override
public int updateProductInfo(ProductInfo productInfo)
{
+ int i = productInfoMapper.selectCountByCode(productInfo);
+ if (i>0){
+ throw new ServiceException("BOM编码已存在");
+ }
return productInfoMapper.updateProductInfo(productInfo);
}
diff --git a/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml
index 104bc7ca..826a711e 100644
--- a/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/manage/CustomerInfoMapper.xml
@@ -61,6 +61,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
+
insert into customer_info
diff --git a/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml
index ecc2ae53..64626cbc 100644
--- a/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/system/AgentInfoMapper.xml
@@ -42,6 +42,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
+
insert into agent_info
diff --git a/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml
index 1b5c2d3a..d35b3210 100644
--- a/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/system/PartnerInfoMapper.xml
@@ -37,6 +37,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
+
insert into partner_info
diff --git a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml
index 75ef0cd5..642d0894 100644
--- a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml
+++ b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml
@@ -68,6 +68,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+