本次提交 生成代码模块

This commit is contained in:
lin 2020-12-10 18:02:39 +08:00
parent 0d5510acee
commit da030fca43
15 changed files with 580 additions and 377 deletions

View File

@ -9,14 +9,14 @@ import com.ruoyi.common.core.domain.BaseEntity;
* 经济类型对象 platf_econ_type
*
* @author dalin
* @date 2020-12-08
* @date 2020-12-09
*/
public class EconType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Integer econId;
private Long econId;
/** 名称 */
@Excel(name = "名称")
@ -26,19 +26,19 @@ public class EconType extends BaseEntity
@Excel(name = "单据号")
private String docNum;
/** 资料状态 0有效 1无效 */
@Excel(name = "资料状态 0有效 1无效")
/** 资料状态 */
@Excel(name = "资料状态")
private String status;
/** 删除标志 删除标志0代表存在 2代表删除 */
/** 删除标志 删除标志 */
private String delFlag;
public void setEconId(Integer econId)
public void setEconId(Long econId)
{
this.econId = econId;
}
public Integer getEconId()
public Long getEconId()
{
return econId;
}

View File

@ -7,7 +7,7 @@ import com.ruoyi.province.platform.domain.EconType;
* 经济类型Mapper接口
*
* @author dalin
* @date 2020-12-08
* @date 2020-12-09
*/
public interface EconTypeMapper
{
@ -17,7 +17,7 @@ public interface EconTypeMapper
* @param econId 经济类型ID
* @return 经济类型
*/
public EconType selectEconTypeById(Integer econId);
public EconType selectEconTypeById(Long econId);
/**
* 查询经济类型列表
@ -49,7 +49,7 @@ public interface EconTypeMapper
* @param econId 经济类型ID
* @return 结果
*/
public int deleteEconTypeById(Integer econId);
public int deleteEconTypeById(Long econId);
/**
* 批量删除经济类型

View File

@ -7,7 +7,7 @@ import com.ruoyi.province.platform.domain.EconType;
* 经济类型Service接口
*
* @author dalin
* @date 2020-12-08
* @date 2020-12-09
*/
public interface IEconTypeService
{
@ -17,7 +17,7 @@ public interface IEconTypeService
* @param econId 经济类型ID
* @return 经济类型
*/
public EconType selectEconTypeById(Integer econId);
public EconType selectEconTypeById(Long econId);
/**
* 查询经济类型列表
@ -57,5 +57,5 @@ public interface IEconTypeService
* @param econId 经济类型ID
* @return 结果
*/
public int deleteEconTypeById(Integer econId);
public int deleteEconTypeById(Long econId);
}

View File

@ -13,7 +13,7 @@ import com.ruoyi.common.core.text.Convert;
* 经济类型Service业务层处理
*
* @author dalin
* @date 2020-12-08
* @date 2020-12-09
*/
@Service
public class EconTypeServiceImpl implements IEconTypeService
@ -28,7 +28,7 @@ public class EconTypeServiceImpl implements IEconTypeService
* @return 经济类型
*/
@Override
public EconType selectEconTypeById(Integer econId)
public EconType selectEconTypeById(Long econId)
{
return econTypeMapper.selectEconTypeById(econId);
}
@ -90,7 +90,7 @@ public class EconTypeServiceImpl implements IEconTypeService
* @return 结果
*/
@Override
public int deleteEconTypeById(Integer econId)
public int deleteEconTypeById(Long econId)
{
return econTypeMapper.deleteEconTypeById(econId);
}

View File

@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="selectEconTypeById" parameterType="Integer" resultMap="EconTypeResult">
<select id="selectEconTypeById" parameterType="Long" resultMap="EconTypeResult">
<include refid="selectEconTypeVo"/>
where econ_id = #{econId}
</select>
@ -38,10 +38,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into platf_econ_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="econName != null and econName != ''">econ_name,</if>
<if test="docNum != null">doc_num,</if>
<if test="docNum != null and docNum != ''">doc_num,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
@ -49,10 +49,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="econName != null and econName != ''">#{econName},</if>
<if test="docNum != null">#{docNum},</if>
<if test="docNum != null and docNum != ''">#{docNum},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
@ -64,10 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update platf_econ_type
<trim prefix="SET" suffixOverrides=",">
<if test="econName != null and econName != ''">econ_name = #{econName},</if>
<if test="docNum != null">doc_num = #{docNum},</if>
<if test="docNum != null and docNum != ''">doc_num = #{docNum},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where econ_id = #{econId}
</update>
<delete id="deleteEconTypeById" parameterType="Integer">
<delete id="deleteEconTypeById" parameterType="Long">
delete from platf_econ_type where econ_id = #{econId}
</delete>

View File

@ -1,26 +1,29 @@
package com.ruoyi.web.controller.platform;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.province.platform.domain.EconType;
import com.ruoyi.province.platform.service.IEconTypeService;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.province.platform.domain.EconType;
import com.ruoyi.province.platform.service.IEconTypeService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 经济类型Controller
*
* @author dalin
* @date 2020-12-08
* @date 2020-12-09
*/
@Controller
@RequestMapping("/platform/econtype")
@ -90,7 +93,7 @@ public class EconTypeController extends BaseController
* 修改经济类型
*/
@GetMapping("/edit/{econId}")
public String edit(@PathVariable("econId") Integer econId, ModelMap mmap)
public String edit(@PathVariable("econId") Long econId, ModelMap mmap)
{
EconType econType = econTypeService.selectEconTypeById(econId);
mmap.put("econType", econType);

View File

@ -1,25 +1,36 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增经济类型')" />
<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>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-econtype-add">
<div class="form-group">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-econtype-add">
<div class="col-md-6" background="red">
<div class="form-group">
<label class="col-sm-3 control-label is-required">名称:</label>
<div class="col-sm-8">
<input name="econName" 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">
<input name="docNum" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">资料状态 0有效 1无效</label>
<div class="form-group">
<label class="col-sm-3 control-label is-required">资料状态:</label>
<div class="col-sm-8">
<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>
@ -27,32 +38,118 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">制单时间:</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">
<textarea name="remark" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">删除标志 删除标志:</label>
<div class="form-group">
<label class="col-sm-3 control-label is-required">制单人:</label>
<div class="col-sm-8">
<input name="delFlag" class="form-control" type="text">
<input name="createBy" class="form-control" type="text" required>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "platform/econtype"
$("#form-econtype-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-econtype-add').serialize());
}
<div class="form-group">
<label class="col-sm-3 control-label">修改人:</label>
<div class="col-sm-8">
<input name="updateBy" class="form-control" type="text">
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "platform/econtype"
$("#form-econtype-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-econtype-add').serialize());
}
</script>
}
$("input[name='createTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='updateTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>
</html>

View File

@ -15,7 +15,7 @@
<input type="text" name="econName"/>
</li>
<li>
<label>资料状态 0有效 1无效</label>
<label>资料状态:</label>
<select name="status" th:with="type=${@dict.getType('platf_doc_statu')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
@ -82,7 +82,7 @@
},
{
field: 'status',
title: '资料状态 0有效 1无效',
title: '资料状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(statusDatas, value);
}
@ -91,6 +91,22 @@
field: 'remark',
title: '备注'
},
{
field: 'createBy',
title: '制单人'
},
{
field: 'createTime',
title: '制单时间'
},
{
field: 'updateBy',
title: '修改人'
},
{
field: 'updateTime',
title: '修改时间'
},
{
title: '操作',
align: 'center',

View File

@ -2,6 +2,7 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改经济类型')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -14,7 +15,13 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">资料状态 0有效 1无效</label>
<label class="col-sm-3 control-label is-required">单据号:</label>
<div class="col-sm-8">
<input name="docNum" th:field="*{docNum}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">资料状态:</label>
<div class="col-sm-8">
<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>
@ -28,9 +35,25 @@
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">修改人:</label>
<div class="col-sm-8">
<input name="updateBy" th:field="*{updateBy}" class="form-control" type="text">
</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" th:value="${#dates.format(econType.updateTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "platform/econtype";
$("#form-econtype-edit").validate({
@ -42,6 +65,12 @@
$.operate.save(prefix + "/edit", $('#form-econtype-edit').serialize());
}
}
$("input[name='updateTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -332,7 +332,7 @@ public class GenTableColumn extends BaseEntity
{
return StringUtils.equalsAnyIgnoreCase(javaField,
// BaseEntity
"createBy", "createTime", "updateBy", "updateTime", "remark",
"remark",
// TreeEntity
"parentName", "parentId", "orderNum", "ancestors");
}

View File

@ -131,6 +131,9 @@ public class GenTableServiceImpl implements IGenTableService
{
for (GenTableColumn cenTableColumn : genTable.getColumns())
{
if (cenTableColumn.getJavaField().toLowerCase().equals("delflag")) {
cenTableColumn.setHtmlType("");
}
genTableColumnMapper.updateGenTableColumn(cenTableColumn);
}
}

View File

@ -47,6 +47,9 @@ public class GenUtils
// 字符串长度超过500设置为文本域
Integer columnLength = getColumnLength(column.getColumnType());
String htmlType = columnLength >= 500 ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT;
if ( column.getColumnName().toLowerCase().equals("del_flag") ) {
htmlType = "";
}
column.setHtmlType(htmlType);
}
else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType))

