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 @@ <label class="col-sm-4 control-label is-required">代表处:</label> <div class="col-sm-8"> <div class="input-group"> - <input name="orderDept" type="hidden" th:field="*{orderDept}" id="treeId"/> - <input class="form-control" type="text" name="orderDeptName" onclick="selectAgent()" id="treeName" th:field="*{orderDeptName}" required> + <input name="orderAgentCode" type="hidden" th:field="*{orderAgentCode}" id="treeId"/> + <input class="form-control" type="text" name="orderAgentName" onclick="selectAgent()" id="treeName" th:field="*{orderAgentName}" required> <span class="input-group-addon"><i class="fa fa-search"></i></span> </div> </div> @@ -74,7 +74,7 @@ <div class="col-sm-8"> <div class="input-group"> <input name="orderPartnerCode" type="hidden" th:field="*{orderPartnerCode}" id="treeId1"> - <input class="form-control" type="text" name="orderDeptName" onclick="selectPartner()" id="treeName1" th:field="*{partnerDeptName}" required> + <input class="form-control" type="text" name="orderPartnerName" onclick="selectPartner()" id="treeName1" th:field="*{orderPartnerName}" required> <span class="input-group-addon"><i class="fa fa-search"></i></span> </div> </div> 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" <include refid="selectCustomerInfoVo"/> where id = #{id} </select> + <select id="selectCountByCode" resultType="java.lang.Integer"> + select count(1) from customer_info where customer_code = #{customerCode} + <if test="id != null">and id != #{id}</if> + </select> <insert id="insertCustomerInfo" parameterType="CustomerInfo"> 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" <include refid="selectAgentInfoVo"/> where id = #{id} </select> + <select id="selectCountByCode" resultType="java.lang.Integer"> + select count(1) from agent_info + where agent_code=#{agentCode} + <if test="id != null">and id!=#{id}</if> + </select> <insert id="insertAgentInfo" parameterType="AgentInfo" useGeneratedKeys="true" keyProperty="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" <include refid="selectPartnerInfoVo"/> where id = #{id} </select> + <select id="selectCountByCode" resultType="java.lang.Integer"> + select count(1) from partner_info where partner_code = #{partnerCode} + <if test="id != null">and id != #{id}</if> + </select> <insert id="insertPartnerInfo" parameterType="PartnerInfo" useGeneratedKeys="true" keyProperty="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" </if> </where> </select> + <select id="selectCountByCode" resultType="java.lang.Integer"> + select count(1) from product_info where product_code=#{productCode} + <if test="id!=null "> + and id!=#{id} + </if> + </select> <insert id="insertProductInfo" parameterType="ProductInfo" useGeneratedKeys="true" keyProperty="id">