Browse Source

修复出现多条(证件号码,证件类型)重复数据查询报错情况

Danj0rr 11 tháng trước cách đây
mục cha
commit
79e6608247

+ 2 - 2
src/main/java/com/kexun/controller/CooperatorController.java

@@ -129,8 +129,8 @@ public class CooperatorController {
 
         CooperatorInfo cooperatorInfo = CooperatorService.findByID(cooperatorId);
 
-        CooperatorInfo dupNumCooperatorInfo=CooperatorService.findByCorpCertificateNumAndType(req.getString("corp_certificate_num"),req.getString("corp_certificate_type"));
-        if (dupNumCooperatorInfo!=null)
+        List<CooperatorInfo> dupNumCooperatorInfo=CooperatorService.findByCorpCertificateNumAndType(req.getString("corp_certificate_num"),req.getString("corp_certificate_type"));
+        if (!dupNumCooperatorInfo.isEmpty())
             return Result.error("证件号码重复!");
 
 

+ 1 - 1
src/main/java/com/kexun/service/CooperatorService.java

@@ -14,7 +14,7 @@ import java.util.List;
  */
 public interface CooperatorService extends IService<CooperatorInfo> {
     CooperatorInfo findByCooperatorNum(String partnerName);
-    CooperatorInfo findByCorpCertificateNumAndType(String corpCertificateNum, String corpCertificateType);
+    List<CooperatorInfo>findByCorpCertificateNumAndType(String corpCertificateNum, String corpCertificateType);
 //    List<CooperatorField> findCooperatorFieldByNum(String cooperatorNum);
     List<CooperatorField> findCooperatorFieldByNum(String templateId);
     List<CooperatorProduct> findCooperatorProductByNum(String cooperatorNum);

+ 2 - 2
src/main/java/com/kexun/service/impl/CooperatorServiceImpl.java

@@ -27,11 +27,11 @@ public class CooperatorServiceImpl extends ServiceImpl<CooperatorMapper, Coopera
     CooperatorMapper cooperatorMapper;
 
     @Override
-    public CooperatorInfo findByCorpCertificateNumAndType(String corpCertificateNum,String corpCertificateType) {
+    public List<CooperatorInfo> findByCorpCertificateNumAndType(String corpCertificateNum,String corpCertificateType) {
         QueryWrapper wrapper=new QueryWrapper();
         wrapper.eq("corp_certificate_num",corpCertificateNum);
         wrapper.eq("corp_certificate_type",corpCertificateType);
-        return getOne(wrapper);
+        return list(wrapper);
     }
 
     @Override