活动管理模块添加

This commit is contained in:
dy 2021-03-24 16:58:09 +08:00
parent 042bbf4d35
commit 418863cf5c
7 changed files with 4 additions and 1244 deletions

View File

@ -78,6 +78,10 @@
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId> <artifactId>ruoyi-generator</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>sino-activity</artifactId>
</dependency>
</dependencies> </dependencies>

View File

@ -1,11 +0,0 @@
# 代码生成
gen:
# 作者
author: ruoyi
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.system
# 自动去除表前缀默认是false
autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_

View File

@ -1,127 +0,0 @@
<?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.ruoyi.generator.mapper.GenTableColumnMapper">
<resultMap type="GenTableColumn" id="GenTableColumnResult">
<id property="columnId" column="column_id" />
<result property="tableId" column="table_id" />
<result property="columnName" column="column_name" />
<result property="columnComment" column="column_comment" />
<result property="columnType" column="column_type" />
<result property="javaType" column="java_type" />
<result property="javaField" column="java_field" />
<result property="isPk" column="is_pk" />
<result property="isIncrement" column="is_increment" />
<result property="isRequired" column="is_required" />
<result property="isInsert" column="is_insert" />
<result property="isEdit" column="is_edit" />
<result property="isList" column="is_list" />
<result property="isQuery" column="is_query" />
<result property="queryType" column="query_type" />
<result property="htmlType" column="html_type" />
<result property="dictType" column="dict_type" />
<result property="sort" column="sort" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<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
</sql>
<select id="selectGenTableColumnListByTableId" parameterType="GenTableColumn" resultMap="GenTableColumnResult">
<include refid="selectGenTableColumnVo"/>
where table_id = #{tableId}
order by sort
</select>
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
order by ordinal_position
</select>
<insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
insert into gen_table_column (
<if test="tableId != null and tableId != ''">table_id,</if>
<if test="columnName != null and columnName != ''">column_name,</if>
<if test="columnComment != null and columnComment != ''">column_comment,</if>
<if test="columnType != null and columnType != ''">column_type,</if>
<if test="javaType != null and javaType != ''">java_type,</if>
<if test="javaField != null and javaField != ''">java_field,</if>
<if test="isPk != null and isPk != ''">is_pk,</if>
<if test="isIncrement != null and isIncrement != ''">is_increment,</if>
<if test="isRequired != null and isRequired != ''">is_required,</if>
<if test="isInsert != null and isInsert != ''">is_insert,</if>
<if test="isEdit != null and isEdit != ''">is_edit,</if>
<if test="isList != null and isList != ''">is_list,</if>
<if test="isQuery != null and isQuery != ''">is_query,</if>
<if test="queryType != null and queryType != ''">query_type,</if>
<if test="htmlType != null and htmlType != ''">html_type,</if>
<if test="dictType != null and dictType != ''">dict_type,</if>
<if test="sort != null">sort,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="tableId != null and tableId != ''">#{tableId},</if>
<if test="columnName != null and columnName != ''">#{columnName},</if>
<if test="columnComment != null and columnComment != ''">#{columnComment},</if>
<if test="columnType != null and columnType != ''">#{columnType},</if>
<if test="javaType != null and javaType != ''">#{javaType},</if>
<if test="javaField != null and javaField != ''">#{javaField},</if>
<if test="isPk != null and isPk != ''">#{isPk},</if>
<if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if>
<if test="isRequired != null and isRequired != ''">#{isRequired},</if>
<if test="isInsert != null and isInsert != ''">#{isInsert},</if>
<if test="isEdit != null and isEdit != ''">#{isEdit},</if>
<if test="isList != null and isList != ''">#{isList},</if>
<if test="isQuery != null and isQuery != ''">#{isQuery},</if>
<if test="queryType != null and queryType != ''">#{queryType},</if>
<if test="htmlType != null and htmlType != ''">#{htmlType},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="sort != null">#{sort},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateGenTableColumn" parameterType="GenTableColumn">
update gen_table_column
<set>
column_comment = #{columnComment},
java_type = #{javaType},
java_field = #{javaField},
is_insert = #{isInsert},
is_edit = #{isEdit},
is_list = #{isList},
is_query = #{isQuery},
is_required = #{isRequired},
query_type = #{queryType},
html_type = #{htmlType},
dict_type = #{dictType},
sort = #{sort},
update_by = #{updateBy},
update_time = sysdate()
</set>
where column_id = #{columnId}
</update>
<delete id="deleteGenTableColumnByIds" parameterType="Long">
delete from gen_table_column where table_id in
<foreach collection="array" item="tableId" open="(" separator="," close=")">
#{tableId}
</foreach>
</delete>
<delete id="deleteGenTableColumns">
delete from gen_table_column where column_id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.columnId}
</foreach>
</delete>
</mapper>

