oppadmin преди 4 години
родител
ревизия
cd4b01f47a

+ 2 - 8
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayControlRuleServiceImpl.java

@@ -88,7 +88,7 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
     @Override
     public Integer edit(PayControlRule payControlRule){
         LoginUser loginUser = UserUtil.getCurrentUser();
-        if(ExitsData(null,payControlRule.getName(),new BigInteger(String.valueOf(loginUser.getCustomerId()))))
+        if(ExitsData(payControlRule.getId().toString(),payControlRule.getName(),new BigInteger(String.valueOf(loginUser.getCustomerId()))))
             throw new ServiceException(-99,"该阀控规则已存在!");
 
         if(IsUsed(payControlRule.getId().intValue(),new BigInteger(loginUser.getCustomerId().toString()))){
@@ -166,14 +166,8 @@ public class PayControlRuleServiceImpl implements PayControlRuleService {
      * @return true数据存在 false数据不存在
      */
     public boolean ExitsData(String id,String name,BigInteger customerId){
-        if(id != null){
-            List<PayControlRule> payControlRules = payControlRuleMapper.ExitsData(id,null,customerId );
-            if(payControlRules != null && payControlRules.size() >0)
-                return true;
-        }
-
         if(name != null){
-            List<PayControlRule> payControlRules = payControlRuleMapper.ExitsData(null,name,customerId);
+            List<PayControlRule> payControlRules = payControlRuleMapper.ExitsData(id,name,customerId);
             if(payControlRules != null && payControlRules.size() > 0)
                 return true;
         }

+ 2 - 2
smart-city-platform/src/main/resources/mapper/pay/PayControlRuleMapper.xml

@@ -91,8 +91,8 @@
         from pay_control_rule
         <where>
             del_flag = 0 and customer_id = #{customerId}
-            <if test="id != null"> and id = #{id}</if>
-            <if test="name != null and name != ''"> and name = #{name}</if>
+            and name = #{name}
+            <if test="id != null"> and id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
         </where>
 
     </select>