From c46f9c28f8d40d2a4efcc7ef6e528661d97a4be0 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 14 二月 2023 13:48:18 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/web/BaseController.java |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/zy/common/web/BaseController.java b/src/main/java/com/zy/common/web/BaseController.java
index ecc7e80..8f1fade 100644
--- a/src/main/java/com/zy/common/web/BaseController.java
+++ b/src/main/java/com/zy/common/web/BaseController.java
@@ -7,6 +7,8 @@
 import com.core.common.Cools;
 import com.core.controller.AbstractBaseController;
 import com.core.exception.CoolException;
+import com.zy.asrs.entity.Tag;
+import com.zy.asrs.service.TagService;
 import com.zy.system.entity.User;
 import com.zy.system.service.UserService;
 import io.swagger.annotations.ApiModelProperty;
@@ -28,6 +30,8 @@
     protected HttpServletRequest request;
     @Autowired
     private UserService userService;
+    @Autowired
+    private TagService tagService;
 
     protected Long getUserId(){
         return Long.parseLong(String.valueOf(request.getAttribute("userId")));
@@ -49,6 +53,10 @@
             }
         }
         return "";
+    }
+
+    protected Tag getOriginTag(){
+        return tagService.getTop();
     }
 
     /**
@@ -134,4 +142,29 @@
             wrapper.like(columns.get(i), condition);
         }
     }
+
+    public static boolean isJSON(String str) {
+        if (Cools.isEmpty(str)) {
+            return false;
+        } else {
+            str = str.trim();
+            if (str.startsWith("{") && str.endsWith("}")) {
+                return true;
+            } else if (str.startsWith("[") && str.endsWith("]")) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+    }
+
+    public static boolean isNumber(String str){
+        for (int i = str.length();--i>=0;){
+            if (!Character.isDigit(str.charAt(i))){
+                return false;
+            }
+        }
+        return true;
+    }
+
 }

--
Gitblit v1.9.1