shiqian 4 years ago
parent
commit
19a92c14e9

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

@@ -25,6 +25,7 @@ import java.util.List;
 
 import static com.boman.common.core.utils.obj.ObjectUtils.*;
 import static com.boman.web.core.utils.ColumnUtils.joinList;
+import static com.boman.web.core.utils.ColumnUtils.joinList1;
 
 /**
  * @author shiqian
@@ -213,7 +214,7 @@ public class AuthUtils {
     public static boolean checkRoleDataAuthBool(String tableName, String pkName, Long id) {
         List<Long> roleIdList = getLoginUserRoleIdList();
         RemoteRoleDataService remoteRoleDataService = SpringUtils.getBean(RemoteRoleDataService.class);
-        List<SysRoleData> roleDataList = remoteRoleDataService.listByRoleIdListTableName(joinList(roleIdList), tableName);
+        List<SysRoleData> roleDataList = remoteRoleDataService.listByRoleIdListTableName(joinList1(roleIdList), tableName);
         if (isEmpty(roleDataList)) {
             //没有配,证明有此表的全部权限
             return true;

+ 13 - 0
boman-web-core/src/main/java/com/boman/web/core/utils/ColumnUtils.java

@@ -13,6 +13,7 @@ import com.boman.domain.GenTableColumn;
 import com.boman.domain.constant.MysqlDataTypeConst;
 import com.boman.domain.exception.UnknownColumnException;
 import com.boman.web.core.domain.TableContext;
+import com.google.common.base.Joiner;
 import com.google.common.collect.Lists;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.math.NumberUtils;
@@ -392,6 +393,18 @@ public class ColumnUtils {
         return result.substring(0, result.length() - 2);
     }
 
+    /**
+     * 连接字符串数组集合
+     * eg: System.out.println(joinList(Lists.newArrayList(1, 3, 2, 5))); 输出 1, 3, 2, 5
+     *
+     * @param iterable 集合
+     * @return 连接结果
+     */
+    public static <T> String joinList1(Iterable<T> iterable) {
+        Joiner joiner = Joiner.on(", ").skipNulls();
+        return joiner.join(iterable);
+    }
+
     public static String getColumnTypeByColumnName(List<GenTableColumn> columns, String columnName){
         String result = "";
         for (GenTableColumn column : columns) {