shiqian 4 år sedan
förälder
incheckning
41df732f6b

+ 15 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/exception/NoSuchFunctionException.java

@@ -0,0 +1,15 @@
+package com.boman.domain.exception;
+
+/**
+ * @author shiqian
+ * @date 2021年04月21日 15:44
+ **/
+public class NoSuchFunctionException extends RuntimeException{
+
+    public NoSuchFunctionException(){}
+
+    public NoSuchFunctionException(String errorMsg){
+        super(errorMsg);
+    }
+
+}

+ 0 - 15
boman-api/boman-domain/src/main/java/com.boman.domain/exception/UnSuchFunctionException.java

@@ -1,15 +0,0 @@
-package com.boman.domain.exception;
-
-/**
- * @author shiqian
- * @date 2021年04月21日 15:44
- **/
-public class UnSuchFunctionException extends RuntimeException{
-
-    public UnSuchFunctionException(){}
-
-    public UnSuchFunctionException(String errorMsg){
-        super(errorMsg);
-    }
-
-}

+ 7 - 4
boman-web-core/src/main/java/com/boman/web/core/utils/AuthUtils.java

@@ -8,7 +8,7 @@ import com.boman.common.redis.service.RedisService;
 import com.boman.domain.GenTable;
 import com.boman.domain.SysRoleData;
 import com.boman.domain.constant.FormDataConstant;
-import com.boman.domain.exception.UnSuchFunctionException;
+import com.boman.domain.exception.NoSuchFunctionException;
 import com.boman.system.api.RemoteMenuService;
 import com.boman.system.api.RemoteRoleDataService;
 import com.boman.system.api.domain.SysMenu;
@@ -80,7 +80,7 @@ public class AuthUtils {
      */
     public static void containsFunction(String menuRole, String funcType, String errMsg) {
         if (!menuRole.contains(funcType)) {
-            throw new UnSuchFunctionException(errMsg);
+            throw new NoSuchFunctionException(errMsg);
         }
     }
     /**
@@ -150,7 +150,7 @@ public class AuthUtils {
         String perms = packPermsKey(tableName, funcType);
         if (!permsList.contains(perms)) {
             LOGGER.error("非法操作,操作人: {},tableName: {}, 操作类型: {}", getLoginUser().getUsername(), tableName, funcType(funcType));
-            throw new UnSuchFunctionException("不好意思,您无权限操作");
+            throw new NoSuchFunctionException("不好意思,您无权限操作");
         }
     }
 
@@ -190,7 +190,7 @@ public class AuthUtils {
         // 不可以修改
         if (!countByCreteBy(dataScope, pkName, id, tableName)) {
             LOGGER.error("非法操作,操作人: {},tableName: {}, id: {}", getLoginUser().getUsername(), tableName, id);
-            throw new UnSuchFunctionException("不好意思,您无权限操作");
+            throw new NoSuchFunctionException("不好意思,您无权限操作");
         }
     }
 
@@ -231,13 +231,16 @@ public class AuthUtils {
      */
     public static boolean countByCreteBy(String dataScope, String pkName, Long id, String tableName) {
         ICommonService commonService = SpringUtils.getBean(ICommonService.class);
+
         JSONObject condition = new JSONObject();
         condition.put(pkName, id);
         // 封装crete_by
         packAuthCondition(dataScope, condition, getLoginUser());
+
         FormDataDto dto = new FormDataDto();
         dto.setTable(tableName);
         dto.setFixedData(condition);
+
         int count = commonService.count(dto);
         // count > 0 证明此人可以看到这条记录,自然可以修改
         return count > 0;

+ 2 - 1
boman-web-core/src/main/java/com/boman/web/core/utils/ColumnUtils.java

@@ -278,11 +278,12 @@ public class ColumnUtils {
 
     /**
      * 连接字符串数组集合
+     * eg: System.out.println(joinList(Lists.newArrayList(1, 3, 2, 5))); 输出 1, 3, 2, 5
      *
      * @param iterable 集合
      * @return 连接结果
      */
-    public static String joinList(Iterable iterable) {
+    public static <T> String joinList(Iterable<T> iterable) {
         Joiner joiner = Joiner.on(", ").skipNulls();
         return joiner.join(iterable);
     }