Browse Source

代码生成支持表单布局选项

pull/495/head
RuoYi 6 months ago
parent
commit
3c574b45dc
  1. 13
      ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java
  2. 38
      ruoyi-generator/src/main/java/com/ruoyi/generator/util/VelocityUtils.java
  3. 11
      ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
  4. 24
      ruoyi-generator/src/main/resources/templates/tool/gen/edit.html
  5. 168
      ruoyi-generator/src/main/resources/vm/html/add.html.vm
  6. 167
      ruoyi-generator/src/main/resources/vm/html/edit.html.vm
  7. 2
      ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm
  8. 1
      sql/ry_20240601.sql

13
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;

38
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;
}
}

11
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml

@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="businessName" column="business_name" />
<result property="functionName" column="function_name" />
<result property="functionAuthor" column="function_author" />
<result property="formColNum" column="form_col_num" />
<result property="genType" column="gen_type" />
<result property="genPath" column="gen_path" />
<result property="options" column="options" />
@ -54,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectGenTableVo">
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
</sql>
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
@ -99,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
SELECT t.table_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,
SELECT t.table_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.form_col_num, t.gen_type, t.gen_path, t.options, t.remark,
c.column_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.table_id = c.table_id
@ -107,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
SELECT t.table_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,
SELECT t.table_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.form_col_num, t.gen_type, t.gen_path, t.options, t.remark,
c.column_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.table_id = c.table_id
@ -115,7 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
SELECT t.table_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,
SELECT t.table_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.form_col_num, t.gen_type, t.gen_path, t.options, t.remark,
c.column_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.table_id = c.table_id
@ -133,6 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="businessName != null and businessName != ''">business_name,</if>
<if test="functionName != null and functionName != ''">function_name,</if>
<if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
<if test="formColNum != null and formColNum != ''">form_col_num,</if>
<if test="genType != null and genType != ''">gen_type,</if>
<if test="genPath != null and genPath != ''">gen_path,</if>
<if test="remark != null and remark != ''">remark,</if>
@ -169,6 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</if>
<if test="className != null and className != ''">class_name = #{className},</if>
<if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if>
<if test="formColNum != null">form_col_num = #{formColNum},</if>
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
<if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>

24
ruoyi-generator/src/main/resources/templates/tool/gen/edit.html

@ -135,13 +135,13 @@
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="分配到指定菜单下,例如 系统管理">上级菜单<i class="fa fa-question-circle-o"></i></label>
<label class="col-sm-4 control-label is-required" title="选择表单的栅格布局方式">表单布局<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input id="parentMenuId" name="params[parentMenuId]" type="hidden" th:value="*{parentMenuId}"/>
<div class="input-group">
<input id="parentMenuName" name="params[parentMenuName]" class="form-control" type="text" onclick="selectMenuTree()" placeholder="请选择上级菜单" maxlength="50" th:value="*{parentMenuName}" required>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
<select class='form-control' id="formColNum" name='formColNum' style="width: 100%">
<option value="1" th:field="*{formColNum}">单列</option>
<option value="2" th:field="*{formColNum}">双列</option>
<option value="3" th:field="*{formColNum}">三列</option>
</select>
</div>
</div>
</div>
@ -156,6 +156,18 @@
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="分配到指定菜单下,例如 系统管理">上级菜单:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input id="parentMenuId" name="params[parentMenuId]" type="hidden" th:value="*{parentMenuId}"/>
<div class="input-group">
<input id="parentMenuName" name="params[parentMenuName]" class="form-control" type="text" onclick="selectMenuTree()" placeholder="请选择上级菜单" maxlength="50" th:value="*{parentMenuName}" required>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="hidden row" id="pathinfo">
<div class="col-sm-12">

168
ruoyi-generator/src/main/resources/vm/html/add.html.vm

