Browse Source

fix 新增字段表中列数

Administrator 4 years ago
parent
commit
204e750612

+ 14 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/GenTable.java

@@ -194,6 +194,20 @@ public class GenTable extends BaseEntity
      */
     private Boolean isContainsBlob;
 
+    /**
+     * 列宽
+     */
+    private Integer tableColumn;
+
+
+    public Integer getTableColumn() {
+        return tableColumn;
+    }
+
+    public void setTableColumn(Integer tableColumn) {
+        this.tableColumn = tableColumn;
+    }
+
     public String getUpdateType() {
         return updateType;
     }

+ 1 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/constant/FormDataConstant.java

@@ -185,6 +185,7 @@ public class FormDataConstant {
     public static final String PATTERN = "pattern";
     public static final String BLUR = "blur";
     public static final String REQUIRED = "required";
+    public static final String TABLE_COLUMN = "table_column";
 
     /** 冒号 */
     public static final String COLON = ":";

+ 8 - 0
boman-modules/boman-gen/src/main/java/com/boman/gen/service/GenTableServiceImpl.java

@@ -452,6 +452,14 @@ public class GenTableServiceImpl implements IGenTableService {
     public AjaxResult insertGenTable(GenTable genTable) {
         String menuRole = genTable.getMenuRole();
         genTable.setMenuRole(menuRole.toUpperCase());
+
+        Integer tableColumn = genTable.getTableColumn();
+        if (tableColumn != null && tableColumn > 0){
+            //判断表单有几列 用24进行除法
+            int num = 24 / tableColumn;
+            genTable.setTableColumn(num);
+
+        }
         //新增表成功的时候,新增字段公共字段
         int i = genTableMapper.insertGenTable(genTable);
         if (i > 0) {

+ 9 - 5
boman-modules/boman-gen/src/main/resources/mapper/generator/GenTableMapper.xml

@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="filterConditions"         column="filter_conditions"            />
 		<result property="extendedAttributes"         column="extended_attributes"            />
 		<result property="tablePrimaryKey"         column="table_primary_key"            />
+		<result property="tableColumn"         column="table_column"            />
 		<collection  property="columns"  javaType="java.util.List"  resultMap="GenTableColumnResult" />
 	</resultMap>
 	
@@ -68,7 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<sql id="selectGenTableVo">
         select id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options,
-         create_by, create_time, update_by, update_time, remark, is_menu, menu_role, ak_column, dk_column, trigger_create, trigger_retrieve, trigger_update, trigger_delete, trigger_submit, real_table_name, filter_conditions, extended_attributes, table_primary_key from gen_table
+         create_by, create_time, update_by, update_time, remark, is_menu, menu_role, ak_column, dk_column, trigger_create, trigger_retrieve, trigger_update, trigger_delete, trigger_submit, real_table_name, filter_conditions, extended_attributes, table_primary_key, table_column from gen_table
     </sql>
     
     <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
@@ -122,7 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
-	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key,
+	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key, t.table_column,
 			   c.id as c_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
 		FROM gen_table t
 			 LEFT JOIN gen_table_column c ON t.id = c.table_id
@@ -130,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
-	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key,
+	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key, t.table_column,
 			   c.id as c_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
 		FROM gen_table t
 			 LEFT JOIN gen_table_column c ON t.id = c.table_id
@@ -138,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
-	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key,
+	    SELECT t.id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, t.is_menu, t.menu_role, t.ak_column, t.dk_column, t.trigger_create, t.trigger_retrieve, t.trigger_update, t.trigger_delete, t.trigger_submit, t.real_table_name, t.filter_conditions, t.extended_attributes, t.table_primary_key, t.table_column,
 			   c.id as c_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
 		FROM gen_table t
 			 LEFT JOIN gen_table_column c ON t.id = c.table_id
@@ -171,7 +172,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="realTableName != null and realTableName != ''">real_table_name,</if>
  			<if test="filterConditions != null and filterConditions != ''">filter_conditions,</if>
  			<if test="extendedAttributes != null and extendedAttributes != ''">extended_attributes,</if>
- 			<if test="tablePrimaryKey != null and tablePrimaryKey != ''">table_primary_key,,</if>
+ 			<if test="tablePrimaryKey != null and tablePrimaryKey != ''">table_primary_key,</if>
+ 			<if test="tableColumn != null"> table_column,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
 			create_time
          )values(
@@ -200,6 +202,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="filterConditions != null and filterConditions != ''">#{filterConditions},</if>
  			<if test="extendedAttributes != null and extendedAttributes != ''">#{extendedAttributes},</if>
  			<if test="tablePrimaryKey != null and tablePrimaryKey != ''">#{tablePrimaryKey},</if>
+ 			<if test="tableColumn != null">#{tableColumn},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
 			sysdate()
          )
@@ -237,6 +240,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="filterConditions != null and filterConditions !=''">filter_conditions = #{filterConditions},</if>
 			<if test="extendedAttributes != null and extendedAttributes !=''">extended_attributes = #{extendedAttributes},</if>
 			<if test="tablePrimaryKey != null and tablePrimaryKey !=''">table_primary_key = #{tablePrimaryKey},</if>
+			<if test="tableColumn != null">table_column = #{tableColumn},</if>
             update_time = sysdate()
         </set>
         where id = #{id}

+ 0 - 1
boman-modules/boman-system/src/main/java/com/boman/system/service/impl/SysScheduleServiceImpl.java

@@ -31,7 +31,6 @@ public class SysScheduleServiceImpl implements ISysScheduleService {
     @Override
     public List<JSONObject> setDay(List<JSONObject> result) {
         int num = 0;
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         for (JSONObject jsonObject : result) {
             num = 0;
             Set<Map.Entry<String, Object>> entries = jsonObject.entrySet();

+ 14 - 5
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -309,7 +309,7 @@ public class TableServiceCmdService {
         List<GenTableColumn> columns = genTable.getColumns();
         // id = -1时,查询该表单对应的字段名称
         if (ltZero(id)) {
-            return getByTableName(tableName, columns, isUi);
+            return getByTableName(genTable, isUi);
         }
 
         List<GenTableColumn> updateVisibleColumns = filterData(columns, 2, MaskConstant.UPDATE_VISIBLE::equals);
@@ -385,6 +385,10 @@ public class TableServiceCmdService {
         JSONObject result = new JSONObject();
         result.put(SHOW_DATA, parentColumns);
         result.put(BUTTON_LIST, getButton(tableName));
+        Integer tableColumn = genTable.getTableColumn();
+        if (tableColumn != null){
+            result.put(TABLE_COLUMN, tableColumn);
+        }
         return AjaxResult.success(result);
     }
 
@@ -624,7 +628,7 @@ public class TableServiceCmdService {
     /**
      * 判断是什么action
      *
-     * @param tableName 表
+     * @param tableName 表
      * @param action    动作
      * @return
      */
@@ -669,12 +673,13 @@ public class TableServiceCmdService {
     /**
      * 功能描述: 根据表名封装列的对应关系, 同时封装好字典值
      *
-     * @param tableName  tableName
-     * @param allColumns allColumns
+     * @param genTable genTable
      * @param isUi       带折叠true, 不带折叠false
      * @return com.boman.common.core.web.domain.AjaxResult
      */
-    public AjaxResult getByTableName(String tableName, List<GenTableColumn> allColumns, Boolean isUi) {
+    public AjaxResult getByTableName(GenTable genTable, Boolean isUi) {
+        String tableName = genTable.getTableName();
+        List<GenTableColumn> allColumns = genTable.getColumns();
         List<GenTableColumn> resultCols;
         List<GenTableColumn> parentColumns = filterHrAndSort(allColumns);
         // 所有新增可见的列
@@ -707,6 +712,10 @@ public class TableServiceCmdService {
         result.put(BUTTON_LIST, getButton(tableName));
         result.put(SHOW_DATA, resultCols);
         result.put(RULES, packRequireColumn(allColumns));
+        Integer tableColumn = genTable.getTableColumn();
+        if (tableColumn != null){
+            result.put(TABLE_COLUMN,tableColumn);
+        }
         return AjaxResult.success(result);
     }