Browse Source

Merge branch 'master' of http://192.168.101.10:13000/boman/boman-framwork

sr 4 years ago
parent
commit
a1994bc88c

+ 7 - 0
boman-common/boman-common-core/src/main/java/com/boman/common/core/utils/obj/ObjectUtils.java

@@ -52,6 +52,13 @@ public class ObjectUtils {
         return input;
         return input;
     }
     }
 
 
+    public static Boolean requireNonNull(Boolean input, String... errorMsg) {
+        if (input == null) {
+            throw new IllegalArgumentException(errorMsg[0]);
+        }
+        return input;
+    }
+
     public static <T> T requireNonNull(T input, String... errorMsg) {
     public static <T> T requireNonNull(T input, String... errorMsg) {
         if (input == null) {
         if (input == null) {
             throw new IllegalArgumentException(errorMsg[0]);
             throw new IllegalArgumentException(errorMsg[0]);

+ 1 - 1
boman-modules/boman-file/src/main/java/com/boman/file/utils/FileUploadUtils.java

@@ -27,7 +27,7 @@ public class FileUploadUtils
     /**
     /**
      * 默认的文件名最大长度 100
      * 默认的文件名最大长度 100
      */
      */
-    public static final int DEFAULT_FILE_NAME_LENGTH = 100;
+    public static final int DEFAULT_FILE_NAME_LENGTH = 1000;
 
 
     /**
     /**
      * 根据文件路径上传
      * 根据文件路径上传

+ 2 - 2
boman-modules/boman-gen/src/main/java/com/boman/gen/domain/GenTableColumn.java

@@ -18,8 +18,8 @@ public class GenTableColumn extends BaseEntity
     /** 是查询字段 */
     /** 是查询字段 */
     public static final String IS_QUERY = "1";
     public static final String IS_QUERY = "1";
 
 
-    /** 是列表展示字段 */
-    public static final String IS_LIST = "1";
+    /** 主键 */
+    public static final String IS_PK = "1";
 
 
     /** 编号 */
     /** 编号 */
     private Long columnId;
     private Long columnId;

+ 21 - 0
boman-modules/boman-gen/src/main/java/com/boman/gen/util/GenUtils.java

@@ -1,6 +1,11 @@
 package com.boman.gen.util;
 package com.boman.gen.util;
 
 
 import java.util.Arrays;
 import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.RegExUtils;
 import org.apache.commons.lang3.RegExUtils;
 import com.boman.common.core.constant.GenConstants;
 import com.boman.common.core.constant.GenConstants;
 import com.boman.common.core.utils.StringUtils;
 import com.boman.common.core.utils.StringUtils;
@@ -255,4 +260,20 @@ public class GenUtils
             return 0;
             return 0;
         }
         }
     }
     }
+
+    /**
+     * 功能描述: 数字小的在前面,数字大的在后面
+     *
+     * @param allColumns allColumns
+     * @return java.util.List<com.boman.gen.domain.GenTableColumn>
+     */
+    public static List<GenTableColumn> filterHrAndSort(List<GenTableColumn> allColumns) {
+        if (CollectionUtils.isEmpty(allColumns)) {
+            throw new IllegalArgumentException("GenTableColumn is empty");
+        }
+
+        return allColumns.stream().filter(col -> "HR".equalsIgnoreCase(col.getHtmlType()))
+                .sorted(Comparator.comparing(GenTableColumn::getSort))
+                .collect(Collectors.toList());
+    }
 }
 }

+ 2 - 2
boman-web-core/src/main/java/com/boman/web/core/controller/CommonController.java

@@ -1,7 +1,7 @@
 package com.boman.web.core.controller;
 package com.boman.web.core.controller;
 
 
 import com.boman.common.core.web.domain.AjaxResult;
 import com.boman.common.core.web.domain.AjaxResult;
-import com.boman.web.core.domain.BaseTableDTO;
+import com.boman.web.core.domain.FormDataDto;
 import com.boman.web.core.service.common.ICommonService;
 import com.boman.web.core.service.common.ICommonService;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
@@ -38,7 +38,7 @@ public class CommonController {
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
     @PostMapping
     @PostMapping
-    public AjaxResult getByMap(@RequestBody BaseTableDTO dto) {
+    public AjaxResult getByMap(@RequestBody FormDataDto dto) {
         return AjaxResult.success(commonService.getByMap(dto.getTable(), dto.getFixedData()));
         return AjaxResult.success(commonService.getByMap(dto.getTable(), dto.getFixedData()));
     }
     }
 
 

+ 19 - 19
boman-web-core/src/main/java/com/boman/web/core/controller/ObjController.java

@@ -2,7 +2,7 @@ package com.boman.web.core.controller;
 
 
 import com.boman.common.core.web.domain.AjaxResult;
 import com.boman.common.core.web.domain.AjaxResult;
 import com.boman.gen.controller.MyController;
 import com.boman.gen.controller.MyController;
-import com.boman.web.core.domain.BaseTableSaveDTO;
+import com.boman.web.core.domain.FormDataDto;
 import com.boman.web.core.service.TableServiceCmdService;
 import com.boman.web.core.service.TableServiceCmdService;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -38,13 +38,13 @@ public class ObjController {
      *                    }
      *                    }
      *                }
      *                }
      *
      *
