单表代码生成,完美了,支持强制新行,栅格定义。

This commit is contained in:
thinkgem
2018-01-28 00:11:21 +08:00
parent 7864513be0
commit 9944c08c6a
9 changed files with 1073 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jeesite.modules.test.dao.TestDataDao">
<!-- 查询数据
<select id="findList" resultType="TestData">
SELECT ${sqlMap.column.toSql()}
FROM ${sqlMap.table.toSql()}
<where>
${sqlMap.where.toSql()}
</where>
ORDER BY ${sqlMap.order.toSql()}
</select> -->
</mapper>

View File

@@ -0,0 +1,402 @@
<% layout('/layouts/default.html', {title: '数据管理', libs: ['validate','fileupload']}){ %>
<div class="main-content">
<div class="box box-main">
<div class="box-header with-border">
<div class="box-title">
<i class="fa fa-list-alt"></i> ${testData.isNewRecord ? '新增数据' : '编辑数据'}
</div>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div>
</div>
<#form:form id="inputForm" model="${testData}" action="${ctx}/test/testData/save" method="post" class="form-horizontal">
<div class="box-body">
<div class="form-unit">基本信息</div>
<#form:hidden path="id"/>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 单行文本:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="testInput" maxlength="200" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2" title="">
<span class="required hide">*</span> 多行文本:<i class="fa icon-question hide"></i></label>
<div class="col-sm-10">
<#form:textarea path="testTextarea" rows="4" maxlength="200" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 下拉框:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control " />
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 下拉多选:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control " />
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 单选框:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:radio path="testRadio" dictType="sys_menu_type" class="form-control " />
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 复选框:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" class="form-control " />
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 日期选择:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="testDate" readonly="true" maxlength="20" class="form-control Wdate "
dataFormat="date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 日期时间:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="testDatetime" readonly="true" maxlength="20" class="form-control Wdate "
dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 用户选择:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:treeselect id="testUser" title="用户"
path="testUser.userCode" labelPath="testUser.userName"
url="${ctx}/sys/office/treeData?isLoadUser=true"
class=" " allowClear="true"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 部门选择:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:treeselect id="testOffice" title="部门"
path="testOffice.officeCode" labelPath="testOffice.officeName"
url="${ctx}/sys/office/treeData"
class=" " allowClear="true"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 区域选择:<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:treeselect id="testAreaCode" title="区域"
path="testAreaCode" labelPath="testAreaName"
url="${ctx}/sys/area/treeData"
class=" " allowClear="true"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2" title="">
<span class="required hide">*</span> 备注信息:<i class="fa icon-question hide"></i></label>
<div class="col-sm-10">
<#form:textarea path="remarks" rows="4" maxlength="500" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="form-unit">扩展字段</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 String 1<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendS1" maxlength="500" class="form-control "/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 String 2<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendS2" maxlength="500" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 String 3<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendS3" maxlength="500" class="form-control "/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 String 4<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendS4" maxlength="500" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 String 5<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendS5" maxlength="500" class="form-control "/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 String 6<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendS6" maxlength="500" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 String 7<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendS7" maxlength="500" class="form-control "/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 String 8<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendS8" maxlength="500" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Integer 1<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendI1" maxlength="19" class="form-control digits"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Integer 2<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendI2" maxlength="19" class="form-control digits"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Integer 3<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendI3" maxlength="19" class="form-control digits"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Integer 4<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendI4" maxlength="19" class="form-control digits"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Float 1<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendF1" class="form-control number"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Float 2<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendF2" class="form-control number"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Float 3<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendF3" class="form-control number"/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Float 4<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendF4" class="form-control number"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Date 1<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendD1" maxlength="6" class="form-control "/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Date 2<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendD2" maxlength="6" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Date 3<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendD3" maxlength="6" class="form-control "/>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label col-sm-4" title="">
<span class="required hide">*</span> 扩展 Date 4<i class="fa icon-question hide"></i></label>
<div class="col-sm-8">
<#form:input path="extend.extendD4" maxlength="6" class="form-control "/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2">图片上传:</label>
<div class="col-sm-10">
<#form:fileupload id="uploadImage" bizKey="${testData.id}" bizType="testData_image"
uploadType="image" class="" readonly="false"/>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label class="control-label col-sm-2">附件上传:</label>
<div class="col-sm-10">
<#form:fileupload id="uploadFile" bizKey="${testData.id}" bizType="testData_file"
uploadType="all" class="" readonly="false"/>
</div>
</div>
</div>
</div>
</div>
<div class="box-footer">
<div class="row">
<div class="col-sm-offset-2 col-sm-10">
<% if (hasPermi('test:testData:edit')){ %>
<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> 保 存</button>&nbsp;
<% } %>
<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> 关 闭</button>
</div>
</div>
</div>
</#form:form>
</div>
</div>
<% } %>
<script>
$("#inputForm").validate({
submitHandler: function(form){
js.ajaxSubmitForm($(form), function(data){
js.showMessage(data.message);
if(data.result == Global.TRUE){
js.closeCurrentTabPage(function(contentWindow){
contentWindow.page();
});
}
}, "json");
}
});
</script>

