From 3c574b45dc2451551bc603cb5cd269d2817f5618 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Sat, 1 Jun 2024 11:54:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=A1=A8=E5=8D=95=E5=B8=83=E5=B1=80=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/generator/domain/GenTable.java | 13 ++ .../ruoyi/generator/util/VelocityUtils.java | 38 ++++ .../mapper/generator/GenTableMapper.xml | 11 +- .../resources/templates/tool/gen/edit.html | 24 ++- .../src/main/resources/vm/html/add.html.vm | 168 ++++++++++-------- .../src/main/resources/vm/html/edit.html.vm | 167 +++++++++-------- .../src/main/resources/vm/xml/mapper.xml.vm | 2 + sql/{ry_20240529.sql => ry_20240601.sql} | 1 + 8 files changed, 271 insertions(+), 153 deletions(-) rename sql/{ry_20240529.sql => ry_20240601.sql} (99%) diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java index 2abb94fa1..756a57863 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java @@ -61,6 +61,9 @@ public class GenTable extends BaseEntity @NotBlank(message = "作者不能为空") private String functionAuthor; + /** 表单布局(单列 双列 三列) */ + private int formColNum; + /** 生成代码方式(0zip压缩包 1自定义路径) */ private String genType; @@ -215,6 +218,16 @@ public class GenTable extends BaseEntity this.functionAuthor = functionAuthor; } + public int getFormColNum() + { + return formColNum; + } + + public void setFormColNum(int formColNum) + { + this.formColNum = formColNum; + } + public String getGenType() { return genType; diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java index 2698e0b9f..f73290e30 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java @@ -50,6 +50,8 @@ public class VelocityUtils velocityContext.put("basePackage", getPackagePrefix(packageName)); velocityContext.put("packageName", packageName); velocityContext.put("author", genTable.getFunctionAuthor()); + velocityContext.put("colXsNum", getColXsNum(genTable.getFormColNum())); + velocityContext.put("colSmNum", getColSmNum(genTable.getFormColNum())); velocityContext.put("datetime", DateUtils.getDate()); velocityContext.put("pkColumn", genTable.getPkColumn()); velocityContext.put("importList", getImportList(genTable)); @@ -381,4 +383,40 @@ public class VelocityUtils } return num; } + + /** + * 获取表单排列网格 + * + * @param formColNum 表单布局方式 + * @return 排列类样式 + */ + public static String getColXsNum(int formColNum) + { + String colXsNum = "col-xs-12"; + if (formColNum == 2) + { + return "col-xs-6"; + } + else if (formColNum == 3) + { + return "col-xs-4"; + } + return colXsNum; + } + + /** + * 获取表单label网格 + * + * @param formColNum 表单布局方式 + * @return 网格类样式 + */ + public static String getColSmNum(int formColNum) + { + String colSmNum = "col-sm-3"; + if (formColNum == 2 || formColNum == 3) + { + return "col-sm-4"; + } + return colSmNum; + } } diff --git a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml index bc7cf5277..25fdafcb3 100644 --- a/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml +++ b/ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml @@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -54,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select table_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 from gen_table + select table_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, form_col_num, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table -
- - -
+ @@ -156,6 +156,18 @@ +
+
+ +
+ +
+ + +
+
+
+