@ -39,117 +39,141 @@
#end
#set($dictType=$column.dictType)
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="input-group">
#set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)})
#set($treeId = "${className}?.${treeCode}")
<input id="treeId" name="${treeParentCode}" type="hidden" th:value="${${treeId}}"/>
<input class="form-control" type="text" onclick="select${BusinessName}Tree()" id="treeName" readonly="true" th:value="${${treeName}}"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
<input id="treeId" name="${treeParentCode}" type="hidden" th:value="${${treeId}}"/>
<input class="form-control" type="text" onclick="select${BusinessName}Tree()" id="treeName" readonly="true" th:value="${${treeName}}"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
#elseif($column.htmlType == "input")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input name="${field}" class="form-control" type="text"#if($column.required) required#end>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input name="${field}" class="form-control" type="text"#if($column.required) required#end>
</div>
</div>
</div>
#elseif($column.htmlType == "upload")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input type="hidden" name="${field}">
<div class="file-loading">
<input class="form-control file-upload" id="${field}" name="file" type="file">
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input type="hidden" name="${field}">
<div class="file-loading">
<input class="form-control file-upload" id="${field}" name="file" type="file">
</div>
</div>
</div>
</div>
#elseif($column.htmlType == "summernote")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input type="hidden" class="form-control" name="${field}">
<div class="summernote" id="${field}"></div>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input type="hidden" class="form-control" name="${field}">
<div class="summernote" id="${field}"></div>
</div>
</div>
</div>
#elseif($column.htmlType == "select" && "" != $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<select name="${field}" class="form-control m-b" th:with="type=${@dict.getType('${dictType}')}"#if($column.required) required#end>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<select name="${field}" class="form-control" th:with="type=${@dict.getType('${dictType}')}"#if($column.required) required#end>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
#elseif($column.htmlType == "select" && $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<select name="${field}" class="form-control m-b"#if($column.required) required#end>
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<select name="${field}" class="form-control"#if($column.required) required#end>
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
</div>
#elseif($column.htmlType == "checkbox" && "" != $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8" th:with="type=${@dict.getType('${dictType}')}">
<label th:each="dict : ${type}" class="check-box">
<input name="${field}" type="checkbox" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"#if($column.required) required#end>
</label>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8" th:with="type=${@dict.getType('${dictType}')}">
<label th:each="dict : ${type}" class="check-box">
<input name="${field}" type="checkbox" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"#if($column.required) required#end>
</label>
</div>
</div>
</div>
#elseif($column.htmlType == "checkbox" && $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<label class="check-box">
<input name="${field}" type="checkbox"#if($column.required) required#end> 无
</label>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<label class="check-box">
<input name="${field}" type="checkbox"#if($column.required) required#end> 无
</label>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
</div>
#elseif($column.htmlType == "radio" && "" != $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('${dictType}')}">
<input type="radio" th:id="${'${field}_' + dict.dictCode}" name="${field}" th:value="${dict.dictValue}" th:checked="${dict.default}"#if($column.required) required#end>
<label th:for="${'${field}_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('${dictType}')}">
<input type="radio" th:id="${'${field}_' + dict.dictCode}" name="${field}" th:value="${dict.dictValue}" th:checked="${dict.default}"#if($column.required) required#end>
<label th:for="${'${field}_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</div>
#elseif($column.htmlType == "radio" && $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box">
<input type="radio" name="${field}" value=""#if($column.required) required#end>
<label th:for="${field}" th:text="未知"></label>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box">
<input type="radio" name="${field}" value=""#if($column.required) required#end>
<label th:for="${field}" th:text="未知"></label>
</div>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
#elseif($column.htmlType == "datetime")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="${field}" class="form-control" placeholder="yyyy-MM-dd" type="text"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="${field}" class="form-control" placeholder="yyyy-MM-dd" type="text"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</div>
#elseif($column.htmlType == "textarea")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<textarea name="${field}" class="form-control"#if($column.required) required#end></textarea>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<textarea name="${field}" class="form-control"#if($column.required) required#end></textarea>
</div>
</div>
</div>
#end
@ -159,7 +183,7 @@
#if($table.sub)
<h4 class="form-header h4">${subTable.functionName}信息</h4>
<div class="row">
<div class="col-sm-12">
<div class="col-xs-12">
<button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>
<button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>
<div class="col-sm-12 select-table table-striped">

167
ruoyi-generator/src/main/resources/vm/html/edit.html.vm