View File

@ -1,189 +0,0 @@
<?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.ruoyi.generator.mapper.GenTableMapper">
<resultMap type="GenTable" id="GenTableResult">
<id property="tableId" column="table_id" />
<result property="tableName" column="table_name" />
<result property="tableComment" column="table_comment" />
<result property="subTableName" column="sub_table_name" />
<result property="subTableFkName" column="sub_table_fk_name" />
<result property="className" column="class_name" />
<result property="tplCategory" column="tpl_category" />
<result property="packageName" column="package_name" />
<result property="moduleName" column="module_name" />
<result property="businessName" column="business_name" />
<result property="functionName" column="function_name" />
<result property="functionAuthor" column="function_author" />
<result property="genType" column="gen_type" />
<result property="genPath" column="gen_path" />
<result property="options" column="options" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
</resultMap>
<resultMap type="GenTableColumn" id="GenTableColumnResult">
<id property="columnId" column="column_id" />
<result property="tableId" column="table_id" />
<result property="columnName" column="column_name" />
<result property="columnComment" column="column_comment" />
<result property="columnType" column="column_type" />
<result property="javaType" column="java_type" />
<result property="javaField" column="java_field" />
<result property="isPk" column="is_pk" />
<result property="isIncrement" column="is_increment" />
<result property="isRequired" column="is_required" />
<result property="isInsert" column="is_insert" />
<result property="isEdit" column="is_edit" />
<result property="isList" column="is_list" />
<result property="isQuery" column="is_query" />
<result property="queryType" column="query_type" />
<result property="htmlType" column="html_type" />
<result property="dictType" column="dict_type" />
<result property="sort" column="sort" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectGenTableVo">
select table_id, table_name, table_comment, sub_table_name, sub_table_fk_name, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, gen_type, gen_path, options, create_by, create_time, update_by, update_time, remark from gen_table
</sql>
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
<include refid="selectGenTableVo"/>
<where>
<if test="tableName != null and tableName != ''">
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
</if>
<if test="tableComment != null and tableComment != ''">
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
</if>
</where>
</select>
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_schema = (select database())
AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
AND table_name NOT IN (select table_name from gen_table)
<if test="tableName != null and tableName != ''">
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
</if>
<if test="tableComment != null and tableComment != ''">
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
</if>
</select>
<select id="selectDbTableListByNames" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
and table_name in
<foreach collection="array" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</select>
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
and table_name = #{tableName}
</select>
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
FROM gen_table t
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
where t.table_id = #{tableId} order by c.sort
</select>
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult">
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
FROM gen_table t
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
where t.table_name = #{tableName} order by c.sort
</select>
<select id="selectGenTableAll" parameterType="String" resultMap="GenTableResult">
SELECT t.table_id, t.table_name, t.table_comment, t.sub_table_name, t.sub_table_fk_name, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.gen_type, t.gen_path, t.options, t.remark,
c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort
FROM gen_table t
LEFT JOIN gen_table_column c ON t.table_id = c.table_id
order by c.sort
</select>
<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
insert into gen_table (
<if test="tableName != null">table_name,</if>
<if test="tableComment != null and tableComment != ''">table_comment,</if>
<if test="className != null and className != ''">class_name,</if>
<if test="tplCategory != null and tplCategory != ''">tpl_category,</if>
<if test="packageName != null and packageName != ''">package_name,</if>
<if test="moduleName != null and moduleName != ''">module_name,</if>
<if test="businessName != null and businessName != ''">business_name,</if>
<if test="functionName != null and functionName != ''">function_name,</if>
<if test="functionAuthor != null and functionAuthor != ''">function_author,</if>
<if test="genType != null and genType != ''">gen_type,</if>
<if test="genPath != null and genPath != ''">gen_path,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="tableName != null">#{tableName},</if>
<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
<if test="className != null and className != ''">#{className},</if>
<if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
<if test="packageName != null and packageName != ''">#{packageName},</if>
<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
<if test="businessName != null and businessName != ''">#{businessName},</if>
<if test="functionName != null and functionName != ''">#{functionName},</if>
<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
<if test="genType != null and genType != ''">#{genType},</if>
<if test="genPath != null and genPath != ''">#{genPath},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateGenTable" parameterType="GenTable">
update gen_table
<set>
<if test="tableName != null">table_name = #{tableName},</if>
<if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if>
<if test="subTableName != null">sub_table_name = #{subTableName},</if>
<if test="subTableFkName != null">sub_table_fk_name = #{subTableFkName},</if>
<if test="className != null and className != ''">class_name = #{className},</if>
<if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if>
<if test="genType != null and genType != ''">gen_type = #{genType},</if>
<if test="genPath != null and genPath != ''">gen_path = #{genPath},</if>
<if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if>
<if test="packageName != null and packageName != ''">package_name = #{packageName},</if>
<if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if>
<if test="businessName != null and businessName != ''">business_name = #{businessName},</if>
<if test="functionName != null and functionName != ''">function_name = #{functionName},</if>
<if test="options != null and options != ''">options = #{options},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
update_time = sysdate()
</set>
where table_id = #{tableId}
</update>
<delete id="deleteGenTableByIds" parameterType="Long">
delete from gen_table where table_id in
<foreach collection="array" item="tableId" open="(" separator="," close=")">
#{tableId}
</foreach>
</delete>
</mapper>

View File

@ -1,607 +0,0 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改生成信息')" />
<th:block th:include="include :: select2-css" />
<style type="text/css">
.select-table table{table-layout:fixed;}.table>thead>tr>th{text-align:center;}.select-table .table td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.form-control{padding:3px 6px 4px;height:30px;}.icheckbox-blue{top:0px;left:6px;}.form-control.select2-hidden-accessible{position:static!important;}.select-table table label.error{position: inherit;}select + label.error{z-index:1;right:40px;}
</style>
</head>
<body class="gray-bg" style="font: 14px Helvetica Neue, Helvetica, PingFang SC, 微软雅黑, Tahoma, Arial, sans-serif !important;">
<section class="section-content">
<div class="row">
<div class="col-xs-12">
<div class="ibox float-e-margins">
<div class="ibox-content" style="border-style:none;">
<div class="nav-tabs-custom">
<ul class="nav nav-tabs">
<li><a href="#tab-basic" data-toggle="tab" aria-expanded="false">基本信息</a></li>
<li class="active"><a href="#tab-field" data-toggle="tab" aria-expanded="true">字段信息</a></li>
<li><a href="#tab-gen" data-toggle="tab" aria-expanded="false">生成信息</a></li>
<li class="pull-right header">
<i class="fa fa-code"></i> 生成配置
</li>
</ul>
<form id="form-gen-edit" class="form-horizontal" th:object="${table}">
<input name="tableId" type="hidden" th:field="*{tableId}" />
<div class="tab-content">
<!-- 基本信息 -->
<div class="tab-pane" id="tab-basic">
<div class="row mt20">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">表名称:</label>
<div class="col-sm-8">
<input name="tableName" class="form-control" type="text" placeholder="请输入表名称" maxlength="200" th:field="*{tableName}" required>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">表描述:</label>
<div class="col-sm-8">
<input name="tableComment" class="form-control" type="text" placeholder="请输入表描述" maxlength="500" th:field="*{tableComment}" required>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">实体类名称:</label>
<div class="col-sm-8">
<input name="className" class="form-control" type="text" placeholder="请输入实体类名称" maxlength="100" th:field="*{className}" required>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">作者:</label>
<div class="col-sm-8">
<input name="functionAuthor" class="form-control" type="text" placeholder="请输入作者" maxlength="50" th:field="*{functionAuthor}" required>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-xs-2 control-label">备注:</label>
<div class="col-xs-10">
<textarea name="remark" maxlength="500" class="form-control" rows="3"></textarea>
</div>
</div>
</div>
</div>
</div>
<!-- 字段信息 -->
<div class="tab-pane active" id="tab-field">
<div class="select-table table-striped" style="margin-top: 0px;padding-top: 0px;padding-bottom: 0px;">
<table id="bootstrap-table" data-use-row-attr-func="true" data-reorderable-rows="true"></table>
</div>
</div>
<!-- 生成信息 -->
<div class="tab-pane" id="tab-gen">
<div class="row mt20">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">生成模板:</label>
<div class="col-sm-8">
<select class='form-control' id="tplCategory" name='tplCategory' style="width: 100%">
<option value="crud" th:field="*{tplCategory}">单表(增删改查)</option>
<option value="tree" th:field="*{tplCategory}">树表(增删改查)</option>
<option value="sub" th:field="*{tplCategory}">主子表(增删改查)</option>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="生成在哪个java包下例如 com.ruoyi.project.system">生成包路径:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input name="packageName" class="form-control" type="text" placeholder="请输入生成包路径" maxlength="100" th:field="*{packageName}" required>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="可理解为子系统名,例如 system">生成模块名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input name="moduleName" class="form-control" type="text" placeholder="请输入生成模块名" maxlength="30" th:field="*{moduleName}" required>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="可理解为功能英文名,例如 user">生成业务名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input name="businessName" class="form-control" type="text" placeholder="请输入生成业务名" maxlength="50" th:field="*{businessName}" required>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="用作类描述,例如 用户">生成功能名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input name="functionName" class="form-control" type="text" placeholder="请输入生成功能名" maxlength="50" th:field="*{functionName}" required>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="分配到指定菜单下,例如 系统管理">上级菜单:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<input id="parentMenuId" name="params[parentMenuId]" type="hidden" th:value="*{parentMenuId}"/>
<div class="input-group">
<input id="parentMenuName" name="params[parentMenuName]" class="form-control" type="text" onclick="selectMenuTree()" placeholder="请选择上级菜单" maxlength="50" th:value="*{parentMenuName}" required>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label" title="默认为zip压缩包下载也可以自定义生成路径">生成代码方式:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<label class="radio-box"> <input type="radio" name="genType" value="0" th:field="*{genType}" /> zip压缩包 </label>
<label class="radio-box"> <input type="radio" name="genType" value="1" th:field="*{genType}" /> 自定义路径</label>
</div>
</div>
</div>
</div>
<div class="hidden row" id="pathinfo">
<div class="col-sm-12">
<div class="form-group">
<label class="col-xs-2 control-label" title="填写磁盘绝对路径若不填写则生成到当前Web项目下">生成基础路径:<i class="fa fa-question-circle-o"></i></label>
<div class="col-xs-10">
<div class="input-group input-group-sm">
<input id="genPath" name="genPath" class="form-control" type="text" th:field="*{genPath}" placeholder="请输入项目路径" maxlength="200">
<div class="input-group-btn">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">最近路径快速选择 <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li><a href="javascript:$('#genPath').val('/')"><i class="fa fa-refresh"></i>恢复默认的生成基础路径</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="hidden" id="subInfo">
<h4 class="form-header h4">关联信息</h4>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="关联子表的表名, 如sys_user">关联子表的表名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='type form-control' id="subTableName" name='subTableName' th:attr='data-value=*{subTableName}' style="width: 100%">
<option value="">---请选择---</option>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="子表关联的外键名, 如user_id">子表关联的外键名:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='router form-control' id="subTableFkName" name='subTableFkName' th:attr='data-value=*{subTableFkName}' style="width: 100%">
<option value="">---请选择---</option>
</select>
</div>
</div>
</div>
</div>
</div>
<div class="hidden" id="otherInfo">
<h4 class="form-header h4">其他信息</h4>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="树显示的编码字段名, 如dept_id">树编码字段:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='form-control' id="treeCode" name='params[treeCode]' style="width: 100%">
<option value="">---请选择---</option>
<option th:each="column : ${table.columns}" th:text="${column.columnName + '' + column.columnComment}" th:value="${column.columnName}" th:field="*{treeCode}"></option>
</select>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="树显示的父编码字段名, 如parent_Id">树父编码字段:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='form-control' id="treeParentCode" name='params[treeParentCode]' style="width: 100%">
<option value="">---请选择---</option>
<option th:each="column : ${table.columns}" th:text="${column.columnName + '' + column.columnComment}" th:value="${column.columnName}" th:field="*{treeParentCode}"></option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required" title="树节点的显示名称字段名, 如dept_name">树名称字段:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select class='form-control' id="treeName" name='params[treeName]' style="width: 100%">
<option value="">---请选择---</option>
<option th:each="column : ${table.columns}" th:text="${column.columnName + '' + column.columnComment}" th:value="${column.columnName}" th:field="*{treeName}"></option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="box-footer">
<div class="col-sm-offset-5 col-sm-6">
<button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
</div>
</div>
</div>
</div>
</div>
</section>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-table-reorder-js" />
<script th:src="@{/js/jquery.tmpl.js}"></script>
<th:block th:include="include :: jquery-cxselect-js" />
<script th:inline="javascript">
/* 用户信息-修改 */
$("#form-table-edit").validate({
rules: {
tableName: {
required: true,
},
},
focusCleanup: true
});
/* 表级联信息 */
var data = [[${data}]];
$('#subInfo').cxSelect({
selects: ['type', 'router'],
jsonValue: 'v',
data: data
});
function submitHandler() {
if ($.validate.form()) {
$.operate.saveTab(prefix + "/edit", $("#form-gen-edit").serializeArray());
}
}
var prefix = ctx + "tool/gen";
$(function() {
var options = {
url: prefix + "/column/list",
sortName: "sort",
sortOrder: "desc",
height: $(window).height() - 166,
pagination: false,
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
onLoadSuccess: onLoadSuccess,
onReorderRow: onReorderRow,
columns: [{
title: "序号",
width: "5%",
formatter: function (value, row, index) {
// 编号隐藏域
var columnIdHtml = $.common.sprintf("<input type='hidden' name='columns[%s].columnId' value='%s'>", index, row.columnId);
// 排序隐藏域
var sortHtml = $.common.sprintf("<input type='hidden' name='columns[%s].sort' value='%s' id='columns_sort_%s'>", index, row.sort, row.columnId);
return columnIdHtml + sortHtml + $.table.serialNumber(index);
},
cellStyle: function(value, row, index) {
return { css: { "cursor": "move" } };
}
},
{
field: 'columnName',
title: '字段列名',
width: "10%",
class: "nodrag",
cellStyle: function(value, row, index) {
return { css: { "cursor": "default" } };
}
},
{
field: 'columnComment',
title: '字段描述',
width: "10%",
formatter: function (value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].columnComment' value='%s'>", index, value);
return html;
}
},
{
field: 'columnType',
title: '物理类型',
width: "10%",
class: "nodrag",
cellStyle: function(value, row, index) {
return { css: { "cursor": "default" } };
}
},
{
field: 'javaType',
title: 'Java类型',
width: "10%",
formatter: function (value, row, index) {
var data = [{ index: index, javaType: value }];
return $("#javaTypeTpl").tmpl(data).html();
}
},
{
field: 'javaField',
title: 'Java属性',
width: "10%",
formatter: function (value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].javaField' value='%s' required>", index, value);
return html;
}
},
{
field: 'isInsert',
title: '插入',
width: "5%",
formatter: function (value, row, index) {
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);
return html;
}
},
{
field: 'isEdit',
title: '编辑',
width: "5%",
formatter: function (value, row, index) {
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);
return html;
}
},
{
field: 'isList',
title: '列表',
width: "5%",
formatter: function (value, row, index) {
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);
return html;
}
},
{
field: 'isQuery',
title: '查询',
width: "5%",
formatter: function (value, row, index) {
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);
return html;
}
},
{
field: 'queryType',
title: '查询方式',
width: "10%",
formatter: function (value, row, index) {
var data = [{ index: index, queryType: value }];
return $("#queryTypeTpl").tmpl(data).html();
}
},
{
field: 'isRequired',
title: '必填',
width: "5%",
formatter: function (value, row, index) {
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);
return html;
}
},
{
field: 'htmlType',
title: '显示类型',
width: "12%",
formatter: function (value, row, index) {
var data = [{ index: index, htmlType: value }];
return $("#htmlTypeTpl").tmpl(data).html();
}
},
{
field: 'dictType',
title: '字典类型',
width: "13%",
formatter: function (value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='columns[%s].dictType' value='%s' id='columns_dict_%s'>", index, value, row.columnId);
return "<div class='input-group'>" + html + "<span class='input-group-addon input-sm' onclick='selectDictTree(" + row.columnId + ", this)'><i class='fa fa-search'></i></span></div>";
},
cellStyle: function(value, row, index) {
return { css: { "cursor": "default" } };
}
}]
};
$.table.init(options);
});
// 当所有数据被加载时触发处理函数
function onLoadSuccess(data){
$.fn.select2.defaults.set( "theme", "bootstrap" );
$("select.form-control").each(function () {
$(this).select2().on("change", function () {
$(this).valid();
})
})
$(".check-box").each(function() {
$(this).iCheck({
checkboxClass: 'icheckbox-blue'
})
})
}
// 当拖拽结束后处理函数
function onReorderRow(data) {
for (var i = 0; i < data.length; i++) {
$("#columns_sort_" + data[i].columnId).val(i+1);
}
}
$(function() {
var tplCategory = $("#tplCategory option:selected").val();
tplCategoryVisible(tplCategory);
var genType = $('input[name="genType"]:checked').val();
pathInfoVisible(genType);
});
$('#tplCategory').on('select2:select', function (event) {
var tplCategory = $(event.target).val();
tplCategoryVisible(tplCategory);
});
function tplCategoryVisible(tplCategory) {
if("crud" == tplCategory){
$("#treeCode").select2("val", [""]);
$("#treeParentCode").select2("val", [""]);
$("#treeName").select2("val", [""]);
$("#otherInfo").addClass("hidden");
$("#subInfo").addClass("hidden");
} else if("tree" == tplCategory){
$("#otherInfo").removeClass("hidden");
$("#treeCode").attr("required", "true");
$("#treeParentCode").attr("required", "true");
$("#treeName").attr("required", "true");
$("#subInfo").addClass("hidden");
} else if("sub" == tplCategory){
$("#subInfo").removeClass("hidden");
$("#treeCode").select2("val", [""]);
$("#treeParentCode").select2("val", [""]);
$("#treeName").select2("val", [""]);
$("#subTableName").attr("required", "true");
$("#subTableFkName").attr("required", "true");
$("#otherInfo").addClass("hidden");
}
}
$('input').on('ifChecked', function(event){
var genType = $(event.target).val();
pathInfoVisible(genType);
});
function pathInfoVisible(genType) {
if("0" == genType){
$("#genPath").val("/");
$("#pathinfo").addClass("hidden");
} else if("1" == genType){
$("#pathinfo").removeClass("hidden");
}
}
// 选择字典处理函数
function selectDictTree(columnId, obj) {
var dictType = $.common.nullToStr($(obj).parent().find("input").val());
var url = ctx + "system/dict/selectDictTree/" + columnId + "/" + dictType;
var options = {
title: '选择字典类型',
width: "380",
url: url,
callBack: doDictSubmit
};
$.modal.openOptions(options);
}
// 选择菜单处理函数
function selectMenuTree() {
var parentMenuId = $("#parentMenuId").val();
var menuId = parentMenuId > 0 ? parentMenuId : 1;
var url = ctx + "system/menu/selectMenuTree/" + menuId;
var options = {
title: '菜单选择',
width: "380",
url: url,
callBack: doMenuSubmit
};
$.modal.openOptions(options);
}
function doDictSubmit(index, layero){
var body = layer.getChildFrame('body', index);
var columnId = body.find('#columnId').val();
var dictType = body.find('#dictType').val();
layer.close(index);
$("#columns_dict_" + columnId).val(dictType);
}
function doMenuSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#parentMenuId").val(body.find('#treeId').val());
$("#parentMenuName").val(body.find('#treeName').val());
layer.close(index);
}
</script>
</body>
</html>
<!-- java类型 -->
<script id="javaTypeTpl" type="text/x-jquery-tmpl">
<div>
<select class='form-control' name='columns[${index}].javaType'>
<option value="Long" {{if javaType==="Long"}}selected{{/if}}>Long</option>
<option value="String" {{if javaType==="String"}}selected{{/if}}>String</option>
<option value="Integer" {{if javaType==="Integer"}}selected{{/if}}>Integer</option>
<option value="Double" {{if javaType==="Double"}}selected{{/if}}>Double</option>
<option value="BigDecimal" {{if javaType==="BigDecimal"}}selected{{/if}}>BigDecimal</option>
<option value="Date" {{if javaType==="Date"}}selected{{/if}}>Date</option>
</select>
</div>
</script>
<!-- 查询方式 -->
<script id="queryTypeTpl" type="text/x-jquery-tmpl">
<div>
<select class='form-control' name='columns[${index}].queryType'>
<option value="EQ" {{if queryType==="EQ"}}selected{{/if}}>=</option>
<option value="NE" {{if queryType==="NE"}}selected{{/if}}>!=</option>
<option value="GT" {{if queryType==="GT"}}selected{{/if}}>></option>
<option value="GTE" {{if queryType==="GTE"}}selected{{/if}}>>=</option>
<option value="LT" {{if queryType==="LT"}}selected{{/if}}><</option>
<option value="LTE" {{if queryType==="LTE"}}selected{{/if}}><=</option>
<option value="LIKE" {{if queryType==="LIKE"}}selected{{/if}}>Like</option>
<option value="BETWEEN" {{if queryType==="BETWEEN"}}selected{{/if}}>Between</option>
</select>
</div>
</script>
<!-- 显示类型 -->
<script id="htmlTypeTpl" type="text/x-jquery-tmpl">
<div>
<select class='form-control' name='columns[${index}].htmlType'>
<option value="input" {{if htmlType==="input"}}selected{{/if}}>文本框</option>
<option value="textarea" {{if htmlType==="textarea"}}selected{{/if}}>文本域</option>
<option value="select" {{if htmlType==="select"}}selected{{/if}}>下拉框</option>
<option value="radio" {{if htmlType==="radio"}}selected{{/if}}>单选框</option>
<option value="checkbox" {{if htmlType==="checkbox"}}selected{{/if}}>复选框</option>
<option value="summernote" {{if htmlType==="summernote"}}selected{{/if}}>富文本</option>
<option value="datetime" {{if htmlType==="datetime"}}selected{{/if}}>日期控件</option>
<option value="upload" {{if htmlType==="upload"}}selected{{/if}}>上传控件</option>
</select>
</div>
</script>

