leon 4 years ago
parent
commit
51a8dba7f9

+ 8 - 8
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxMobileController.java

@@ -158,22 +158,22 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
         //.验证企微主体ID&客服昵称是否重复
         if ((addHandle.getRaw().getWorkWxCorpId() != null || !addHandle.getRaw().getWorkWxCorpId().equals(0))
                 && (addHandle.getRaw().getCustserviceName() != null || !addHandle.getRaw().getCustserviceName().isEmpty())){
-            FosterwxMobile hasCorpIdAndCustServiceNm = fosterwxMobileService.getOne(
+            Integer hasCorpIdAndCustServiceNm = fosterwxMobileService.count(
                     new QueryWrapper<FosterwxMobile>()
                             .eq("work_wx_corp_id",addHandle.getRaw().getWorkWxCorpId())
                             .eq("custservice_name",addHandle.getRaw().getCustserviceName())
             );
-            if (hasCorpIdAndCustServiceNm != null){
+            if (hasCorpIdAndCustServiceNm > 0){
                 return AjaxResult.error("企微主体ID和客服昵称组合同时存在");
             }
         }
         //.验证teamID是否为空
         if (addHandle.getRaw().getTeamId() != null || !addHandle.getRaw().getTeamId().isEmpty()){
-            FosterwxMobile hasTeamId = fosterwxMobileService.getOne(
+            Integer hasTeamId = fosterwxMobileService.count(
                     new QueryWrapper<FosterwxMobile>()
                             .eq("team_id",addHandle.getRaw().getTeamId())
             );
-            if (hasTeamId != null){
+            if (hasTeamId > 0){
                 return AjaxResult.error("团队ID已经存在");
             }
         }
@@ -217,24 +217,24 @@ public class FosterwxMobileController extends BaseController<FosterwxMobile> {
             //.验证企微主体ID&客服昵称是否重复
             if (!editHandle.getRaw().getWorkWxCorpId().equals(0) &&
                     (editHandle.getRaw().getCustserviceName() != null || !editHandle.getRaw().getCustserviceName().isEmpty())){
-                FosterwxMobile hasCorpIdAndCustServiceNm = fosterwxMobileService.getOne(
+                Integer hasCorpIdAndCustServiceNm = fosterwxMobileService.count(
                         new QueryWrapper<FosterwxMobile>()
                                 .ne("id",id)
                                 .eq("work_wx_corp_id",editHandle.getRaw().getWorkWxCorpId())
                                 .eq("custservice_name",editHandle.getRaw().getCustserviceName())
                 );
-                if (hasCorpIdAndCustServiceNm != null){
+                if (hasCorpIdAndCustServiceNm > 0){
                     return AjaxResult.error("企微主体ID和客服昵称组合同时存在");
                 }
             }
             //.验证teamID是否为空
             if (editHandle.getRaw().getTeamId() != null || !editHandle.getRaw().getTeamId().isEmpty()){
-                FosterwxMobile hasTeamId = fosterwxMobileService.getOne(
+                Integer hasTeamId = fosterwxMobileService.count(
                         new QueryWrapper<FosterwxMobile>()
                                 .ne("id",id)
                                 .eq("team_id",editHandle.getRaw().getTeamId())
                 );
-                if (hasTeamId != null){
+                if (hasTeamId > 0){
                     return AjaxResult.error("团队ID已经存在");
                 }
             }