-     * @param baseTableSaveDTO 前台传过来的dto
+     * @param formDataDto 前台传过来的dto
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
     @ApiOperation(value = "单对象保存")
     @ApiOperation(value = "单对象保存")
     @PostMapping("/objectSave")
     @PostMapping("/objectSave")
-    public AjaxResult objectSave(@RequestBody BaseTableSaveDTO baseTableSaveDTO) {
-        return tableServiceCmdService.objectSave(baseTableSaveDTO);
+    public AjaxResult objectSave(@RequestBody FormDataDto formDataDto) {
+        return tableServiceCmdService.objectSave(formDataDto);
     }
     }
 
 
     /**
     /**
@@ -59,13 +59,13 @@ public class ObjController {
      *
      *
      *
      *
      *
      *
-     * @param baseTableSaveDTO 前台传过来的dto
+     * @param formDataDto 前台传过来的dto
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
     @ApiOperation(value = "单对象删除")
     @ApiOperation(value = "单对象删除")
     @PostMapping("/objectDelete")
     @PostMapping("/objectDelete")
-    public AjaxResult objectDelete(@RequestBody BaseTableSaveDTO baseTableSaveDTO) {
-        return tableServiceCmdService.objectDelete(baseTableSaveDTO);
+    public AjaxResult objectDelete(@RequestBody FormDataDto formDataDto) {
+        return tableServiceCmdService.objectDelete(formDataDto);
     }
     }
 
 
     /**
     /**
@@ -81,13 +81,13 @@ public class ObjController {
      *                           ]
      *                           ]
      *                       }
      *                       }
      *
      *
-     * @param baseTableSaveDTO 前台传过来的dto
+     * @param formDataDto 前台传过来的dto
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
     @ApiOperation(value = "单对象逻辑删除")
     @ApiOperation(value = "单对象逻辑删除")
     @PostMapping("/objectLogicDelete")
     @PostMapping("/objectLogicDelete")
-    public AjaxResult objectLogicDelete(@RequestBody BaseTableSaveDTO baseTableSaveDTO) {
-        return tableServiceCmdService.objectLogicDelete(baseTableSaveDTO);
+    public AjaxResult objectLogicDelete(@RequestBody FormDataDto formDataDto) {
+        return tableServiceCmdService.objectLogicDelete(formDataDto);
     }
     }
 
 
     /**
     /**
@@ -103,7 +103,7 @@ public class ObjController {
      */
      */
     @ApiOperation(value = "获取单表单数据")
     @ApiOperation(value = "获取单表单数据")
     @PostMapping("/getObject")
     @PostMapping("/getObject")
-    public AjaxResult getObject(@RequestBody BaseTableSaveDTO condition) {
+    public AjaxResult getObject(@RequestBody FormDataDto condition) {
         return tableServiceCmdService.getObject(condition);
         return tableServiceCmdService.getObject(condition);
     }
     }
 
 