View File

@ -1,209 +0,0 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('代码生成列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="gen-form">
<div class="select-list">
<ul>
<li>
表名称:<input type="text" name="tableName"/>
</li>
<li>
表描述:<input type="text" name="tableComment"/>
</li>
<li class="select-time">
<label>表时间: </label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success multiple disabled" onclick="javascript:batchGenCode()" shiro:hasPermission="tool:gen:code">
<i class="fa fa-download"></i> 生成
</a>
<a class="btn btn-info" onclick="importTable()">
<i class="fa fa-upload"></i> 导入
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="tool:gen:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="tool:gen:remove">
<i class="fa fa-remove"></i> 删除
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-table-export-js" />
<script th:src="@{/ajax/libs/highlight/highlight.min.js}"></script>
<script th:inline="javascript">
var prefix = ctx + "tool/gen";
var editFlag = [[${@permission.hasPermi('tool:gen:edit')}]];
var removeFlag = [[${@permission.hasPermi('tool:gen:remove')}]];
var previewFlag = [[${@permission.hasPermi('tool:gen:preview')}]];
var codeFlag = [[${@permission.hasPermi('tool:gen:code')}]];
$(function() {
var options = {
url: prefix + "/list",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
sortName: "createTime",
sortOrder: "desc",
showExport: true,
modalName: "生成配置",
rememberSelected: true,
uniqueId: "tableId",
columns: [{
field: 'state',
checkbox: true
},
{
field: 'tableId',
title: '编号',
visible: false
},
{
title: "序号",
formatter: function (value, row, index) {
return $.table.serialNumber(index);
}
},
{
field: 'tableName',
title: '表名称',
sortable: true,
formatter: function(value, row, index) {
return $.table.tooltip(value);
}
},
{
field: 'tableComment',
title: '表描述',
sortable: true,
formatter: function(value, row, index) {
return $.table.tooltip(value, 15);
}
},
{
field: 'className',
title: '实体类名称',
sortable: true
},
{
field: 'createTime',
title: '创建时间',
sortable: true
},
{
field: 'updateTime',
title: '更新时间',
sortable: true
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-info btn-xs ' + previewFlag + '" href="javascript:void(0)" onclick="preview(\'' + row.tableId + '\')"><i class="fa fa-search"></i>预览</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.tableId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.tableId + '\')"><i class="fa fa-remove"></i>删除</a> ');
actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="synchDb(\'' + row.tableName + '\')"><i class="fa fa-refresh"></i>同步</a> ');
actions.push('<a class="btn btn-primary btn-xs ' + codeFlag + '" href="javascript:void(0)" onclick="genCode(\'' + row.tableName + '\',\'' + row.genType + '\')"><i class="fa fa-bug"></i>生成代码</a> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
// 预览代码
function preview(tableId) {
var preViewUrl = prefix + "/preview/" + tableId;
$.modal.loading("正在加载数据,请稍后...");
$.get(preViewUrl, function(result) {
if (result.code == web_status.SUCCESS) {
var items = [];
$.each(result.data, function(index, value) {
var templateName = index.substring(index.lastIndexOf("/") + 1, index.length).replace(/\.vm/g, "");
if(!$.common.equals("sql", templateName) && !$.common.equals("tree.html", templateName) && !$.common.equals("sub-domain.java", templateName)){
var language = templateName.substring(templateName.lastIndexOf(".") + 1);
var highCode = hljs.highlight(language, value).value;
items.push({
title: templateName , content: "<pre class=\"layui-code\"><code>" + highCode + "</code></pre>"
})
}
});
top.layer.tab({
area: ['90%', '90%'],
shadeClose: true,
success: function(layero, index){
parent.loadCss(ctx + "ajax/libs/highlight/default.min.css");
},
tab: items
});
} else {
$.modal.alertError(result.msg);
}
$.modal.closeLoading();
});
}
// 生成代码
function genCode(tableName, genType) {
$.modal.confirm("确定要生成" + tableName + "表代码吗?", function() {
if(genType === "0") {
location.href = prefix + "/download/" + tableName;
layer.msg('执行成功,正在生成代码请稍后…', { icon: 1 });
} else if(genType === "1") {
$.operate.get(prefix + "/genCode/" + tableName);
}
})
}
// 同步数据库
function synchDb(tableName){
$.modal.confirm("确认要强制同步" + tableName + "表结构吗?", function() {
$.operate.get(prefix + "/synchDb/" + tableName);
})
}
// 批量生成代码
function batchGenCode() {
var rows = $.table.selectColumns("tableName");
if (rows.length == 0) {
$.modal.alertWarning("请选择要生成的数据");
return;
}
$.modal.confirm("确认要生成选中的" + rows.length + "条数据吗?", function() {
location.href = prefix + "/batchGenCode?tables=" + rows;
layer.msg('执行成功,正在生成代码请稍后…', { icon: 1 });
});
}
// 导入表结构
function importTable() {
var importTableUrl = prefix + "/importTable";
$.modal.open("导入表结构", importTableUrl);
}
</script>
</body>
</html>

View File

@ -1,101 +0,0 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('导入表结构')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="gen-form">
<div class="select-list">
<ul>
<li>
表名称:<input type="text" name="tableName"/>
</li>
<li>
表描述:<input type="text" name="tableComment"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">
var prefix = ctx + "tool/gen";
$(function() {
var options = {
url: prefix + "/db/list",
sortName: "createTime",
sortOrder: "desc",
showSearch: false,
showRefresh: false,
showToggle: false,
showColumns: false,
clickToSelect: true,
rememberSelected: true,
uniqueId: "tableName",
columns: [{
field: 'state',
checkbox: true
},
{
title: "序号",
formatter: function (value, row, index) {
return $.table.serialNumber(index);
}
},
{
field: 'tableName',
title: '表名称',
sortable: true,
formatter: function(value, row, index) {
return $.table.tooltip(value);
}
},
{
field: 'tableComment',
title: '表描述',
sortable: true,
formatter: function(value, row, index) {
return $.table.tooltip(value);
}
},
{
field: 'createTime',
title: '创建时间',
sortable: true
},
{
field: 'updateTime',
title: '更新时间',
sortable: true
}]
};
$.table.init(options);
});
/* 导入表结构-选择表结构-提交 */
function submitHandler() {
var rows = $.table.selectColumns("tableName");
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
var data = {"tables": rows.join()};
$.operate.save(prefix + "/importTable", data);
}
</script>
</body>
</html>