shiqian 4 жил өмнө
parent
commit
5ee3fdf9d9

+ 15 - 19
boman-web-core/src/main/java/com/boman/web/core/domain/TableContext.java

@@ -55,35 +55,28 @@ public class TableContext {
     private List<GenTableColumn> columns;
 
     public TableContext createContext(FormDataDto dto) {
-        TableContext context = new TableContext();
+        this.actionType = ltZero(dto.getObjId()) ? ActionType.INSERT : ActionType.UPDATE;
+        this.id = dto.getObjId();
 
-        context.setActionType(ltZero(dto.getObjId()) ? ActionType.INSERT : ActionType.UPDATE);
-
-        context.setId(dto.getObjId());
-        context.setFunctionName(table.getFunctionName());
+        RedisService redisService = SpringUtils.getBean(RedisService.class);
         String tableName = requireNonNull(dto.getTable(), "tableName is empty");
-        context.setTableName(tableName);
+        this.tableName = tableName;
 
-        RedisService redisService = SpringUtils.getBean(RedisService.class);
         GenTable table = redisService.getCacheObject(RedisKey.TABLE_INFO + tableName);
-        context.setTable(requireNonNull(table, "redis中没有此表,表名: " + tableName));
+        this.table = requireNonNull(table, "redis中没有此表,表名: " + tableName);
+        this.functionName = table.getFunctionName();
 
         JSONObject fixedData = requireNonNull(dto.getFixedData(), "fixedData is empty");
-        context.setFixedData(fixedData);
+        this.fixedData = fixedData;
 
         List<GenTableColumn> columns = table.getColumns();
-        context.setColumns(columns);
-
-        String pkName = IdUtils.getPkName(columns);
-        context.setPkName(pkName);
+        this.columns = columns;
+        this.pkName = IdUtils.getPkName(columns);
 
         // 检查权限
-        checkAuthObjectSave(context);
-
-        JSONObject commitData = new JSONObject();
-        packCommitData(context, columns, fixedData, commitData);
-        context.setCommitData(commitData);
+        checkAuthObjectSave(this);
 
+        this.commitData = packCommitData(this, columns, fixedData);
         return this;
 
     }
@@ -110,7 +103,8 @@ public class TableContext {
     }
 
 
-    private static void packCommitData(TableContext context, List<GenTableColumn> columns, JSONObject fixedData, JSONObject commitData) {
+    private static JSONObject packCommitData(TableContext context, List<GenTableColumn> columns, JSONObject fixedData) {
+        JSONObject commitData = new JSONObject();
         // 过滤掉hr字段
         columns = withoutHr(columns);
         for (GenTableColumn column : columns) {
@@ -141,6 +135,8 @@ public class TableContext {
                 }
             }
         }
+
+        return commitData;
     }
 
     /**                 get and set                               **/

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

@@ -149,7 +149,7 @@ public class AuthUtils {
         List<String> permsList = getLoginUserPermsList();
         String perms = packPermsKey(tableName, funcType);
         if (!permsList.contains(perms)) {
-            LOGGER.error("非法操作,操作人: {},tableName: {}, 操作类型: {}", getLoginUser().getUsername(), tableName, funcType);
+            LOGGER.error("非法操作,操作人: {},tableName: {}, 操作类型: {}", getLoginUser().getUsername(), tableName, funcType(funcType));
             throw new UnSuchFunctionException("不好意思,您无权限操作");
         }
     }
@@ -287,8 +287,10 @@ public class AuthUtils {
                 return "反提交";
             case GenTable.E:
                 return "导出";
-            default:
+            case GenTable.I:
                 return "导入";
+            default:
+                return "未知";
         }
     }