本次提交 生成代码模块 只读 默认字段
This commit is contained in:
parent
da030fca43
commit
75b5b5a6e1
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="renderer" content="webkit">
|
<meta name="renderer" content="webkit">
|
||||||
<title>若依系统首页</title>
|
<title>yds系统首页</title>
|
||||||
<!-- 避免IE使用兼容模式 -->
|
<!-- 避免IE使用兼容模式 -->
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<link th:href="@{favicon.ico}" rel="shortcut icon"/>
|
<link th:href="@{favicon.ico}" rel="shortcut icon"/>
|
||||||
|
|
|
||||||
|
|
@ -1,125 +1,85 @@
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
<head>
|
<head>
|
||||||
<th:block th:include="include :: header('新增经济类型')" />
|
<th:block th:include="include :: header('新增经济类型')" />
|
||||||
<th:block th:include="include :: datetimepicker-css" />
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
|
||||||
<th:block th:include="include :: jasny-bootstrap-css" />
|
|
||||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
.col-md-6 {
|
|
||||||
position: static;
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="white-bg">
|
<body class="white-bg">
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-econtype-add">
|
<form class="form-horizontal m" id="form-econtype-add">
|
||||||
|
|
||||||
<div class="col-md-6" background="red">
|
<fieldset>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label is-required">名称:</label>
|
|
||||||
<div class="col-sm-8">
|
<label class="col-sm-2 control-label is-required">名称:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
<input name="econName" class="form-control" type="text" required>
|
<input name="econName" class="form-control" type="text" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label is-required">单据号:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<input name="docNum" class="form-control" readonly="readonly" type="text" required>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label is-required">资料状态:</label>
|
|
||||||
<div class="col-sm-8">
|
<label class="col-sm-2 control-label is-required">资料状态:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
<div class="radio-box" th:each="dict : ${@dict.getType('platf_doc_statu')}">
|
<div class="radio-box" th:each="dict : ${@dict.getType('platf_doc_statu')}">
|
||||||
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
|
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
|
||||||
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label is-required">制单时间:</label>
|
<label class="col-sm-2 control-label">备注:</label>
|
||||||
<div class="col-sm-8">
|
|
||||||
<div class="input-group date">
|
|
||||||
<input name="createTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
|
|
||||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">修改时间:</label>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<div class="input-group date">
|
|
||||||
<input name="updateTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
|
||||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-md-6" background="yellow">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label is-required">单据号:</label>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input name="docNum" class="form-control" type="text" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">备注:</label>
|
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<textarea name="remark" class="form-control"></textarea>
|
<textarea name="remark" class="form-control"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label is-required">制单人:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<input name="createBy" class="form-control" readonly="readonly" type="text" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label is-required">制单时间:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<div class="input-group date">
|
||||||
|
<input name="createTime" class="form-control" placeholder="yyyy-MM-dd" readonly="readonly" type="text" required>
|
||||||
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label is-required">制单人:</label>
|
|
||||||
<div class="col-sm-8">
|
<label class="col-sm-2 control-label">修改人:</label>
|
||||||
<input name="createBy" class="form-control" type="text" required>
|
<div class="col-sm-3">
|
||||||
</div>
|
<input name="updateBy" class="form-control" readonly="readonly" type="text">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label">修改时间:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<div class="input-group date">
|
||||||
|
<input name="updateTime" class="form-control" placeholder="yyyy-MM-dd" readonly="readonly" type="text">
|
||||||
<div class="form-group">
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||||
<label class="col-sm-3 control-label">修改人:</label>
|
|
||||||
<div class="col-sm-8">
|
|
||||||
<input name="updateBy" class="form-control" type="text">
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -8,48 +8,67 @@
|
||||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
<form class="form-horizontal m" id="form-econtype-edit" th:object="${econType}">
|
<form class="form-horizontal m" id="form-econtype-edit" th:object="${econType}">
|
||||||
<input name="econId" th:field="*{econId}" type="hidden">
|
<input name="econId" th:field="*{econId}" type="hidden">
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label is-required">名称:</label>
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<label class="col-sm-4 control-label is-required">名称:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input name="econName" th:field="*{econName}" class="form-control" type="text" required>
|
<input name="econName" class="form-control" readonly="false" type="text" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label is-required">单据号:</label>
|
<label class="col-sm-4 control-label is-required">单据号:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input name="docNum" th:field="*{docNum}" class="form-control" type="text" required>
|
<input name="docNum" class="form-control" readonly="true" type="text" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label class="col-sm-3 control-label is-required">资料状态:</label>
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<label class="col-sm-4 control-label is-required">资料状态:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="radio-box" th:each="dict : ${@dict.getType('platf_doc_statu')}">
|
<div class="radio-box" th:each="dict : ${@dict.getType('platf_doc_statu')}">
|
||||||
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}" required>
|
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
|
||||||
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">备注:</label>
|
<label class="col-sm-4 control-label">备注_4:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
|
<textarea name="remark" class="form-control"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
</div>
|
||||||
<label class="col-sm-3 control-label">修改人:</label>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<label class="col-sm-4 control-label">修改人:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input name="updateBy" th:field="*{updateBy}" class="form-control" type="text">
|
<input name="updateBy" class="form-control" readonly="true" type="text">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-3 control-label">修改时间:</label>
|
<label class="col-sm-4 control-label">修改时间:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="input-group date">
|
<div class="input-group date">
|
||||||
<input name="updateTime" th:value="${#dates.format(econType.updateTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
<input name="updateTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: footer" />
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,11 @@ public class GenConstants
|
||||||
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
|
public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer",
|
||||||
"bit", "bigint", "float", "double", "decimal" };
|
"bit", "bigint", "float", "double", "decimal" };
|
||||||
|
|
||||||
|
/** 页面上 默认只读的字段 */
|
||||||
|
public static final String[] COLUMNNAME_INI_READONLY = { "doc_num", "create_by", "create_time", "update_by", "update_time", "del_flag" };
|
||||||
|
|
||||||
/** 页面不需要编辑字段 */
|
/** 页面不需要编辑字段 */
|
||||||
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" };
|
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "update_by", "update_time", "del_flag" };
|
||||||
|
|
||||||
/** 页面不需要显示的列表字段 */
|
/** 页面不需要显示的列表字段 */
|
||||||
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
|
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by",
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,9 @@ public class GenTable extends BaseEntity
|
||||||
/** 生成代码方式(0zip压缩包 1自定义路径) */
|
/** 生成代码方式(0zip压缩包 1自定义路径) */
|
||||||
private String genType;
|
private String genType;
|
||||||
|
|
||||||
|
/** 界面上form的列数 1一列,2二列,3三列 4四列 */
|
||||||
|
private String formCols;
|
||||||
|
|
||||||
/** 生成路径(不填默认项目路径) */
|
/** 生成路径(不填默认项目路径) */
|
||||||
private String genPath;
|
private String genPath;
|
||||||
|
|
||||||
|
|
@ -225,6 +228,16 @@ public class GenTable extends BaseEntity
|
||||||
this.genType = genType;
|
this.genType = genType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFormCols()
|
||||||
|
{
|
||||||
|
return formCols;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormCols(String formCols)
|
||||||
|
{
|
||||||
|
this.formCols = formCols;
|
||||||
|
}
|
||||||
|
|
||||||
public String getGenPath()
|
public String getGenPath()
|
||||||
{
|
{
|
||||||
return genPath;
|
return genPath;
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,9 @@ public class GenTableColumn extends BaseEntity
|
||||||
/** 是否编辑字段(1是) */
|
/** 是否编辑字段(1是) */
|
||||||
private String isEdit;
|
private String isEdit;
|
||||||
|
|
||||||
|
/** 是否 只读字段(1是) */
|
||||||
|
private String isReadonly;
|
||||||
|
|
||||||
/** 是否列表字段(1是) */
|
/** 是否列表字段(1是) */
|
||||||
private String isList;
|
private String isList;
|
||||||
|
|
||||||
|
|
@ -222,6 +225,25 @@ public class GenTableColumn extends BaseEntity
|
||||||
{
|
{
|
||||||
return isInsert != null && StringUtils.equals("1", isInsert);
|
return isInsert != null && StringUtils.equals("1", isInsert);
|
||||||
}
|
}
|
||||||
|
public void setIsReadonly(String isReadonly)
|
||||||
|
{
|
||||||
|
this.isReadonly = isReadonly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsReadonly()
|
||||||
|
{
|
||||||
|
return isReadonly;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReadonly()
|
||||||
|
{
|
||||||
|
return isReadonly(this.isReadonly);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isReadonly(String isReadonly)
|
||||||
|
{
|
||||||
|
return isReadonly != null && StringUtils.equals("1", isReadonly);
|
||||||
|
}
|
||||||
|
|
||||||
public void setIsEdit(String isEdit)
|
public void setIsEdit(String isEdit)
|
||||||
{
|
{
|
||||||
|
|
@ -332,7 +354,7 @@ public class GenTableColumn extends BaseEntity
|
||||||
{
|
{
|
||||||
return StringUtils.equalsAnyIgnoreCase(javaField,
|
return StringUtils.equalsAnyIgnoreCase(javaField,
|
||||||
// BaseEntity
|
// BaseEntity
|
||||||
"remark",
|
"remark","delFlag",
|
||||||
// TreeEntity
|
// TreeEntity
|
||||||
"parentName", "parentId", "orderNum", "ancestors");
|
"parentName", "parentId", "orderNum", "ancestors");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -354,6 +354,15 @@ public class GenTableServiceImpl implements IGenTableService
|
||||||
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
List<String> templates = VelocityUtils.getTemplateList(table.getTplCategory());
|
||||||
for (String template : templates)
|
for (String template : templates)
|
||||||
{
|
{
|
||||||
|
// form 2列
|
||||||
|
if (table.getFormCols().equals("2") ) {
|
||||||
|
if ( template.contains("add.html.vm") ) {
|
||||||
|
template = "vm/html/col2/add.html.vm";
|
||||||
|
} else if ( template.contains("edit.html.vm") ) {
|
||||||
|
template = "vm/html/col2/edit.html.vm";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 渲染模板
|
// 渲染模板
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
Template tpl = Velocity.getTemplate(template, Constants.UTF8);
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,15 @@ public class GenUtils
|
||||||
{
|
{
|
||||||
column.setIsEdit(GenConstants.REQUIRE);
|
column.setIsEdit(GenConstants.REQUIRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 只读字段
|
||||||
|
if ( arraysContains(GenConstants.COLUMNNAME_INI_READONLY, columnName) )
|
||||||
|
{
|
||||||
|
column.setIsReadonly("1");
|
||||||
|
} else {
|
||||||
|
column.setIsReadonly("0");
|
||||||
|
}
|
||||||
|
|
||||||
// 列表字段
|
// 列表字段
|
||||||
if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk())
|
if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk())
|
||||||
{
|
{
|
||||||
|
|
@ -98,6 +107,16 @@ public class GenUtils
|
||||||
column.setIsQuery(GenConstants.REQUIRE);
|
column.setIsQuery(GenConstants.REQUIRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置自定义编号 所有的选项都为0
|
||||||
|
if ( columnName.contains("_custom_num") ){
|
||||||
|
column.setIsInsert("0");
|
||||||
|
column.setIsEdit("0");
|
||||||
|
column.setIsQuery("0");
|
||||||
|
column.setIsList("0");
|
||||||
|
column.setIsRequired("0");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 查询字段类型
|
// 查询字段类型
|
||||||
if (StringUtils.endsWithIgnoreCase(columnName, "name"))
|
if (StringUtils.endsWithIgnoreCase(columnName, "name"))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.ruoyi.generator.util;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.velocity.VelocityContext;
|
import org.apache.velocity.VelocityContext;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ruoyi.common.constant.GenConstants;
|
import com.ruoyi.common.constant.GenConstants;
|
||||||
|
|
@ -12,18 +13,25 @@ import com.ruoyi.generator.config.GenConfig;
|
||||||
import com.ruoyi.generator.domain.GenTable;
|
import com.ruoyi.generator.domain.GenTable;
|
||||||
import com.ruoyi.generator.domain.GenTableColumn;
|
import com.ruoyi.generator.domain.GenTableColumn;
|
||||||
|
|
||||||
public class VelocityUtils
|
public class VelocityUtils {
|
||||||
{
|
/**
|
||||||
/** 项目空间路径 */
|
* 项目空间路径
|
||||||
|
*/
|
||||||
private static final String PROJECT_PATH = "main/java";
|
private static final String PROJECT_PATH = "main/java";
|
||||||
|
|
||||||
/** mybatis空间路径 */
|
/**
|
||||||
|
* mybatis空间路径
|
||||||
|
*/
|
||||||
private static final String MYBATIS_PATH = "main/resources/mapper";
|
private static final String MYBATIS_PATH = "main/resources/mapper";
|
||||||
|
|
||||||
/** html空间路径 */
|
/**
|
||||||
|
* html空间路径
|
||||||
|
*/
|
||||||
private static final String TEMPLATES_PATH = "main/resources/templates";
|
private static final String TEMPLATES_PATH = "main/resources/templates";
|
||||||
|
|
||||||
/** 默认上级菜单,系统工具 */
|
/**
|
||||||
|
* 默认上级菜单,系统工具
|
||||||
|
*/
|
||||||
private static final String DEFAULT_PARENT_MENU_ID = "3";
|
private static final String DEFAULT_PARENT_MENU_ID = "3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -31,8 +39,7 @@ public class VelocityUtils
|
||||||
*
|
*
|
||||||
* @return 模板列表
|
* @return 模板列表
|
||||||
*/
|
*/
|
||||||
public static VelocityContext prepareContext(GenTable genTable)
|
public static VelocityContext prepareContext(GenTable genTable) {
|
||||||
{
|
|
||||||
String moduleName = genTable.getModuleName();
|
String moduleName = genTable.getModuleName();
|
||||||
String businessName = genTable.getBusinessName();
|
String businessName = genTable.getBusinessName();
|
||||||
String packageName = genTable.getPackageName();
|
String packageName = genTable.getPackageName();
|
||||||
|
|
@ -62,34 +69,31 @@ public class VelocityUtils
|
||||||
if (tcolumn.isInsert() && !tcolumn.isPk())
|
if (tcolumn.isInsert() && !tcolumn.isPk())
|
||||||
if (tcolumn.isUsableColumn() || !tcolumn.isSuperColumn())
|
if (tcolumn.isUsableColumn() || !tcolumn.isSuperColumn())
|
||||||
effectivecols.add(tcolumn);
|
effectivecols.add(tcolumn);
|
||||||
} ;
|
}
|
||||||
|
;
|
||||||
|
|
||||||
velocityContext.put("effectivecols", effectivecols);
|
velocityContext.put("effectivecols", effectivecols);
|
||||||
velocityContext.put("columns", genTable.getColumns());
|
velocityContext.put("columns", genTable.getColumns());
|
||||||
|
|
||||||
velocityContext.put("table", genTable);
|
velocityContext.put("table", genTable);
|
||||||
setMenuVelocityContext(velocityContext, genTable);
|
setMenuVelocityContext(velocityContext, genTable);
|
||||||
if (GenConstants.TPL_TREE.equals(tplCategory))
|
if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
||||||
{
|
|
||||||
setTreeVelocityContext(velocityContext, genTable);
|
setTreeVelocityContext(velocityContext, genTable);
|
||||||
}
|
}
|
||||||
if (GenConstants.TPL_SUB.equals(tplCategory))
|
if (GenConstants.TPL_SUB.equals(tplCategory)) {
|
||||||
{
|
|
||||||
setSubVelocityContext(velocityContext, genTable);
|
setSubVelocityContext(velocityContext, genTable);
|
||||||
}
|
}
|
||||||
return velocityContext;
|
return velocityContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setMenuVelocityContext(VelocityContext context, GenTable genTable)
|
public static void setMenuVelocityContext(VelocityContext context, GenTable genTable) {
|
||||||
{
|
|
||||||
String options = genTable.getOptions();
|
String options = genTable.getOptions();
|
||||||
JSONObject paramsObj = JSONObject.parseObject(options);
|
JSONObject paramsObj = JSONObject.parseObject(options);
|
||||||
String parentMenuId = getParentMenuId(paramsObj);
|
String parentMenuId = getParentMenuId(paramsObj);
|
||||||
context.put("parentMenuId", parentMenuId);
|
context.put("parentMenuId", parentMenuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setTreeVelocityContext(VelocityContext context, GenTable genTable)
|
public static void setTreeVelocityContext(VelocityContext context, GenTable genTable) {
|
||||||
{
|
|
||||||
String options = genTable.getOptions();
|
String options = genTable.getOptions();
|
||||||
JSONObject paramsObj = JSONObject.parseObject(options);
|
JSONObject paramsObj = JSONObject.parseObject(options);
|
||||||
String treeCode = getTreecode(paramsObj);
|
String treeCode = getTreecode(paramsObj);
|
||||||
|
|
@ -100,18 +104,15 @@ public class VelocityUtils
|
||||||
context.put("treeParentCode", treeParentCode);
|
context.put("treeParentCode", treeParentCode);
|
||||||
context.put("treeName", treeName);
|
context.put("treeName", treeName);
|
||||||
context.put("expandColumn", getExpandColumn(genTable));
|
context.put("expandColumn", getExpandColumn(genTable));
|
||||||
if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE))
|
if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) {
|
||||||
{
|
|
||||||
context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE));
|
context.put("tree_parent_code", paramsObj.getString(GenConstants.TREE_PARENT_CODE));
|
||||||
}
|
}
|
||||||
if (paramsObj.containsKey(GenConstants.TREE_NAME))
|
if (paramsObj.containsKey(GenConstants.TREE_NAME)) {
|
||||||
{
|
|
||||||
context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME));
|
context.put("tree_name", paramsObj.getString(GenConstants.TREE_NAME));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSubVelocityContext(VelocityContext context, GenTable genTable)
|
public static void setSubVelocityContext(VelocityContext context, GenTable genTable) {
|
||||||
{
|
|
||||||
GenTable subTable = genTable.getSubTable();
|
GenTable subTable = genTable.getSubTable();
|
||||||
String subTableName = genTable.getSubTableName();
|
String subTableName = genTable.getSubTableName();
|
||||||
String subTableFkName = genTable.getSubTableFkName();
|
String subTableFkName = genTable.getSubTableFkName();
|
||||||
|
|
@ -133,8 +134,7 @@ public class VelocityUtils
|
||||||
*
|
*
|
||||||
* @return 模板列表
|
* @return 模板列表
|
||||||
*/
|
*/
|
||||||
public static List<String> getTemplateList(String tplCategory)
|
public static List<String> getTemplateList(String tplCategory) {
|
||||||
{
|
|
||||||
List<String> templates = new ArrayList<String>();
|
List<String> templates = new ArrayList<String>();
|
||||||
templates.add("vm/java/domain.java.vm");
|
templates.add("vm/java/domain.java.vm");
|
||||||
templates.add("vm/java/mapper.java.vm");
|
templates.add("vm/java/mapper.java.vm");
|
||||||
|
|
@ -142,17 +142,12 @@ public class VelocityUtils
|
||||||
templates.add("vm/java/serviceImpl.java.vm");
|
templates.add("vm/java/serviceImpl.java.vm");
|
||||||
templates.add("vm/java/controller.java.vm");
|
templates.add("vm/java/controller.java.vm");
|
||||||
templates.add("vm/xml/mapper.xml.vm");
|
templates.add("vm/xml/mapper.xml.vm");
|
||||||
if (GenConstants.TPL_CRUD.equals(tplCategory))
|
if (GenConstants.TPL_CRUD.equals(tplCategory)) {
|
||||||
{
|
|
||||||
templates.add("vm/html/list.html.vm");
|
templates.add("vm/html/list.html.vm");
|
||||||
}
|
} else if (GenConstants.TPL_TREE.equals(tplCategory)) {
|
||||||
else if (GenConstants.TPL_TREE.equals(tplCategory))
|
|
||||||
{
|
|
||||||
templates.add("vm/html/tree.html.vm");
|
templates.add("vm/html/tree.html.vm");
|
||||||
templates.add("vm/html/list-tree.html.vm");
|
templates.add("vm/html/list-tree.html.vm");
|
||||||
}
|
} else if (GenConstants.TPL_SUB.equals(tplCategory)) {
|
||||||
else if (GenConstants.TPL_SUB.equals(tplCategory))
|
|
||||||
{
|
|
||||||
templates.add("vm/html/list.html.vm");
|
templates.add("vm/html/list.html.vm");
|
||||||
templates.add("vm/java/sub-domain.java.vm");
|
templates.add("vm/java/sub-domain.java.vm");
|
||||||
}
|
}
|
||||||
|
|
@ -165,8 +160,7 @@ public class VelocityUtils
|
||||||
/**
|
/**
|
||||||
* 获取文件名
|
* 获取文件名
|
||||||
*/
|
*/
|
||||||
public static String getFileName(String template, GenTable genTable)
|
public static String getFileName(String template, GenTable genTable) {
|
||||||
{
|
|
||||||
// 文件名称
|
// 文件名称
|
||||||
String fileName = "";
|
String fileName = "";
|
||||||
// 包路径
|
// 包路径
|
||||||
|
|
@ -182,56 +176,32 @@ public class VelocityUtils
|
||||||
String mybatisPath = MYBATIS_PATH + "/" + moduleName;
|
String mybatisPath = MYBATIS_PATH + "/" + moduleName;
|
||||||
String htmlPath = TEMPLATES_PATH + "/" + moduleName + "/" + businessName;
|
String htmlPath = TEMPLATES_PATH + "/" + moduleName + "/" + businessName;
|
||||||
|
|
||||||
if (template.contains("domain.java.vm"))
|
if (template.contains("domain.java.vm")) {
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
fileName = StringUtils.format("{}/domain/{}.java", javaPath, className);
|
||||||
}
|
}
|
||||||
if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory()))
|
if (template.contains("sub-domain.java.vm") && StringUtils.equals(GenConstants.TPL_SUB, genTable.getTplCategory())) {
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
fileName = StringUtils.format("{}/domain/{}.java", javaPath, genTable.getSubTable().getClassName());
|
||||||
}
|
} else if (template.contains("mapper.java.vm")) {
|
||||||
else if (template.contains("mapper.java.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
fileName = StringUtils.format("{}/mapper/{}Mapper.java", javaPath, className);
|
||||||
}
|
} else if (template.contains("service.java.vm")) {
|
||||||
else if (template.contains("service.java.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className);
|
fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className);
|
||||||
}
|
} else if (template.contains("serviceImpl.java.vm")) {
|
||||||
else if (template.contains("serviceImpl.java.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
|
fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
|
||||||
}
|
} else if (template.contains("controller.java.vm")) {
|
||||||
else if (template.contains("controller.java.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className);
|
fileName = StringUtils.format("{}/controller/{}Controller.java", javaPath, className);
|
||||||
}
|
} else if (template.contains("mapper.xml.vm")) {
|
||||||
else if (template.contains("mapper.xml.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className);
|
fileName = StringUtils.format("{}/{}Mapper.xml", mybatisPath, className);
|
||||||
}
|
} else if (template.contains("list.html.vm")) {
|
||||||
else if (template.contains("list.html.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/{}.html", htmlPath, businessName);
|
fileName = StringUtils.format("{}/{}.html", htmlPath, businessName);
|
||||||
}
|
} else if (template.contains("list-tree.html.vm")) {
|
||||||
else if (template.contains("list-tree.html.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/{}.html", htmlPath, businessName);
|
fileName = StringUtils.format("{}/{}.html", htmlPath, businessName);
|
||||||
}
|
} else if (template.contains("tree.html.vm")) {
|
||||||
else if (template.contains("tree.html.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/tree.html", htmlPath);
|
fileName = StringUtils.format("{}/tree.html", htmlPath);
|
||||||
}
|
} else if (template.contains("add.html.vm")) {
|
||||||
else if (template.contains("add.html.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/add.html", htmlPath);
|
fileName = StringUtils.format("{}/add.html", htmlPath);
|
||||||
}
|
} else if (template.contains("edit.html.vm")) {
|
||||||
else if (template.contains("edit.html.vm"))
|
|
||||||
{
|
|
||||||
fileName = StringUtils.format("{}/edit.html", htmlPath);
|
fileName = StringUtils.format("{}/edit.html", htmlPath);
|
||||||
}
|
} else if (template.contains("sql.vm")) {
|
||||||
else if (template.contains("sql.vm"))
|
|
||||||
{
|
|
||||||
fileName = businessName + "Menu.sql";
|
fileName = businessName + "Menu.sql";
|
||||||
}
|
}
|
||||||
return fileName;
|
return fileName;
|
||||||
|
|
@ -242,8 +212,7 @@ public class VelocityUtils
|
||||||
*
|
*
|
||||||
* @return 路径
|
* @return 路径
|
||||||
*/
|
*/
|
||||||
public static String getProjectPath()
|
public static String getProjectPath() {
|
||||||
{
|
|
||||||
String packageName = GenConfig.getPackageName();
|
String packageName = GenConfig.getPackageName();
|
||||||
StringBuffer projectPath = new StringBuffer();
|
StringBuffer projectPath = new StringBuffer();
|
||||||
projectPath.append("main/java/");
|
projectPath.append("main/java/");
|
||||||
|
|
@ -258,8 +227,7 @@ public class VelocityUtils
|
||||||
* @param packageName 包名称
|
* @param packageName 包名称
|
||||||
* @return 包前缀名称
|
* @return 包前缀名称
|
||||||
*/
|
*/
|
||||||
public static String getPackagePrefix(String packageName)
|
public static String getPackagePrefix(String packageName) {
|
||||||
{
|
|
||||||
int lastIndex = packageName.lastIndexOf(".");
|
int lastIndex = packageName.lastIndexOf(".");
|
||||||
String basePackage = StringUtils.substring(packageName, 0, lastIndex);
|
String basePackage = StringUtils.substring(packageName, 0, lastIndex);
|
||||||
return basePackage;
|
return basePackage;
|
||||||
|
|
@ -271,23 +239,17 @@ public class VelocityUtils
|
||||||
* @param genTable 业务表对象
|
* @param genTable 业务表对象
|
||||||
* @return 返回需要导入的包列表
|
* @return 返回需要导入的包列表
|
||||||
*/
|
*/
|
||||||
public static HashSet<String> getImportList(GenTable genTable)
|
public static HashSet<String> getImportList(GenTable genTable) {
|
||||||
{
|
|
||||||
List<GenTableColumn> columns = genTable.getColumns();
|
List<GenTableColumn> columns = genTable.getColumns();
|
||||||
GenTable subGenTable = genTable.getSubTable();
|
GenTable subGenTable = genTable.getSubTable();
|
||||||
HashSet<String> importList = new HashSet<String>();
|
HashSet<String> importList = new HashSet<String>();
|
||||||
if (StringUtils.isNotNull(subGenTable))
|
if (StringUtils.isNotNull(subGenTable)) {
|
||||||
{
|
|
||||||
importList.add("java.util.List");
|
importList.add("java.util.List");
|
||||||
}
|
}
|
||||||
for (GenTableColumn column : columns)
|
for (GenTableColumn column : columns) {
|
||||||
{
|
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) {
|
||||||
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType()))
|
|
||||||
{
|
|
||||||
importList.add("java.util.Date");
|
importList.add("java.util.Date");
|
||||||
}
|
} else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) {
|
||||||
else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType()))
|
|
||||||
{
|
|
||||||
importList.add("java.math.BigDecimal");
|
importList.add("java.math.BigDecimal");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -301,8 +263,7 @@ public class VelocityUtils
|
||||||
* @param businessName 业务名称
|
* @param businessName 业务名称
|
||||||
* @return 返回权限前缀
|
* @return 返回权限前缀
|
||||||
*/
|
*/
|
||||||
public static String getPermissionPrefix(String moduleName, String businessName)
|
public static String getPermissionPrefix(String moduleName, String businessName) {
|
||||||
{
|
|
||||||
return StringUtils.format("{}:{}", moduleName, businessName);
|
return StringUtils.format("{}:{}", moduleName, businessName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -312,10 +273,8 @@ public class VelocityUtils
|
||||||
* @param options 生成其他选项
|
* @param options 生成其他选项
|
||||||
* @return 上级菜单ID字段
|
* @return 上级菜单ID字段
|
||||||
*/
|
*/
|
||||||
public static String getParentMenuId(JSONObject paramsObj)
|
public static String getParentMenuId(JSONObject paramsObj) {
|
||||||
{
|
if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID)) {
|
||||||
if (StringUtils.isNotEmpty(paramsObj) && paramsObj.containsKey(GenConstants.PARENT_MENU_ID))
|
|
||||||
{
|
|
||||||
return paramsObj.getString(GenConstants.PARENT_MENU_ID);
|
return paramsObj.getString(GenConstants.PARENT_MENU_ID);
|
||||||
}
|
}
|
||||||
return DEFAULT_PARENT_MENU_ID;
|
return DEFAULT_PARENT_MENU_ID;
|
||||||
|
|
@ -327,10 +286,8 @@ public class VelocityUtils
|
||||||
* @param options 生成其他选项
|
* @param options 生成其他选项
|
||||||
* @return 树编码
|
* @return 树编码
|
||||||
*/
|
*/
|
||||||
public static String getTreecode(JSONObject paramsObj)
|
public static String getTreecode(JSONObject paramsObj) {
|
||||||
{
|
if (paramsObj.containsKey(GenConstants.TREE_CODE)) {
|
||||||
if (paramsObj.containsKey(GenConstants.TREE_CODE))
|
|
||||||
{
|
|
||||||
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE));
|
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_CODE));
|
||||||
}
|
}
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
|
|
@ -342,10 +299,8 @@ public class VelocityUtils
|
||||||
* @param options 生成其他选项
|
* @param options 生成其他选项
|
||||||
* @return 树父编码
|
* @return 树父编码
|
||||||
*/
|
*/
|
||||||
public static String getTreeParentCode(JSONObject paramsObj)
|
public static String getTreeParentCode(JSONObject paramsObj) {
|
||||||
{
|
if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE)) {
|
||||||
if (paramsObj.containsKey(GenConstants.TREE_PARENT_CODE))
|
|
||||||
{
|
|
||||||
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE));
|
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_PARENT_CODE));
|
||||||
}
|
}
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
|
|
@ -357,10 +312,8 @@ public class VelocityUtils
|
||||||
* @param options 生成其他选项
|
* @param options 生成其他选项
|
||||||
* @return 树名称
|
* @return 树名称
|
||||||
*/
|
*/
|
||||||
public static String getTreeName(JSONObject paramsObj)
|
public static String getTreeName(JSONObject paramsObj) {
|
||||||
{
|
if (paramsObj.containsKey(GenConstants.TREE_NAME)) {
|
||||||
if (paramsObj.containsKey(GenConstants.TREE_NAME))
|
|
||||||
{
|
|
||||||
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME));
|
return StringUtils.toCamelCase(paramsObj.getString(GenConstants.TREE_NAME));
|
||||||
}
|
}
|
||||||
return StringUtils.EMPTY;
|
return StringUtils.EMPTY;
|
||||||
|
|
@ -372,20 +325,16 @@ public class VelocityUtils
|
||||||
* @param genTable 业务表对象
|
* @param genTable 业务表对象
|
||||||
* @return 展开按钮列序号
|
* @return 展开按钮列序号
|
||||||
*/
|
*/
|
||||||
public static int getExpandColumn(GenTable genTable)
|
public static int getExpandColumn(GenTable genTable) {
|
||||||
{
|
|
||||||
String options = genTable.getOptions();
|
String options = genTable.getOptions();
|
||||||
JSONObject paramsObj = JSONObject.parseObject(options);
|
JSONObject paramsObj = JSONObject.parseObject(options);
|
||||||
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
|
String treeName = paramsObj.getString(GenConstants.TREE_NAME);
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for (GenTableColumn column : genTable.getColumns())
|
for (GenTableColumn column : genTable.getColumns()) {
|
||||||
{
|
if (column.isList()) {
|
||||||
if (column.isList())
|
|
||||||
{
|
|
||||||
num++;
|
num++;
|
||||||
String columnName = column.getColumnName();
|
String columnName = column.getColumnName();
|
||||||
if (columnName.equals(treeName))
|
if (columnName.equals(treeName)) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="isPk" column="is_pk" />
|
<result property="isPk" column="is_pk" />
|
||||||
<result property="isIncrement" column="is_increment" />
|
<result property="isIncrement" column="is_increment" />
|
||||||
<result property="isRequired" column="is_required" />
|
<result property="isRequired" column="is_required" />
|
||||||
|
<result property="isReadonly" column="is_readonly" />
|
||||||
<result property="isInsert" column="is_insert" />
|
<result property="isInsert" column="is_insert" />
|
||||||
<result property="isEdit" column="is_edit" />
|
<result property="isEdit" column="is_edit" />
|
||||||
<result property="isList" column="is_list" />
|
<result property="isList" column="is_list" />
|
||||||
|
|
@ -30,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectGenTableColumnVo">
|
<sql id="selectGenTableColumnVo">
|
||||||
select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
|
select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit,is_readonly, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectGenTableColumnListByTableId" parameterType="GenTableColumn" resultMap="GenTableColumnResult">
|
<select id="selectGenTableColumnListByTableId" parameterType="GenTableColumn" resultMap="GenTableColumnResult">
|
||||||
|
|
@ -56,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="isPk != null and isPk != ''">is_pk,</if>
|
<if test="isPk != null and isPk != ''">is_pk,</if>
|
||||||
<if test="isIncrement != null and isIncrement != ''">is_increment,</if>
|
<if test="isIncrement != null and isIncrement != ''">is_increment,</if>
|
||||||
<if test="isRequired != null and isRequired != ''">is_required,</if>
|
<if test="isRequired != null and isRequired != ''">is_required,</if>
|
||||||
|
<if test="isReadonly != null and isReadonly != ''">is_readonly,</if>
|
||||||
<if test="isInsert != null and isInsert != ''">is_insert,</if>
|
<if test="isInsert != null and isInsert != ''">is_insert,</if>
|
||||||
<if test="isEdit != null and isEdit != ''">is_edit,</if>
|
<if test="isEdit != null and isEdit != ''">is_edit,</if>
|
||||||
<if test="isList != null and isList != ''">is_list,</if>
|
<if test="isList != null and isList != ''">is_list,</if>
|
||||||
|
|
@ -76,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="isPk != null and isPk != ''">#{isPk},</if>
|
<if test="isPk != null and isPk != ''">#{isPk},</if>
|
||||||
<if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if>
|
<if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if>
|
||||||
<if test="isRequired != null and isRequired != ''">#{isRequired},</if>
|
<if test="isRequired != null and isRequired != ''">#{isRequired},</if>
|
||||||
|
<if test="isReadonly != null and isReadonly != ''">#{isReadonly},</if>
|
||||||
<if test="isInsert != null and isInsert != ''">#{isInsert},</if>
|
<if test="isInsert != null and isInsert != ''">#{isInsert},</if>
|
||||||
<if test="isEdit != null and isEdit != ''">#{isEdit},</if>
|
<if test="isEdit != null and isEdit != ''">#{isEdit},</if>
|
||||||
<if test="isList != null and isList != ''">#{isList},</if>
|
<if test="isList != null and isList != ''">#{isList},</if>
|
||||||
|
|
@ -100,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
is_list = #{isList},
|
is_list = #{isList},
|
||||||
is_query = #{isQuery},
|
is_query = #{isQuery},
|
||||||
is_required = #{isRequired},
|
is_required = #{isRequired},
|
||||||
|
is_readonly = #{isReadonly},
|
||||||
query_type = #{queryType},
|
query_type = #{queryType},
|
||||||
html_type = #{htmlType},
|
html_type = #{htmlType},
|
||||||
dict_type = #{dictType},
|
dict_type = #{dictType},
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
|
<result property="formCols" column="form_cols" />
|
||||||
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
@ -39,6 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="isPk" column="is_pk" />
|
<result property="isPk" column="is_pk" />
|
||||||
<result property="isIncrement" column="is_increment" />
|
<result property="isIncrement" column="is_increment" />
|
||||||
<result property="isRequired" column="is_required" />
|
<result property="isRequired" column="is_required" />
|
||||||
|
<result property="isReadonly" column="is_readonly" />
|
||||||
<result property="isInsert" column="is_insert" />
|
<result property="isInsert" column="is_insert" />
|
||||||
<result property="isEdit" column="is_edit" />
|
<result property="isEdit" column="is_edit" />
|
||||||
<result property="isList" column="is_list" />
|
<result property="isList" column="is_list" />
|
||||||
|
|
@ -54,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectGenTableVo">
|
<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, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark,form_cols from gen_table
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
|
||||||
|
|
@ -98,24 +100,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
|
<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.gen_type, t.gen_path, t.options, t.remark,t.form_cols,
|
||||||
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
|
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_readonly,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
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
where t.table_id = #{tableId} order by c.sort
|
where t.table_id = #{tableId} order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
|
<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.gen_type, t.gen_path, t.options, t.remark,t.form_cols,
|
||||||
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
|
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_readonly, 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
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
where t.table_name = #{tableName} order by c.sort
|
where t.table_name = #{tableName} order by c.sort
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
|
<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.gen_type, t.gen_path, t.options, t.remark,t.form_cols,
|
||||||
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
|
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_readonly,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
|
FROM gen_table t
|
||||||
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
|
||||||
order by c.sort
|
order by c.sort
|
||||||
|
|
@ -135,6 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="genType != null and genType != ''">gen_type,</if>
|
<if test="genType != null and genType != ''">gen_type,</if>
|
||||||
<if test="genPath != null and genPath != ''">gen_path,</if>
|
<if test="genPath != null and genPath != ''">gen_path,</if>
|
||||||
<if test="remark != null and remark != ''">remark,</if>
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
<if test="formCols != null and formCols != ''">form_cols,</if>
|
||||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
create_time
|
create_time
|
||||||
)values(
|
)values(
|
||||||
|
|
@ -150,6 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="genType != null and genType != ''">#{genType},</if>
|
<if test="genType != null and genType != ''">#{genType},</if>
|
||||||
<if test="genPath != null and genPath != ''">#{genPath},</if>
|
<if test="genPath != null and genPath != ''">#{genPath},</if>
|
||||||
<if test="remark != null and remark != ''">#{remark},</if>
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
<if test="formCols != null and formCols != ''">#{formCols},</if>
|
||||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
|
|
@ -174,6 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="options != null and options != ''">options = #{options},</if>
|
<if test="options != null and options != ''">options = #{options},</if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="formCols != null and formCols != ''">form_cols = #{formCols},</if>
|
||||||
update_time = sysdate()
|
update_time = sysdate()
|
||||||
</set>
|
</set>
|
||||||
where table_id = #{tableId}
|
where table_id = #{tableId}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
<div class="row mt20">
|
<div class="row mt20">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label is-required">表名称:</label>
|
<label class="col-sm-4 control-label is-required">表名称A:</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input name="tableName" class="form-control" type="text" placeholder="请输入表名称" maxlength="200" th:field="*{tableName}" required>
|
<input name="tableName" class="form-control" type="text" placeholder="请输入表名称" maxlength="200" th:field="*{tableName}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -73,6 +73,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-xs-2 control-label" title="">Form列数:</label>
|
||||||
|
<div class="col-xs-10">
|
||||||
|
<label class="radio-box"> <input type="radio" name="formCols" value="1" th:field="*{formCols}" /> 单列 </label>
|
||||||
|
<label class="radio-box"> <input type="radio" name="formCols" value="2" th:field="*{formCols}" checked="checked" /> 两列 </label>
|
||||||
|
<label class="radio-box"> <input type="radio" name="formCols" value="3" th:field="*{formCols}" /> 三列 </label>
|
||||||
|
<label class="radio-box"> <input type="radio" name="formCols" value="4" th:field="*{formCols}" /> 四列 </label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 字段信息 -->
|
<!-- 字段信息 -->
|
||||||
|
|
@ -301,7 +316,7 @@
|
||||||
onReorderRow: onReorderRow,
|
onReorderRow: onReorderRow,
|
||||||
columns: [{
|
columns: [{
|
||||||
title: "序号",
|
title: "序号",
|
||||||
width: "5%",
|
width: "6%",
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
// 编号隐藏域
|
// 编号隐藏域
|
||||||
var columnIdHtml = $.common.sprintf("<input type='hidden' name='columns[%s].columnId' value='%s'>", index, row.columnId);
|
var columnIdHtml = $.common.sprintf("<input type='hidden' name='columns[%s].columnId' value='%s'>", index, row.columnId);
|
||||||
|
|
@ -361,7 +376,7 @@
|
||||||
{
|
{
|
||||||
field: 'isInsert',
|
field: 'isInsert',
|
||||||
title: '插入',
|
title: '插入',
|
||||||
width: "5%",
|
width: "6%",
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
var isCheck = value == 1 ? 'checked' : '';
|
var isCheck = value == 1 ? 'checked' : '';
|
||||||
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isInsert' value='1' %s></label>", index, isCheck);
|
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isInsert' value='1' %s></label>", index, isCheck);
|
||||||
|
|
@ -371,7 +386,7 @@
|
||||||
{
|
{
|
||||||
field: 'isEdit',
|
field: 'isEdit',
|
||||||
title: '编辑',
|
title: '编辑',
|
||||||
width: "5%",
|
width: "6%",
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
var isCheck = value == 1 ? 'checked' : '';
|
var isCheck = value == 1 ? 'checked' : '';
|
||||||
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isEdit' value='1' %s></label>", index, isCheck);
|
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isEdit' value='1' %s></label>", index, isCheck);
|
||||||
|
|
@ -381,7 +396,7 @@
|
||||||
{
|
{
|
||||||
field: 'isList',
|
field: 'isList',
|
||||||
title: '列表',
|
title: '列表',
|
||||||
width: "5%",
|
width: "6%",
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
var isCheck = value == 1 ? 'checked' : '';
|
var isCheck = value == 1 ? 'checked' : '';
|
||||||
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isList' value='1' %s></label>", index, isCheck);
|
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isList' value='1' %s></label>", index, isCheck);
|
||||||
|
|
@ -391,7 +406,7 @@
|
||||||
{
|
{
|
||||||
field: 'isQuery',
|
field: 'isQuery',
|
||||||
title: '查询',
|
title: '查询',
|
||||||
width: "5%",
|
width: "6%",
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
var isCheck = value == 1 ? 'checked' : '';
|
var isCheck = value == 1 ? 'checked' : '';
|
||||||
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isQuery' value='1' %s></label>", index, isCheck);
|
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isQuery' value='1' %s></label>", index, isCheck);
|
||||||
|
|
@ -410,17 +425,27 @@
|
||||||
{
|
{
|
||||||
field: 'isRequired',
|
field: 'isRequired',
|
||||||
title: '必填',
|
title: '必填',
|
||||||
width: "5%",
|
width: "6%",
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
var isCheck = value == 1 ? 'checked' : '';
|
var isCheck = value == 1 ? 'checked' : '';
|
||||||
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isRequired' value='1' %s></label>", index, isCheck);
|
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isRequired' value='1' %s></label>", index, isCheck);
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
field: 'isReadonly',
|
||||||
|
title: '只读',
|
||||||
|
width: "6%",
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
var isCheck = value == 1 ? 'checked' : '';
|
||||||
|
var html = $.common.sprintf("<label class='check-box'><input type='checkbox' name='columns[%s].isReadonly' value='1' %s></label>", index, isCheck);
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'htmlType',
|
field: 'htmlType',
|
||||||
title: '显示类型',
|
title: '显示类型',
|
||||||
width: "12%",
|
width: "11%",
|
||||||
formatter: function (value, row, index) {
|
formatter: function (value, row, index) {
|
||||||
var data = [{ index: index, htmlType: value }];
|
var data = [{ index: index, htmlType: value }];
|
||||||
return $("#htmlTypeTpl").tmpl(data).html();
|
return $("#htmlTypeTpl").tmpl(data).html();
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,10 @@
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<h4 class="form-header h4">${functionName}信息</h4>
|
<h4 class="form-header h4">${functionName}信息</h4>
|
||||||
#end
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
#set($cumvar=0)
|
|
||||||
#set($field=$column.javaField)
|
#set($field=$column.javaField)
|
||||||
<div class="col-md-6">
|
#if($column.insert && !$column.pk)
|
||||||
#foreach($column in $effectivecols)
|
#if(($column.usableColumn) || (!$column.superColumn))
|
||||||
#set($field=$column.javaField)
|
|
||||||
##if($column.insert && !$column.pk)
|
|
||||||
##if(($column.usableColumn) || (!$column.superColumn))
|
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
#if($parentheseIndex != -1)
|
#if($parentheseIndex != -1)
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
|
@ -42,44 +38,124 @@
|
||||||
#set($comment=$column.columnComment)
|
#set($comment=$column.columnComment)
|
||||||
#end
|
#end
|
||||||
#set($dictType=$column.dictType)
|
#set($dictType=$column.dictType)
|
||||||
|
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||||
#set($cumvar=$cumvar+1)
|
<div class="form-group">
|
||||||
#if($cumvar%2==1)
|
<label class="col-sm-3 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
#parse("vm/html/formtpl.vm")
|
<div class="col-sm-8">
|
||||||
#end
|
<div class="input-group">
|
||||||
|
#set($BusinessName=$businessName.substring(0,1).toUpperCase() + ${businessName.substring(1)})
|
||||||
##end
|
#set($treeId = "${className}?.${treeCode}")
|
||||||
##end
|
<input id="treeId" name="${treeParentCode}" type="hidden" th:value="${${treeId}}"/>
|
||||||
#end
|
<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>
|
||||||
|
|
||||||
#set($cumvar=0)
|
|
||||||
#set($field=$column.javaField)
|
|
||||||
<div class="col-md-6">
|
|
||||||
#foreach($column in $effectivecols)
|
|
||||||
#set($field=$column.javaField)
|
|
||||||
##if($column.insert && !$column.pk)
|
|
||||||
##if(($column.usableColumn) || (!$column.superColumn))
|
|
||||||
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
|
||||||
#if($parentheseIndex != -1)
|
|
||||||
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
|
||||||
#else
|
|
||||||
#set($comment=$column.columnComment)
|
|
||||||
#end
|
|
||||||
#set($dictType=$column.dictType)
|
|
||||||
|
|
||||||
#set($cumvar=$cumvar+1)
|
|
||||||
|
|
||||||
#if($cumvar%2==0)
|
|
||||||
#parse("vm/html/formtpl.vm")
|
|
||||||
#end
|
|
||||||
|
|
||||||
##end
|
|
||||||
##end
|
|
||||||
#end
|
|
||||||
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</div>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
<h4 class="form-header h4">${subTable.functionName}信息</h4>
|
<h4 class="form-header h4">${subTable.functionName}信息</h4>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
@ -114,7 +190,6 @@
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
||||||
var prefix = ctx + "${moduleName}/${businessName}"
|
var prefix = ctx + "${moduleName}/${businessName}"
|
||||||
#if($table.sub)
|
#if($table.sub)
|
||||||
#foreach($column in $subTable.columns)
|
#foreach($column in $subTable.columns)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,312 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('新增${functionName}')" />
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
|
<th:block th:include="include :: summernote-css" />
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
</head>
|
||||||
|
<body class="white-bg">
|
||||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
<form class="form-horizontal m" id="form-${businessName}-add">
|
||||||
|
#if($table.sub)
|
||||||
|
<h4 class="form-header h4">${functionName}信息</h4>
|
||||||
|
#end
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
#set($cumvar=0)
|
||||||
|
#set($field=$column.javaField)
|
||||||
|
#set($colcount=$effectivecols.size())
|
||||||
|
#foreach($column in $effectivecols)
|
||||||
|
#set($field=$column.javaField)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
|
||||||
|
#set($cumvar=$cumvar+1)
|
||||||
|
#if($column.htmlType == "textarea")
|
||||||
|
#if($cumvar%2==0)
|
||||||
|
</div>
|
||||||
|
#end
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-2 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>
|
||||||
|
#else
|
||||||
|
#if($cumvar%2==1)
|
||||||
|
<div class="form-group">
|
||||||
|
#end
|
||||||
|
#parse("\vm\html\col2\formtpl.vm")
|
||||||
|
#if($cumvar%2==0 || ($cumvar>=$colcount))
|
||||||
|
</div>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
</fieldset>
|
||||||
|
#*
|
||||||
|
<div class="row"> ## col-md-6
|
||||||
|
#foreach($column in $effectivecols)
|
||||||
|
#set($field=$column.javaField)
|
||||||
|
##if($column.insert && !$column.pk)
|
||||||
|
##if(($column.usableColumn) || (!$column.superColumn))
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
|
||||||
|
##set($cumvar=$cumvar+1)
|
||||||
|
##if($cumvar%2==1)
|
||||||
|
#parse("vm/html/formtpl.vm")
|
||||||
|
##end
|
||||||
|
|
||||||
|
##end
|
||||||
|
##end
|
||||||
|
#end
|
||||||
|
*#
|
||||||
|
|
||||||
|
|
||||||
|
#if($table.sub)
|
||||||
|
<h4 class="form-header h4">${subTable.functionName}信息</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
||||||
|
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-table"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
#end
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
|
<th:block th:include="include :: summernote-js" />
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
<script th:inline="javascript">
|
||||||
|
|
||||||
|
var prefix = ctx + "${moduleName}/${businessName}"
|
||||||
|
#if($table.sub)
|
||||||
|
#foreach($column in $subTable.columns)
|
||||||
|
#if(${column.dictType} != '')
|
||||||
|
var ${column.javaField}Datas = [[${@dict.getType('${column.dictType}')}]];
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
$("#form-${businessName}-add").validate({
|
||||||
|
focusCleanup: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
$.operate.save(prefix + "/add", $('#form-${businessName}-add').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
|
|
||||||
|
$("input[name='$column.javaField']").datetimepicker({
|
||||||
|
format: "yyyy-mm-dd",
|
||||||
|
minView: "month",
|
||||||
|
autoclose: true
|
||||||
|
});
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
|
||||||
|
$(".file-upload").fileinput({
|
||||||
|
uploadUrl: ctx + 'common/upload',
|
||||||
|
maxFileCount: 1,
|
||||||
|
autoReplace: true
|
||||||
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||||
|
}).on('fileremoved', function (event, id, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||||
|
})
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$('.summernote').summernote({
|
||||||
|
lang: 'zh-CN',
|
||||||
|
callbacks: {
|
||||||
|
onChange: function(contents, $edittable) {
|
||||||
|
$("input[name='" + this.id + "']").val(contents);
|
||||||
|
},
|
||||||
|
onImageUpload: function(files) {
|
||||||
|
var obj = this;
|
||||||
|
var data = new FormData();
|
||||||
|
data.append("file", files[0]);
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: ctx + "common/upload",
|
||||||
|
data: data,
|
||||||
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(result) {
|
||||||
|
if (result.code == web_status.SUCCESS) {
|
||||||
|
$('#' + obj.id).summernote('insertImage', result.url);
|
||||||
|
} else {
|
||||||
|
$.modal.alertError(result.msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
$.modal.alertWarning("图片上传失败。");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.tree)
|
||||||
|
|
||||||
|
/*${functionName}-新增-选择父部门树*/
|
||||||
|
function select${BusinessName}Tree() {
|
||||||
|
var options = {
|
||||||
|
title: '${functionName}选择',
|
||||||
|
width: "380",
|
||||||
|
url: prefix + "/select${BusinessName}Tree/" + $("#treeId").val(),
|
||||||
|
callBack: doSubmit
|
||||||
|
};
|
||||||
|
$.modal.openOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doSubmit(index, layero){
|
||||||
|
var body = layer.getChildFrame('body', index);
|
||||||
|
$("#treeId").val(body.find('#treeId').val());
|
||||||
|
$("#treeName").val(body.find('#treeName').val());
|
||||||
|
layer.close(index);
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var options = {
|
||||||
|
pagination: false,
|
||||||
|
showSearch: false,
|
||||||
|
showRefresh: false,
|
||||||
|
showToggle: false,
|
||||||
|
showColumns: false,
|
||||||
|
sidePagination: "client",
|
||||||
|
columns: [{
|
||||||
|
checkbox: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'index',
|
||||||
|
align: 'center',
|
||||||
|
title: "序号",
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
||||||
|
return columnIndex + $.table.serialNumber(index);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
#foreach($column in $subTable.columns)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#set($javaField=$column.javaField)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($column.pk || $javaField == ${subTableFkclassName})
|
||||||
|
#elseif($column.list && "" != $dictType)
|
||||||
|
{
|
||||||
|
field: '${javaField}',
|
||||||
|
align: 'center',
|
||||||
|
title: '${comment}',
|
||||||
|
formatter: function(value, row, index) {
|
||||||
|
var name = $.common.sprintf("${subclassName}List[%s].${javaField}", index);
|
||||||
|
return $.common.dictToSelect(${javaField}Datas, value, name);
|
||||||
|
}
|
||||||
|
#if($velocityCount != $subTable.columns.size())},#end
|
||||||
|
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
field: '${javaField}',
|
||||||
|
align: 'center',
|
||||||
|
title: '${comment}',
|
||||||
|
formatter: function(value, row, index) {
|
||||||
|
var html = $.common.sprintf("<input class='form-control' type='text' name='${subclassName}List[%s].${javaField}' value='%s'>", index, value);
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
#if($velocityCount != $subTable.columns.size())},#end
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
$.table.init(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
function addColumn() {
|
||||||
|
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||||
|
sub.editColumn();
|
||||||
|
|
||||||
|
$("#" + table.options.id).bootstrapTable('insertRow', {
|
||||||
|
index: count,
|
||||||
|
row: {
|
||||||
|
index: $.table.serialNumber(count),
|
||||||
|
#foreach($column in $subTable.columns)
|
||||||
|
#set($javaField=$column.javaField)
|
||||||
|
#if($column.pk || $javaField == ${subTableFkclassName})
|
||||||
|
#else
|
||||||
|
${javaField}: ""#if($velocityCount != $subTable.columns.size()),#end
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,307 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('修改${functionName}')" />
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
|
<th:block th:include="include :: summernote-css" />
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
</head>
|
||||||
|
<body class="white-bg">
|
||||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
<form class="form-horizontal m" id="form-${businessName}-edit" th:object="${${className}}">
|
||||||
|
#if($table.sub)
|
||||||
|
<h4 class="form-header h4">${functionName}信息</h4>
|
||||||
|
#end
|
||||||
|
<input name="${pkColumn.javaField}" th:field="*{${pkColumn.javaField}}" type="hidden">
|
||||||
|
|
||||||
|
#set($cumvar=0)
|
||||||
|
#set($colcount=$effectivecols.size())
|
||||||
|
#foreach($column in $effectivecols)
|
||||||
|
#if($column.edit && !$column.pk)
|
||||||
|
#if(($column.usableColumn) || (!$column.superColumn))
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#set($field=$column.javaField)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
|
||||||
|
#set($cumvar=$cumvar+1)
|
||||||
|
#if($column.htmlType == "textarea")
|
||||||
|
#if($cumvar%2==0)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
#end
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label#if($column.required) is-required#end">${comment}_${cumvar}:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<textarea name="${field}" class="form-control"#if($column.required) required#end></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
#else
|
||||||
|
#if($cumvar%2==1)
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
#end
|
||||||
|
#parse("\vm\html\col2\formedittpl.vm")
|
||||||
|
#if($cumvar%2==0 || ($cumvar>=$colcount))
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
<h4 class="form-header h4">${subTable.functionName}信息</h4>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<button type="button" class="btn btn-white btn-sm" onclick="addColumn()"><i class="fa fa-plus"> 增加</i></button>
|
||||||
|
<button type="button" class="btn btn-white btn-sm" onclick="sub.delColumn()"><i class="fa fa-minus"> 删除</i></button>
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-table"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
#end
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
<th:block th:include="include :: bootstrap-fileinput-js"/>
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.insert && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
|
<th:block th:include="include :: summernote-js" />
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var prefix = ctx + "${moduleName}/${businessName}";
|
||||||
|
#if($table.sub)
|
||||||
|
#foreach($column in $subTable.columns)
|
||||||
|
#if(${column.dictType} != '')
|
||||||
|
var ${column.javaField}Datas = [[${@dict.getType('${column.dictType}')}]];
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
$("#form-${businessName}-edit").validate({
|
||||||
|
focusCleanup: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
$.operate.save(prefix + "/edit", $('#form-${businessName}-edit').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "datetime")
|
||||||
|
|
||||||
|
$("input[name='$column.javaField']").datetimepicker({
|
||||||
|
format: "yyyy-mm-dd",
|
||||||
|
minView: "month",
|
||||||
|
autoclose: true
|
||||||
|
});
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "upload")
|
||||||
|
|
||||||
|
$(".file-upload").each(function (i) {
|
||||||
|
var val = $("input[name='" + this.id + "']").val()
|
||||||
|
$(this).fileinput({
|
||||||
|
'uploadUrl': ctx + 'common/upload',
|
||||||
|
initialPreviewAsData: true,
|
||||||
|
initialPreview: [val],
|
||||||
|
maxFileCount: 1,
|
||||||
|
autoReplace: true
|
||||||
|
}).on('fileuploaded', function (event, data, previewId, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
|
||||||
|
}).on('fileremoved', function (event, id, index) {
|
||||||
|
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||||
|
})
|
||||||
|
$(this).fileinput('_initFileActions');
|
||||||
|
});
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#foreach($column in $columns)
|
||||||
|
#if($column.edit && !$column.superColumn && !$column.pk && $column.htmlType == "summernote")
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$('.summernote').each(function(i) {
|
||||||
|
$('#' + this.id).summernote({
|
||||||
|
lang: 'zh-CN',
|
||||||
|
callbacks: {
|
||||||
|
onChange: function(contents, $edittable) {
|
||||||
|
$("input[name='" + this.id + "']").val(contents);
|
||||||
|
},
|
||||||
|
onImageUpload: function(files) {
|
||||||
|
var obj = this;
|
||||||
|
var data = new FormData();
|
||||||
|
data.append("file", files[0]);
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: ctx + "common/upload",
|
||||||
|
data: data,
|
||||||
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(result) {
|
||||||
|
if (result.code == web_status.SUCCESS) {
|
||||||
|
$('#' + obj.id).summernote('insertImage', result.url);
|
||||||
|
} else {
|
||||||
|
$.modal.alertError(result.msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function(error) {
|
||||||
|
$.modal.alertWarning("图片上传失败。");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var content = $("input[name='" + this.id + "']").val();
|
||||||
|
$('#' + this.id).summernote('code', content);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
#break
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
#if($table.tree)
|
||||||
|
|
||||||
|
/*${functionName}-新增-选择父部门树*/
|
||||||
|
function select${BusinessName}Tree() {
|
||||||
|
var options = {
|
||||||
|
title: '${functionName}选择',
|
||||||
|
width: "380",
|
||||||
|
url: prefix + "/select${BusinessName}Tree/" + $("#treeId").val(),
|
||||||
|
callBack: doSubmit
|
||||||
|
};
|
||||||
|
$.modal.openOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doSubmit(index, layero){
|
||||||
|
var body = layer.getChildFrame('body', index);
|
||||||
|
$("#treeId").val(body.find('#treeId').val());
|
||||||
|
$("#treeName").val(body.find('#treeName').val());
|
||||||
|
layer.close(index);
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
#if($table.sub)
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var options = {
|
||||||
|
data: [[${${className}.${subclassName}List}]],
|
||||||
|
pagination: false,
|
||||||
|
showSearch: false,
|
||||||
|
showRefresh: false,
|
||||||
|
showToggle: false,
|
||||||
|
showColumns: false,
|
||||||
|
sidePagination: "client",
|
||||||
|
columns: [{
|
||||||
|
checkbox: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'index',
|
||||||
|
align: 'center',
|
||||||
|
title: "序号",
|
||||||
|
formatter: function (value, row, index) {
|
||||||
|
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
||||||
|
return columnIndex + $.table.serialNumber(index);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
#foreach($column in $subTable.columns)
|
||||||
|
#set($dictType=$column.dictType)
|
||||||
|
#set($javaField=$column.javaField)
|
||||||
|
#set($parentheseIndex=$column.columnComment.indexOf("("))
|
||||||
|
#if($parentheseIndex != -1)
|
||||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex))
|
||||||
|
#else
|
||||||
|
#set($comment=$column.columnComment)
|
||||||
|
#end
|
||||||
|
#if($column.pk || $javaField == ${subTableFkclassName})
|
||||||
|
#elseif($column.list && "" != $dictType)
|
||||||
|
{
|
||||||
|
field: '${javaField}',
|
||||||
|
align: 'center',
|
||||||
|
title: '${comment}',
|
||||||
|
formatter: function(value, row, index) {
|
||||||
|
var name = $.common.sprintf("${subclassName}List[%s].${javaField}", index);
|
||||||
|
return $.common.dictToSelect(${javaField}Datas, value, name);
|
||||||
|
}
|
||||||
|
#if($velocityCount != $subTable.columns.size())},#end
|
||||||
|
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
field: '${javaField}',
|
||||||
|
align: 'center',
|
||||||
|
title: '${comment}',
|
||||||
|
formatter: function(value, row, index) {
|
||||||
|
var html = $.common.sprintf("<input class='form-control' type='text' name='${subclassName}List[%s].${javaField}' value='%s'>", index, value);
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
#if($velocityCount != $subTable.columns.size())},#end
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
$.table.init(options);
|
||||||
|
});
|
||||||
|
|
||||||
|
function addColumn() {
|
||||||
|
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||||
|
sub.editColumn();
|
||||||
|
|
||||||
|
$("#" + table.options.id).bootstrapTable('insertRow', {
|
||||||
|
index: count,
|
||||||
|
row: {
|
||||||
|
index: $.table.serialNumber(count),
|
||||||
|
#foreach($column in $subTable.columns)
|
||||||
|
#set($javaField=$column.javaField)
|
||||||
|
#if($column.pk || $javaField == ${subTableFkclassName})
|
||||||
|
#else
|
||||||
|
${javaField}: ""#if($velocityCount != $subTable.columns.size()),#end
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,87 @@
|
||||||
|
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||||
|
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
#elseif($column.htmlType == "input")
|
||||||
|
<label class="col-sm-4 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="${field}" class="form-control" readonly="${column.readonly}" type="text"#if($column.required) required#end>
|
||||||
|
</div>
|
||||||
|
#elseif($column.htmlType == "upload")
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
#elseif($column.htmlType == "summernote")
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
#elseif($column.htmlType == "datetime")
|
||||||
|
<label class="col-sm-4 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>
|
||||||
|
#end
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
#if("" != $treeParentCode && $column.javaField == $treeParentCode)
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}_${cumvar}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<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" #if($column.readonly) readonly="readonly" #end th:value="${${treeName}}"#if($column.required) required#end>
|
||||||
|
<span class="input-group-addon"><i class="fa fa-search"></i></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
#elseif($column.htmlType == "input")
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<input name="${field}" class="form-control" #if($column.readonly) readonly="readonly" #end type="text"#if($column.required) required#end>
|
||||||
|
</div>
|
||||||
|
#elseif($column.htmlType == "upload")
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<input type="hidden" name="${field}">
|
||||||
|
<div class="file-loading">
|
||||||
|
<input class="form-control file-upload" id="${field}" name="file" type="file">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
#elseif($column.htmlType == "summernote")
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<input type="hidden" class="form-control" name="${field}">
|
||||||
|
<div class="summernote" id="${field}"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
#elseif($column.htmlType == "select" && "" != $dictType)
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
#elseif($column.htmlType == "select" && $dictType)
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
#elseif($column.htmlType == "checkbox" && "" != $dictType)
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3" 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>
|
||||||
|
|
||||||
|
#elseif($column.htmlType == "checkbox" && $dictType)
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
#elseif($column.htmlType == "radio" && "" != $dictType)
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
#elseif($column.htmlType == "radio" && $dictType)
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
#elseif($column.htmlType == "datetime")
|
||||||
|
|
||||||
|
<label class="col-sm-2 control-label#if($column.required) is-required#end">${comment}:</label>
|
||||||
|
<div class="col-sm-3">
|
||||||
|
<div class="input-group date">
|
||||||
|
<input name="${field}" class="form-control" placeholder="yyyy-MM-dd" #if($column.readonly) readonly="readonly" #end type="text"#if($column.required) required#end>
|
||||||
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
#end
|
||||||
|
|
@ -1,115 +0,0 @@
|
||||||
#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">
|
|
||||||
#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>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
<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>
|
|
||||||
</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>
|
|
||||||
</div>
|
|
||||||
#end
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
-- 生成代码
|
||||||
|
alter table gen_table add form_cols char(1) default '2' COMMENT '表单列示 1单列 2两列 3三列 4四列' ;
|
||||||
|
alter table gen_table_column add `is_readonly` char(1) DEFAULT 0 COMMENT '是否自读字段(0否 1是)' ;
|
||||||
Loading…
Reference in New Issue