View File

@ -54,7 +54,19 @@ public class VelocityUtils
velocityContext.put("pkColumn", genTable.getPkColumn());
velocityContext.put("importList", getImportList(genTable));
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
// 取出页面需要的字段ing
List<GenTableColumn> tempcolumns = genTable.getColumns();
List<GenTableColumn> effectivecols = new ArrayList<GenTableColumn> ();//定义一个list对象
for(GenTableColumn tcolumn : tempcolumns) {
if (tcolumn.isInsert() && !tcolumn.isPk())
if (tcolumn.isUsableColumn() || !tcolumn.isSuperColumn())
effectivecols.add(tcolumn) ;
} ;
velocityContext.put("effectivecols", effectivecols);
velocityContext.put("columns", genTable.getColumns());
velocityContext.put("table", genTable);
setMenuVelocityContext(velocityContext, genTable);
if (GenConstants.TPL_TREE.equals(tplCategory))

View File

@ -2,161 +2,85 @@
<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
#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)
<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
#foreach($column in $columns)
#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)
#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
#end
#end
#end
#if($table.sub)
#end
#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==1)
#parse("vm/html/formtpl.vm")
#end
##end
##end
#end
</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>
#if($table.sub)
<h4 class="form-header h4">${subTable.functionName}信息</h4>
<div class="row">
<div class="col-sm-12">
@ -167,112 +91,113 @@
</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
});
#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">
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-${businessName}-add').serialize());
}
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")
}
#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("图片上传失败。");
}
});
}
}
$("input[name='$column.javaField']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
});
#break
#end
#end
#if($table.tree)
#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() {
@ -287,12 +212,12 @@
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);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}
#end
#if($table.sub)
#end
#if($table.sub)
$(function() {
var options = {
@ -302,7 +227,7 @@
showToggle: false,
showColumns: false,
sidePagination: "client",
columns: [{
columns: [{
checkbox: true
},
{
@ -310,69 +235,69 @@
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);
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
#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
#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);
#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
#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
#end
}
#end
</script>
});
}
#end
</script>
</body>
</html>

View File

@ -0,0 +1,115 @@
#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