lihong 2 yıl önce
ebeveyn
işleme
f0c233054a

+ 4 - 4
src/main/java/cn/hnthyy/thmz/Utils/AssertUtil.java

@@ -21,20 +21,20 @@ public class AssertUtil {
      **/
     public static void isNotBlank(Object object,String message){
         if (object == null) {
-            throw new BizException(message,-1);
+            throw new BizException(message,R.ERR_CODE);
         }
        else if (object instanceof Collection) {
             if(CollUtil.isEmpty((Collection)object)){
-                throw new BizException(message,-1);
+                throw new BizException(message,R.ERR_CODE);
             }
         }
         else if (object instanceof Map) {
             if(CollUtil.isEmpty((Map)object)){
-                throw new BizException(message,-1);
+                throw new BizException(message,R.ERR_CODE);
             }
         }else {
             if (StrUtil.isBlank(object.toString())) {
-                throw new BizException(message,-1);
+                throw new BizException(message,R.ERR_CODE);
             }
         }
     }

+ 2 - 2
src/main/java/cn/hnthyy/thmz/Utils/R.java

@@ -7,8 +7,8 @@ import java.util.Map;
 
 public class R extends HashMap<String, Object> {
 	private static final long serialVersionUID = 1L;
-	private static int SUCCESS_CODE = 0;
-	private static int ERR_CODE = -1;
+	public static final int SUCCESS_CODE = 0;
+	public static final int ERR_CODE = -1;
 
 	public R() {
 		put("code", SUCCESS_CODE);

+ 2 - 1
src/main/java/cn/hnthyy/thmz/common/validate/ValidatorUtils.java

@@ -1,5 +1,6 @@
 package cn.hnthyy.thmz.common.validate;
 
+import cn.hnthyy.thmz.Utils.R;
 import cn.hnthyy.thmz.common.exception.BizException;
 
 import javax.validation.ConstraintViolation;
@@ -35,7 +36,7 @@ public class ValidatorUtils {
                 msg.append(index+"、").append(constraint.getMessage()).append("<br>");
                 index++;
             }
-            throw new BizException(msg.toString(),-1);
+            throw new BizException(msg.toString(), R.ERR_CODE);
         }
     }
 }