View File

@@ -0,0 +1,173 @@
<% layout('/layouts/default.html', {title: '数据管理', libs: ['dataGrid']}){ %>
<div class="main-content">
<div class="box box-main">
<div class="box-header">
<div class="box-title">
<i class="fa fa-list-alt"></i> 数据管理
</div>
<div class="box-tools pull-right">
<a href="#" class="btn btn-default" id="btnSearch" title="查询"><i class="fa fa-filter"></i> 查询</a>
<% if(hasPermi('test:testData:edit')){ %>
<a href="${ctx}/test/testData/form" class="btn btn-default btnTool" title="新增数据"><i class="fa fa-plus"></i> 新增</a>
<% } %>
</div>
</div>
<div class="box-body">
<#form:form id="searchForm" model="${testData}" action="${ctx}/test/testData/listData" method="post" class="form-inline hide"
data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
<div class="form-group">
<label class="control-label">单行文本:</label>
<div class="control-inline">
<#form:input path="testInput" maxlength="200" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<label class="control-label">多行文本:</label>
<div class="control-inline">
<#form:input path="testTextarea" maxlength="200" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<label class="control-label">下拉框:</label>
<div class="control-inline width-120">
<#form:select path="testSelect" dictType="sys_menu_type" blankOption="true" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="control-label">下拉多选:</label>
<div class="control-inline width-120">
<#form:select path="testSelectMultiple" dictType="sys_menu_type" multiple="true" blankOption="true" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="control-label">单选框:</label>
<div class="control-inline">
<#form:radio path="testRadio" dictType="sys_menu_type" blankOption="true" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="control-label">复选框:</label>
<div class="control-inline">
<#form:checkbox path="testCheckbox" dictType="sys_menu_type" blankOption="true" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="control-label">日期选择:</label>
<div class="control-inline">
<#form:input path="testDate_gte" readonly="true" maxlength="20" class="form-control Wdate-date"
dataFormat="date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false,onpicked:function(){testDate_lte.click()}});"/>
&nbsp;--&nbsp;
<#form:input path="testDate_lte" readonly="true" maxlength="20" class="form-control Wdate-date"
dataFormat="date" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
</div>
</div>
<div class="form-group">
<label class="control-label">日期时间:</label>
<div class="control-inline">
<#form:input path="testDatetime_gte" readonly="true" maxlength="20" class="form-control Wdate-datetime"
dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false,onpicked:function(){testDatetime_lte.click()}});"/>
&nbsp;--&nbsp;
<#form:input path="testDatetime_lte" readonly="true" maxlength="20" class="form-control Wdate-datetime"
dataFormat="datetime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',isShowClear:false});"/>
</div>
</div>
<div class="form-group">
<label class="control-label">用户选择:</label>
<div class="control-inline width-120" >
<#form:treeselect id="testUser" title="用户"
path="testUser.userCode" labelPath="testUser.userName"
url="${ctx}/sys/office/treeData?isLoadUser=true" allowClear="true"/>
</div>
</div>
<div class="form-group">
<label class="control-label">部门选择:</label>
<div class="control-inline width-120" >
<#form:treeselect id="testOffice" title="部门"
path="testOffice.officeCode" labelPath="testOffice.officeName"
url="${ctx}/sys/office/treeData" allowClear="true"/>
</div>
</div>
<div class="form-group">
<label class="control-label">区域选择:</label>
<div class="control-inline width-120" >
<#form:treeselect id="testAreaCode" title="区域"
path="testAreaCode" labelPath="testAreaName"
url="${ctx}/sys/area/treeData" allowClear="true"/>
</div>
</div>
<div class="form-group">
<label class="control-label">状态:</label>
<div class="control-inline width-120">
<#form:select path="status" dictType="sys_search_status" blankOption="true" class="form-control"/>
</div>
</div>
<div class="form-group">
<label class="control-label">备注信息:</label>
<div class="control-inline">
<#form:input path="remarks" maxlength="500" class="form-control width-120"/>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-sm">查询</button>
<button type="reset" class="btn btn-default btn-sm">重置</button>
</div>
</#form:form>
<table id="dataGrid"></table>
<div id="dataGridPage"></div>
</div>
</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
searchForm: $("#searchForm"),
columnModel: [
{header:'单行文本', name:'testInput', index:'a.test_input', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
return '<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" data-title="编辑数据">'+(val||row.id)+'</a>';
}},
{header:'多行文本', name:'testTextarea', index:'a.test_textarea', width:150, align:"left"},
{header:'下拉框', name:'testSelect', index:'a.test_select', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '未知', true);
}},
{header:'下拉多选', name:'testSelectMultiple', index:'a.test_select_multiple', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '未知', true);
}},
{header:'单选框', name:'testRadio', index:'a.test_radio', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '未知', true);
}},
{header:'复选框', name:'testCheckbox', index:'a.test_checkbox', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_menu_type')}, val, '未知', true);
}},
{header:'日期选择', name:'testDate', index:'a.test_date', width:150, align:"left"},
{header:'日期时间', name:'testDatetime', index:'a.test_datetime', width:150, align:"left"},
{header:'用户选择', name:'testUser.userName', index:'a.test_user_code', width:150, align:"center"},
{header:'部门选择', name:'testOffice.officeName', index:'a.test_office_code', width:150, align:"center"},
{header:'区域选择', name:'testAreaName', index:'a.test_area_code', width:150, align:"center"},
{header:'区域名称', name:'testAreaName', index:'a.test_area_name', width:150, align:"left"},
{header:'状态', name:'status', index:'a.status', width:150, align:"center", formatter: function(val, obj, row, act){
return js.getDictLabel(${@DictUtils.getDictListJson('sys_search_status')}, val, '未知', true);
}},
{header:'创建时间', name:'createDate', index:'a.create_date', width:150, align:"left"},
{header:'备注信息', name:'remarks', index:'a.remarks', width:150, align:"left"},
{header:'操作', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
var actions = [];
<% if(hasPermi('test:testData:edit')){ %>
actions.push('<a href="${ctx}/test/testData/form?id='+row.id+'" class="btnList" title="编辑数据"><i class="fa fa-pencil"></i></a>&nbsp;');
if (row.status == Global.STATUS_NORMAL){
actions.push('<a href="${ctx}/test/testData/disable?id='+row.id+'" class="btnList" title="停用数据" data-confirm="确认要停用该数据吗?"><i class="glyphicon glyphicon-ban-circle"></i></a>&nbsp;');
}
if (row.status == Global.STATUS_DISABLE){
actions.push('<a href="${ctx}/test/testData/enable?id='+row.id+'" class="btnList" title="启用数据" data-confirm="确认要启用该数据吗?"><i class="glyphicon glyphicon-ok-circle"></i></a>&nbsp;');
}
actions.push('<a href="${ctx}/test/testData/delete?id='+row.id+'" class="btnList" title="删除数据" data-confirm="确认要删除该数据吗?"><i class="fa fa-trash-o"></i></a>&nbsp;');
<% } %>
return actions.join('');
}}
],
// 加载成功后执行事件
ajaxSuccess: function(data){
}
});
</script>