@ -40,116 +40,141 @@
#set($field=$column.javaField)
#set($dictType=$column.dictType)
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="input-group">
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="input-group">
#set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)})
<input id="treeId" name="${treeParentCode}" type="hidden" th:field="*{${treeParentCode}}" />
<input class="form-control" type="text" onclick="select${BusinessName}Tree()" id="treeName" readonly="true" th:field="*{parentName}"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
<input id="treeId" name="${treeParentCode}" type="hidden" th:field="*{${treeParentCode}}" />
<input class="form-control" type="text" onclick="select${BusinessName}Tree()" id="treeName" readonly="true" th:field="*{parentName}"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
#elseif($column.htmlType == "input")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input name="${field}" th:field="*{${field}}" class="form-control" type="text"#if($column.required) required#end>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input name="${field}" th:field="*{${field}}" class="form-control" type="text"#if($column.required) required#end>
</div>
</div>
</div>
#elseif($column.htmlType == "upload")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input type="hidden" name="${field}" th:field="*{${field}}">
<div class="file-loading">
<input class="form-control file-upload" id="${field}" name="file" type="file">
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input type="hidden" name="${field}" th:field="*{${field}}">
<div class="file-loading">
<input class="form-control file-upload" id="${field}" name="file" type="file">
</div>
</div>
</div>
</div>
#elseif($column.htmlType == "summernote")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input type="hidden" class="form-control" th:field="*{${field}}">
<div class="summernote" id="${field}"></div>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<input type="hidden" class="form-control" th:field="*{${field}}">
<div class="summernote" id="${field}"></div>
</div>
</div>
</div>
#elseif($column.htmlType == "select" && "" != $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<select name="${field}" class="form-control m-b" th:with="type=${@dict.getType('${dictType}')}"#if($column.required) required#end>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{${field}}"></option>
</select>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<select name="${field}" class="form-control" th:with="type=${@dict.getType('${dictType}')}"#if($column.required) required#end>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{${field}}"></option>
</select>
</div>
</div>
</div>
#elseif($column.htmlType == "select" && $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<select name="${field}" class="form-control m-b"#if($column.required) required#end>
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<select name="${field}" class="form-control"#if($column.required) required#end>
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
</div>
</div>
#elseif($column.htmlType == "checkbox" && "" != $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8" th:with="type=${@dict.getType('${dictType}')}">
<label th:each="dict : ${type}" class="check-box">
<input name="${field}" type="checkbox" th:value="${dict.dictValue}" th:text="${dict.dictLabel}" th:attr="checked=${${className}.${field}.contains(dict.dictValue)?true:false}"#if($column.required) required#end>
</label>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8" th:with="type=${@dict.getType('${dictType}')}">
<label th:each="dict : ${type}" class="check-box">
<input name="${field}" type="checkbox" th:value="${dict.dictValue}" th:text="${dict.dictLabel}" th:attr="checked=${${className}.${field}.contains(dict.dictValue)?true:false}"#if($column.required) required#end>
</label>
</div>
</div>
</div>
#elseif($column.htmlType == "checkbox" && $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<label class="check-box">
<input name="${field}" type="checkbox"#if($column.required) required#end> 无
</label>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<label class="check-box">
<input name="${field}" type="checkbox"#if($column.required) required#end> 无
</label>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
</div>
#elseif($column.htmlType == "radio" && "" != $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('${dictType}')}">
<input type="radio" th:id="${'${field}_' + dict.dictCode}" name="${field}" th:value="${dict.dictValue}" th:field="*{${field}}"#if($column.required) required#end>
<label th:for="${'${field}_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('${dictType}')}">
<input type="radio" th:id="${'${field}_' + dict.dictCode}" name="${field}" th:value="${dict.dictValue}" th:field="*{${field}}"#if($column.required) required#end>
<label th:for="${'${field}_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</div>
#elseif($column.htmlType == "radio" && $dictType)
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box">
<input type="radio" name="${field}" value=""#if($column.required) required#end>
<label th:for="${field}" th:text="未知"></label>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="radio-box">
<input type="radio" name="${field}" value=""#if($column.required) required#end>
<label th:for="${field}" th:text="未知"></label>
</div>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
#elseif($column.htmlType == "datetime")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="${field}" th:value="${#dates.format(${className}.${field}, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="${field}" th:value="${#dates.format(${className}.${field}, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"#if($column.required) required#end>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</div>
#elseif($column.htmlType == "textarea")
<div class="form-group">
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<textarea name="${field}" class="form-control"#if($column.required) required#end>[[*{${field}}]]</textarea>
<div class="${colXsNum}">
<div class="form-group">
<label class="${colSmNum} control-label#if($column.required) is-required#end">${comment}:</label>
<div class="col-sm-8">
<textarea name="${field}" class="form-control"#if($column.required) required#end>[[*{${field}}]]</textarea>
</div>
</div>
</div>
#end

2
ruoyi-generator/src/main/resources/vm/xml/mapper.xml.vm

@ -80,12 +80,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#end
</select>
#if($table.sub)
<select id="select${subClassName}List" resultType="${subClassName}" resultMap="${subClassName}Result">
select#foreach ($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end
from ${subTableName}
where ${subTableFkName} = #{${subTableFkName}}
</select>
#end
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
insert into ${tableName}
<trim prefix="(" suffix=")" suffixOverrides=",">

1
sql/ry_20240529.sql → sql/ry_20240601.sql

@ -678,6 +678,7 @@ create table gen_table (
business_name varchar(30) comment '生成业务名',
function_name varchar(50) comment '生成功能名',
function_author varchar(50) comment '生成功能作者',
form_col_num int(1) default 0 comment '表单布局(单列 双列 三列)',
gen_type char(1) default '0' comment '生成代码方式(0zip压缩包 1自定义路径)',
gen_path varchar(200) default '/' comment '生成路径(不填默认项目路径)',
options varchar(1000) comment '其它生成选项',
Loading…
Cancel
Save