ソースを参照

修改合作方证件号码时,判断(证件号码,证件类型)是否重复

Danj0rr 11 ヶ月 前
コミット
1fd20fadc3

+ 5 - 0
src/main/java/com/kexun/controller/CooperatorController.java

@@ -129,6 +129,11 @@ 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)
+            return Result.error("证件号码重复!");
+
+
         cooperatorInfo.setCooperatorName(req.getString("cooperator_name"));
         cooperatorInfo.setCorpCertificateNum(req.getString("corp_certificate_num"));
         cooperatorInfo.setCorpCertificateType(req.getString("corp_certificate_type"));

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

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

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

@@ -26,6 +26,14 @@ public class CooperatorServiceImpl extends ServiceImpl<CooperatorMapper, Coopera
     @Resource
     CooperatorMapper cooperatorMapper;
 
+    @Override
+    public 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);
+    }
+
     @Override
     public List<CooperatorField> findCooperatorFieldByNum(String templateId) {
 //        System.out.println("aaa");