@@ -130,7 +130,7 @@ public class ObjController {
      */
      */
     @ApiOperation(value = "获取表单列表数据")
     @ApiOperation(value = "获取表单列表数据")
     @PostMapping("/queryList")
     @PostMapping("/queryList")
-    public AjaxResult queryList(@RequestBody BaseTableSaveDTO condition) {
+    public AjaxResult queryList(@RequestBody FormDataDto condition) {
         return tableServiceCmdService.queryList(condition);
         return tableServiceCmdService.queryList(condition);
     }
     }
 
 
@@ -148,7 +148,7 @@ public class ObjController {
      */
      */
     @ApiOperation(value = "获取表单查询字段和按钮")
     @ApiOperation(value = "获取表单查询字段和按钮")
     @PostMapping("/getTableQuery")
     @PostMapping("/getTableQuery")
-    public AjaxResult getTableQuery(@RequestBody BaseTableSaveDTO condition) {
+    public AjaxResult getTableQuery(@RequestBody FormDataDto condition) {
         return tableServiceCmdService.getTableQuery(condition);
         return tableServiceCmdService.getTableQuery(condition);
     }
     }
 
 
@@ -166,7 +166,7 @@ public class ObjController {
      */
      */
     @ApiOperation(value = "获取表单查询字段")
     @ApiOperation(value = "获取表单查询字段")
     @PostMapping("/getQueryParam")
     @PostMapping("/getQueryParam")
-    public AjaxResult getQueryParam(@RequestBody BaseTableSaveDTO condition) {
+    public AjaxResult getQueryParam(@RequestBody FormDataDto condition) {
         return tableServiceCmdService.getQueryParam(condition);
         return tableServiceCmdService.getQueryParam(condition);
     }
     }
 
 
@@ -185,7 +185,7 @@ public class ObjController {
      */
      */
     @ApiOperation(value = "获取表单表头")
     @ApiOperation(value = "获取表单表头")
     @PostMapping("/getTableHead")
     @PostMapping("/getTableHead")
-    public AjaxResult getTableHead(@RequestBody BaseTableSaveDTO condition) {
+    public AjaxResult getTableHead(@RequestBody FormDataDto condition) {
         return tableServiceCmdService.getTableHead(condition);
         return tableServiceCmdService.getTableHead(condition);
     }
     }
 
 
@@ -203,7 +203,7 @@ public class ObjController {
      */
      */
     @ApiOperation(value = "获取表单按钮")
     @ApiOperation(value = "获取表单按钮")
     @PostMapping("/getButton")
     @PostMapping("/getButton")
-    public AjaxResult getButton(@RequestBody BaseTableSaveDTO condition) {
+    public AjaxResult getButton(@RequestBody FormDataDto condition) {
         return AjaxResult.success( tableServiceCmdService.getButton(condition.getTable()));
         return AjaxResult.success( tableServiceCmdService.getButton(condition.getTable()));
     }
     }
 
 
@@ -215,7 +215,7 @@ public class ObjController {
      */
      */
     @ApiOperation(value = "获取表单子表")
     @ApiOperation(value = "获取表单子表")
     @PostMapping("/objectTab")
     @PostMapping("/objectTab")
-    public AjaxResult objectTab(@RequestBody BaseTableSaveDTO condition) {
+    public AjaxResult objectTab(@RequestBody FormDataDto condition) {
         return tableServiceCmdService.objectTab(condition);
         return tableServiceCmdService.objectTab(condition);
     }
     }
 
 
@@ -237,7 +237,7 @@ public class ObjController {
      */
      */
     @ApiOperation(value = "表单提交接口")
     @ApiOperation(value = "表单提交接口")
     @PostMapping("/objectSubmit")
     @PostMapping("/objectSubmit")
-    public AjaxResult objectSubmit(@RequestBody BaseTableSaveDTO condition) {
+    public AjaxResult objectSubmit(@RequestBody FormDataDto condition) {
         return tableServiceCmdService.objectSubmit(condition, true);
         return tableServiceCmdService.objectSubmit(condition, true);
     }
     }
 
 
@@ -261,7 +261,7 @@ public class ObjController {
      */
      */
     @ApiOperation(value = "反提交接口")
     @ApiOperation(value = "反提交接口")
     @PostMapping("/objectUnSubmit")
     @PostMapping("/objectUnSubmit")
-    public AjaxResult objectUnSubmit(@RequestBody BaseTableSaveDTO condition) {
+    public AjaxResult objectUnSubmit(@RequestBody FormDataDto condition) {
         return tableServiceCmdService.objectSubmit(condition, false);
         return tableServiceCmdService.objectSubmit(condition, false);
     }
     }
 
 

+ 5 - 6
boman-web-core/src/main/java/com/boman/web/core/controller/TableController.java

@@ -2,7 +2,6 @@ package com.boman.web.core.controller;
 
 
 import com.boman.common.core.web.domain.AjaxResult;
 import com.boman.common.core.web.domain.AjaxResult;
 import com.boman.gen.domain.GenTable;
 import com.boman.gen.domain.GenTable;
-import com.boman.web.core.domain.BaseTableSaveDTO;
 import com.boman.web.core.service.TableServiceCmdService;
 import com.boman.web.core.service.TableServiceCmdService;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,11 +33,11 @@ public class TableController {
      * @param condition condition
      * @param condition condition
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    @ApiOperation(value = "根据表名获取表单所有信息")
-    @PostMapping("/getByTableName")
-    public AjaxResult getByTableName(@RequestBody BaseTableSaveDTO condition) {
-        return tableServiceCmdService.getByTableName(condition);
-    }
+//    @ApiOperation(value = "根据表名获取表单所有信息")
+//    @PostMapping("/getByTableName")
+//    public AjaxResult getByTableName(@RequestBody BaseTableSaveDTO condition) {
+//        return tableServiceCmdService.getByTableName(condition);
+//    }
 
 
     /**
     /**
      * 功能描述: 根据表名获取表信息、表字段和表字段对应的字典值
      * 功能描述: 根据表名获取表信息、表字段和表字段对应的字典值

+ 0 - 50
boman-web-core/src/main/java/com/boman/web/core/domain/BaseTableDTO.java

@@ -1,50 +0,0 @@
-package com.boman.web.core.domain;
-
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.annotation.JSONField;
-
-/**
- * @author shiqian
- * @description
- * @date 2021年03月22日 09:53
- **/
-public class BaseTableDTO {
-
-    @JSONField(name = "objId")
-    private Long objId;
-
-    @JSONField(name = "fixedData")
-    private JSONObject fixedData;
-
-    /**
-     * 前台传参中的表名
-     */
-    @JSONField(name = "table")
-    private String table;
-
-
-    public Long getObjId() {
-        return objId;
-    }
-
-    public void setObjId(Long objId) {
-        this.objId = objId;
-    }
-
-    public JSONObject getFixedData() {
-        return fixedData;
-    }
-
-    public void setFixedData(JSONObject fixedData) {
-        this.fixedData = fixedData;
-    }
-
-    public String getTable() {
-        return table;
-    }
-
-    public void setTable(String table) {
-        this.table = table;
-    }
-
-}

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/domain/BaseTableSaveDTO.java → boman-web-core/src/main/java/com/boman/web/core/domain/FormDataDto.java

@@ -14,7 +14,7 @@ import java.util.List;
  * @since:2018/12/27
  * @since:2018/12/27
  * @createat:2018/12/274:41 PM
  * @createat:2018/12/274:41 PM
  */
  */
-public class BaseTableSaveDTO implements Serializable {
+public class FormDataDto implements Serializable {
 
 
     private static final long serialVersionUID = -8653990707913725671L;
     private static final long serialVersionUID = -8653990707913725671L;
     @JSONField(name = "objId")
     @JSONField(name = "objId")

+ 2 - 3
boman-web-core/src/main/java/com/boman/web/core/domain/TableContext.java

@@ -8,7 +8,6 @@ import com.boman.gen.domain.GenTable;
 import com.boman.gen.domain.GenTableColumn;
 import com.boman.gen.domain.GenTableColumn;
 import com.boman.web.core.utils.IdUtils;
 import com.boman.web.core.utils.IdUtils;
 
 
-import java.sql.Timestamp;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -31,7 +30,7 @@ public class TableContext {
     private JSONObject commitData;
     private JSONObject commitData;
     private List<GenTableColumn> columns;
     private List<GenTableColumn> columns;
 
 
-    public static TableContext createContext(BaseTableSaveDTO dto) {
+    public static TableContext createContext(FormDataDto dto) {
         TableContext context = new TableContext();
         TableContext context = new TableContext();
         context.setId(dto.getObjId());
         context.setId(dto.getObjId());
         String tableName = requireNonNull(dto.getTable(), "tableName is empty");
         String tableName = requireNonNull(dto.getTable(), "tableName is empty");
@@ -58,7 +57,7 @@ public class TableContext {
 
 
     }
     }
 
 
-    private static void packCommitData(BaseTableSaveDTO dto, TableContext context, List<GenTableColumn> columns
+    private static void packCommitData(FormDataDto dto, TableContext context, List<GenTableColumn> columns
             , JSONObject fixedData, JSONObject commitData) {
             , JSONObject fixedData, JSONObject commitData) {
         boolean isInsert = ltZero(dto.getObjId());
         boolean isInsert = ltZero(dto.getObjId());
         context.setActionType(isInsert ? ActionType.INSERT : ActionType.UPDATE);
         context.setActionType(isInsert ? ActionType.INSERT : ActionType.UPDATE);

+ 22 - 0
boman-web-core/src/main/java/com/boman/web/core/domain/ViewConst.java

@@ -0,0 +1,22 @@
+package com.boman.web.core.domain;
+
+/**
+ * @author shiqian
+ * @date 2021年04月20日 16:20
+ **/
+public class ViewConst {
+
+    public static final String VIEW_TYPE = "viewType";
+
+    /**  只有主表展示信息的模板  页面   **/
+   public static final String CRUD = "crud";
+
+    /**  上面展示主表信息、下面是列表  页面   **/
+   public static final String HEAD_TAB = "headTab";
+
+    /**  tab切换子表信息 页面    **/
+   public static final String ITEM_TAB = "itemTab";
+
+    /**  tree 页面    **/
+   public static final String TREE = "tree";
+}

+ 65 - 59
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -18,6 +18,7 @@ import com.boman.gen.controller.MyController;
 import com.boman.gen.domain.GenTable;
 import com.boman.gen.domain.GenTable;
 import com.boman.gen.domain.GenTableColumn;
 import com.boman.gen.domain.GenTableColumn;
 import com.boman.gen.domain.GenTableRelation;
 import com.boman.gen.domain.GenTableRelation;
+import com.boman.gen.util.GenUtils;
 import com.boman.system.api.RemoteDictDataService;
 import com.boman.system.api.RemoteDictDataService;
 import com.boman.system.api.domain.SysFile;
 import com.boman.system.api.domain.SysFile;
 import com.boman.web.core.constant.FormDataConstant;
 import com.boman.web.core.constant.FormDataConstant;
@@ -32,7 +33,6 @@ import com.boman.web.core.service.update.IBaseUpdateService;
 import com.boman.web.core.utils.IdUtils;
 import com.boman.web.core.utils.IdUtils;
 import com.google.common.base.Strings;
 import com.google.common.base.Strings;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.BooleanUtils;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
@@ -82,7 +82,7 @@ public class TableServiceCmdService {
 
 
     private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
     private static final Logger LOGGER = LoggerFactory.getLogger(TableServiceCmdService.class);
 
 
-    public final AjaxResult objectSave(BaseTableSaveDTO dto) {
+    public final AjaxResult objectSave(FormDataDto dto) {
         AjaxResult result = AjaxResult.success();
         AjaxResult result = AjaxResult.success();
 
 
         TableContext context = TableContext.createContext(dto);
         TableContext context = TableContext.createContext(dto);
@@ -123,8 +123,8 @@ public class TableServiceCmdService {
      * @param dto 前台传过来的dto
      * @param dto 前台传过来的dto
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult objectDelete(BaseTableSaveDTO dto) {
-        requireNonNull(dto.getTable());
+    public AjaxResult objectDelete(FormDataDto dto) {
+        requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
         Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
         Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
         requireNonNull(idArr);
         requireNonNull(idArr);
         // 拿到pkName
         // 拿到pkName
@@ -150,8 +150,8 @@ public class TableServiceCmdService {
      * @param dto 前台传过来的dto
      * @param dto 前台传过来的dto
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult objectLogicDelete(BaseTableSaveDTO dto) {
-        requireNonNull(dto.getTable());
+    public AjaxResult objectLogicDelete(FormDataDto dto) {
+        requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
         Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
         Long[] idArr = CollectionUtils.listToArray(dto.getIdList());
         requireNonNull(idArr);
         requireNonNull(idArr);
 
 
@@ -177,8 +177,8 @@ public class TableServiceCmdService {
      * @param dto condition
      * @param dto condition
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult queryList(BaseTableSaveDTO dto) {
-        requireNonNull(dto.getTable());
+    public AjaxResult queryList(FormDataDto dto) {
+        requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
 
 
         // 拿到每个字段对应的查询类型,=、 like、 >、 <
         // 拿到每个字段对应的查询类型,=、 like、 >、 <
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, dto.getTable());
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, dto.getTable());
@@ -207,12 +207,6 @@ public class TableServiceCmdService {
 
 
         List<JSONObject> result = selectService.selectByCondition(genTable.getTableName(), condition, packCondition
         List<JSONObject> result = selectService.selectByCondition(genTable.getTableName(), condition, packCondition
                 , showData, dto.getOrderBy(), dto.getLimit(), dto.getOffset());
                 , showData, dto.getOrderBy(), dto.getLimit(), dto.getOffset());
-        // 处理时间
-//        handlerDate(result, columns);
-        // 处理字典值
-//        handlerSysDictData(result, columns);
-        // 处理外键
-//        handlerForeignKey(result, columns);
 
 
         handler(result =  filter(result, ObjectUtils::isNotEmpty), columns);
         handler(result =  filter(result, ObjectUtils::isNotEmpty), columns);
         // 定制接口
         // 定制接口
@@ -316,7 +310,7 @@ public class TableServiceCmdService {
                 if (jsonObject.containsKey(column.getColumnName())) {
                 if (jsonObject.containsKey(column.getColumnName())) {
                     String value = jsonObject.getString(column.getColumnName());
                     String value = jsonObject.getString(column.getColumnName());
                     JSONArray fileList = JSON.parseArray(value);
                     JSONArray fileList = JSON.parseArray(value);
-                    ArrayList<SysFile> files = Lists.newArrayListWithCapacity(2);
+                    ArrayList<SysFile> files = Lists.newArrayListWithCapacity(fileList.size());
                     for (Object obj : fileList) {
                     for (Object obj : fileList) {
                         JSONObject fileItem = (JSONObject) obj;
                         JSONObject fileItem = (JSONObject) obj;
                         SysFile file = new SysFile();
                         SysFile file = new SysFile();
@@ -377,24 +371,27 @@ public class TableServiceCmdService {
      * @param dto condition
      * @param dto condition
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult getObject(BaseTableSaveDTO dto) {
-        String tableName = requireNonNull(dto.getTable());
+    public AjaxResult getObject(FormDataDto dto) {
+        String tableName = requireNonNull(dto.getTable(), "tableName = [" + dto.getTable() + "] 此表不存在");
 
 
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
         String pkName = IdUtils.getPkName(genTable.getColumns());
         String pkName = IdUtils.getPkName(genTable.getColumns());
         JSONObject fixedData = dto.getFixedData();
         JSONObject fixedData = dto.getFixedData();
         Long id = fixedData.getLong(FormDataConstant.ID);
         Long id = fixedData.getLong(FormDataConstant.ID);
-        requireNonNull(id);
+        requireNonNull(id, "如果是回显,则传参为此行记录的id, 如为新增,则传-1,传null可不行");
+        Boolean isUi = requireNonNull(dto.getIsUi(), "未传isUi这个参数");
+
         List<GenTableColumn> columns = genTable.getColumns();
         List<GenTableColumn> columns = genTable.getColumns();
         // id = -1时,查询该表单对应的字段名称
         // id = -1时,查询该表单对应的字段名称
         if (ltZero(id)) {
         if (ltZero(id)) {
-            return getByTableName(tableName, columns);
+            return getByTableName(tableName, columns, isUi);
         }
         }
 
 
         // 默认查所有字段,不支持自定义
         // 默认查所有字段,不支持自定义
         JSONObject json = selectService.selectById(tableName, pkName, id);
         JSONObject json = selectService.selectById(tableName, pkName, id);
         requireNonNull(json, "id 为[" + id + "]的数据不存在, 表名为[" + tableName + "]");
         requireNonNull(json, "id 为[" + id + "]的数据不存在, 表名为[" + tableName + "]");
-        List<GenTableColumn> parentColumns = filter(columns, col -> HR.equalsIgnoreCase(col.getHtmlType()));
+        List<GenTableColumn> parentColumns = GenUtils.filterHrAndSort(columns);
+
         // 处理成hr的形式
         // 处理成hr的形式
         for (GenTableColumn hrColumn : parentColumns) {
         for (GenTableColumn hrColumn : parentColumns) {
             List<GenTableColumn> children = Lists.newArrayListWithCapacity(16);
             List<GenTableColumn> children = Lists.newArrayListWithCapacity(16);
@@ -504,7 +501,7 @@ public class TableServiceCmdService {
      * @param condition condition
      * @param condition condition
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult getTableQuery(BaseTableSaveDTO condition) {
+    public AjaxResult getTableQuery(FormDataDto condition) {
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
         List<GenTableColumn> columns = genTable.getColumns();
         List<GenTableColumn> columns = genTable.getColumns();
         JSONObject jsonObject = new JSONObject();
         JSONObject jsonObject = new JSONObject();
@@ -530,7 +527,7 @@ public class TableServiceCmdService {
         // genTable.getMenuRole() 暂时数据库没有数据,
         // genTable.getMenuRole() 暂时数据库没有数据,
         jsonObject.put(FormDataConstant.BUTTON_LIST, Strings.nullToEmpty(genTable.getMenuRole()));
         jsonObject.put(FormDataConstant.BUTTON_LIST, Strings.nullToEmpty(genTable.getMenuRole()));
 
 
-        // jsonObject.put(FormDataConstant.TABLE_HEAD_LIST, getTableHeadList(genTable));
+         jsonObject.put(ViewConst.VIEW_TYPE, genTable.getTplCategory());
         return AjaxResult.success(jsonObject);
         return AjaxResult.success(jsonObject);
     }
     }
 
 
@@ -546,7 +543,7 @@ public class TableServiceCmdService {
      * @param condition condition
      * @param condition condition
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult getQueryParam(BaseTableSaveDTO condition) {
+    public AjaxResult getQueryParam(FormDataDto condition) {
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
         List<GenTableColumn> columns = genTable.getColumns();
         List<GenTableColumn> columns = genTable.getColumns();
         // 查询字段
         // 查询字段
@@ -576,7 +573,7 @@ public class TableServiceCmdService {
      * @param condition condition
      * @param condition condition
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult getTableHead(BaseTableSaveDTO condition) {
+    public AjaxResult getTableHead(FormDataDto condition) {
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
         return AjaxResult.success(getTableHeadList(genTable));
         return AjaxResult.success(getTableHeadList(genTable));
     }
     }
@@ -611,7 +608,7 @@ public class TableServiceCmdService {
      * @param condition condition
      * @param condition condition
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult objectTab(BaseTableSaveDTO condition) {
+    public AjaxResult objectTab(FormDataDto condition) {
         //获取到主表对象
         //获取到主表对象
         GenTable genTable = getTableFromRedisByTableName(RedisKey.RELATION, condition.getTable());
         GenTable genTable = getTableFromRedisByTableName(RedisKey.RELATION, condition.getTable());
         //从主表对象的relationList中获取出所有子表表对象
         //从主表对象的relationList中获取出所有子表表对象
@@ -652,7 +649,7 @@ public class TableServiceCmdService {
      * @param isSubmit  提交true, 反提交false
      * @param isSubmit  提交true, 反提交false
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult objectSubmit(BaseTableSaveDTO condition, boolean isSubmit) {
+    public AjaxResult objectSubmit(FormDataDto condition, boolean isSubmit) {
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
         List<JSONObject> commitData = condition.getCommitData();
         List<JSONObject> commitData = condition.getCommitData();
         requireNonNull(commitData, "啥都不提交, 调什么接口??");
         requireNonNull(commitData, "啥都不提交, 调什么接口??");
@@ -795,46 +792,55 @@ public class TableServiceCmdService {
      * @param condition condition
      * @param condition condition
      * @return com.boman.common.core.web.domain.AjaxResult
      * @return com.boman.common.core.web.domain.AjaxResult
      */
      */
-    public AjaxResult getByTableName(BaseTableSaveDTO condition) {
-        requireNonNull(condition.getTable(), "表名为空");
-        requireNonNull(condition.getIsUi(), "根据表名获取表字段,未传 isUi 这个字段");
-        GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
-        List<GenTableColumn> allColumns = genTable.getColumns();
-        // 把新增可见的列过滤出来
-//        List<GenTableColumn> returnData = ColumnUtils.filterNeedShowData(allColumns, 0, INSERT_VISIBLE::equals);
-        // 普通的展示,不带折叠的
-        if (BooleanUtils.isFalse(condition.getIsUi())) {
-            packDictDataToColumns(allColumns, ObjectUtils::isNotEmpty);
-            return AjaxResult.success(genTable);
-        } else {
-            // 带折叠的展示
-            return getByTableName(genTable.getTableName(), allColumns);
-        }
-    }
-
-    public AjaxResult getByTableName(String tableName, List<GenTableColumn> allColumns) {
-        List<GenTableColumn> parentColumns = filter(allColumns, col -> HR.equalsIgnoreCase(col.getHtmlType()));
-        allColumns = filterData(allColumns, 0, MaskConstant.LIST_VISIBLE::equals);
-
-        // 把孩子放入父亲的怀抱
-        for (GenTableColumn hrColumn : parentColumns) {
-            List<GenTableColumn> children = Lists.newArrayListWithCapacity(16);
-            for (GenTableColumn column : allColumns) {
-                if (hrColumn.getColumnId().equals(column.getHrParentId())) {
-                    children.add(column);
+//    public AjaxResult getByTableName(BaseTableSaveDTO condition) {
+//        requireNonNull(condition.getTable(), "tableName = [" + condition.getTable() + "] 此表不存在");
+//        requireNonNull(condition.getIsUi(), "根据表名获取表字段,未传 isUi 这个字段");
+//        GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, condition.getTable());
+//        List<GenTableColumn> allColumns = genTable.getColumns();
+//        // 把新增可见的列过滤出来
+////        List<GenTableColumn> returnData = ColumnUtils.filterNeedShowData(allColumns, 0, INSERT_VISIBLE::equals);
+//        // 普通的展示,不带折叠的
+//        if (BooleanUtils.isFalse(condition.getIsUi())) {
+//            packDictDataToColumns(allColumns, ObjectUtils::isNotEmpty);
+//            return AjaxResult.success(genTable);
+//        } else {
+//            // 带折叠的展示
+//            return getByTableName(genTable.getTableName(), allColumns, true);
+//        }
+//    }
+
+    public AjaxResult getByTableName(String tableName, List<GenTableColumn> allColumns, Boolean isUi) {
+        List<GenTableColumn> resultCols;
+        List<GenTableColumn> parentColumns = GenUtils.filterHrAndSort(allColumns);
+        // 所有新增可见的列
+        allColumns = filterData(allColumns, 0, MaskConstant.INSERT_VISIBLE::equals);
+        // 带折叠
+        if (BooleanUtils.isTrue(isUi)) {
+            // 把孩子放入父亲的怀抱
+            for (GenTableColumn hrColumn : parentColumns) {
+                List<GenTableColumn> children = Lists.newArrayListWithCapacity(16);
+                for (GenTableColumn column : allColumns) {
+                    if (hrColumn.getColumnId().equals(column.getHrParentId())) {
+                        children.add(column);
+                    }
                 }
                 }
+                hrColumn.setHrChildren(children);
             }
             }
-            hrColumn.setHrChildren(children);
-        }
 
 
-        // 把孩子对应的字典值放进去
-        for (GenTableColumn hrColumn : parentColumns) {
-            packDictDataToColumns(hrColumn.getHrChildren(), ObjectUtils::isNotEmpty);
+            // 把孩子对应的字典值放进去
+            for (GenTableColumn hrColumn : parentColumns) {
+                packDictDataToColumns(hrColumn.getHrChildren(), ObjectUtils::isNotEmpty);
+            }
+            resultCols = parentColumns;
+        } else {
+            // 不带折叠
+            packDictDataToColumns(allColumns, ObjectUtils::isNotEmpty);
+            resultCols = allColumns;
         }
         }
 
 
         JSONObject result = new JSONObject();
         JSONObject result = new JSONObject();
         result.put(BUTTON_LIST, getButton(tableName));
         result.put(BUTTON_LIST, getButton(tableName));
-        result.put(SHOW_DATA, parentColumns);
+        result.put(SHOW_DATA, resultCols);
         return AjaxResult.success(result);
         return AjaxResult.success(result);
     }
     }
 
 

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

@@ -46,7 +46,7 @@ public class IdUtils {
         }
         }
 
 
         for (GenTableColumn tableColumn : columnList) {
         for (GenTableColumn tableColumn : columnList) {
-            if ("1".equalsIgnoreCase(tableColumn.getIsPk())) {
+            if (GenTableColumn.IS_PK.equalsIgnoreCase(tableColumn.getIsPk())) {
                 return requireNonNull(tableColumn.getColumnName(), "主键名称为空");
                 return requireNonNull(tableColumn.getColumnName(), "主键名称为空");
             }
             }
         }
         }

+ 3 - 2
ruoyi-ui/src/components/DynamicForm/index.vue

@@ -40,7 +40,7 @@
         :action="process + '/boman-file/upload'"
         :action="process + '/boman-file/upload'"
         :on-change="handleChange"
         :on-change="handleChange"
         :on-success="upImageFn"
         :on-success="upImageFn"
-         :on-remove="reseImage"
+        :on-remove="reseImage"
         :file-list="config">
         :file-list="config">
         <el-button size="small" type="primary">点击上传</el-button>
         <el-button size="small" type="primary">点击上传</el-button>
         <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
         <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
@@ -87,7 +87,7 @@
     methods: {
     methods: {
       upImageFn(res, file){
       upImageFn(res, file){
         this.config.push(res.data);
         this.config.push(res.data);
-        console.log(this.config,12153)
+        console.log(res,12153)
       },
       },
       init() {
       init() {
         if(this.formConfig.htmlType == 'checkbox' || this.formConfig.htmlType == 'imageUpload' || this.formConfig.htmlType == 'fileUpload'){
         if(this.formConfig.htmlType == 'checkbox' || this.formConfig.htmlType == 'imageUpload' || this.formConfig.htmlType == 'fileUpload'){
@@ -130,6 +130,7 @@
       },
       },
       handlePictureCardPreview(file) {
       handlePictureCardPreview(file) {
         this.dialogImageUrl = file.url;
         this.dialogImageUrl = file.url;
+		// console.log(this.dialogImageUrl)
         this.dialogVisible = true;
         this.dialogVisible = true;
       },
       },
       handleDownload(file) {
       handleDownload(file) {

+ 5 - 1
ruoyi-ui/src/views/system/form/index.vue

@@ -302,6 +302,7 @@
              addbjectSave(this.forme).then(response => {
              addbjectSave(this.forme).then(response => {
                this.msgSuccess("保存成功");
                this.msgSuccess("保存成功");
                this.open = false;
                this.open = false;
+               this.$router.go(-1)
                // this.getList();
                // this.getList();
              });
              });
      },
      },
@@ -311,6 +312,7 @@
          // 提交
          // 提交
          tableSubimt(this.formeanti).then(response => {
          tableSubimt(this.formeanti).then(response => {
            this.msgSuccess("提交成功");
            this.msgSuccess("提交成功");
+           this.$router.go(-1)
            // this.open = false;
            // this.open = false;
            // this.getList();
            // this.getList();
          });
          });
@@ -318,6 +320,7 @@
          // 反提交
          // 反提交
          tableSubimtanit(this.formeanti).then(response => {
          tableSubimtanit(this.formeanti).then(response => {
            this.msgSuccess("反提交成功");
            this.msgSuccess("反提交成功");
+           this.$router.go(-1)
            // this.open = false;
            // this.open = false;
            // this.getList();
            // this.getList();
          });
          });
@@ -330,10 +333,11 @@
            cancelButtonText: "取消",
            cancelButtonText: "取消",
            type: "warning"
            type: "warning"
          }).then(function() {
          }).then(function() {
-           return delMenutab(index);
+           return delMenutabform(index);
          }).then(() => {
          }).then(() => {
            // this.getList();
            // this.getList();
            this.msgSuccess("删除成功");
            this.msgSuccess("删除成功");
+           this.$router.go(-1)
          })
          })
      }
      }
 
 

+ 3 - 3
ruoyi-ui/src/views/system/surface/index.vue

@@ -314,9 +314,9 @@
       line-height: 36px;
       line-height: 36px;
     }
     }
 
 
-    .el-form-item__content {
-      width: 55%;
-    }
+    // .el-form-item__content {
+    //   width: 55%;
+    // }
 
 
     .el-collapse {
     .el-collapse {
       border-top: 0;
       border-top: 0;

+ 4 - 0
ruoyi-ui/src/views/system/table/index.vue

@@ -218,6 +218,7 @@
               addbjectSave(this.forme).then(response => {
               addbjectSave(this.forme).then(response => {
                 this.msgSuccess("保存成功");
                 this.msgSuccess("保存成功");
                 this.open = false;
                 this.open = false;
+                this.$router.go(-1)
                 // this.getList();
                 // this.getList();
               });
               });
       },
       },
@@ -227,6 +228,7 @@
           // 提交
           // 提交
           tableSubimt(this.formeanti).then(response => {
           tableSubimt(this.formeanti).then(response => {
             this.msgSuccess("提交成功");
             this.msgSuccess("提交成功");
+            this.$router.go(-1)
             // this.open = false;
             // this.open = false;
             // this.getList();
             // this.getList();
           });
           });
@@ -234,6 +236,7 @@
           // 反提交
           // 反提交
           tableSubimtanit(this.formeanti).then(response => {
           tableSubimtanit(this.formeanti).then(response => {
             this.msgSuccess("反提交成功");
             this.msgSuccess("反提交成功");
+            this.$router.go(-1)
             // this.open = false;
             // this.open = false;
             // this.getList();
             // this.getList();
           });
           });
@@ -250,6 +253,7 @@
           }).then(() => {
           }).then(() => {
             // this.getList();
             // this.getList();
             this.msgSuccess("删除成功");
             this.msgSuccess("删除成功");
+            this.$router.go(-1)
           })
           })
       }
       }
     },
     },