.gitignore
New file @@ -0,0 +1,36 @@ HELP.md target/ logs/ !.mvn/wrapper/maven-wrapper.jar !**/src/main/** !**/src/test/** ### STS ### .apt_generated .classpath .factorypath .project .settings .springBeans .sts4-cache ### IntelliJ IDEA ### .idea *.iws *.iml *.ipr .mvn mvnw mvnw.cmd ### NetBeans ### /nbproject/private/ /nbbuild/ /dist/ /nbdist/ /.nb-gradle/ build/ ### VS Code ### .vscode/ src/main/resources/config/code-generation.xml
@@ -12,13 +12,13 @@ <bean id="outDataSource" class="com.matrix.codeGeneration.ext.ExcelDataSource"> <property name="author" value="yourName"></property> <!-- excel所在目录 --> <property name="sourcePath" value="E:\生成代码" /> <property name="sourcePath" value="/Users/helius/utils/genarate/excel" /> <!-- 数据库类型 --> <property name="dbType" value="mysql" /> <!-- 目标代码位置 --> <property name="targetPath" value="E:\生成代码" /> <property name="targetPath" value="/Users/helius/utils/genarate/code" /> <!-- 模板文件位置 --> <property name="userTempLataHome" value="template/excelTemplateForBoot" /> <property name="userTempLataHome" value="template/excelTemplateForXc" /> <!-- <property name="userTempLataHome" value="template/excelTemplate" /> --> <property name="nameConvert"> <bean class="com.matrix.codeGeneration.ext.OracleStyleNameConvert"></bean> @@ -30,7 +30,7 @@ <entry key="MYSQL_SQL" value-ref="mysqlModel" /> <entry key="MYBATIS_DAO" value-ref="mybatisDao" /> <entry key="MYBATIS_DAO_IMPL" value-ref="mybatisDaoImpl" /> <!-- <entry key="SERVICE" value-ref="service" /> --> <entry key="SERVICE" value-ref="service" /> <!-- <entry key="SERVICE_IMPL" value-ref="serviceImpl" /> --> <entry key="ACTION" value-ref="action" /> <entry key="LIST" value-ref="list" /> @@ -54,7 +54,7 @@ <!-- javaBean类型 --> <property name="modelName" value="JAVA_BEAN" /> <!-- 包名 --> <property name="packageName" value="com.xincheng.biz2.bean" /> <property name="packageName" value="com.matrix.system.score.entity" /> <!-- 文件后缀名称 --> <property name="fileExtName" value=".java" /> <!-- 对应的framwork模板文件名称 --> @@ -66,7 +66,7 @@ <!-- dao接口类型 --> <property name="modelName" value="MYBATIS_DAO" /> <!-- 包名 --> <property name="packageName" value="com.xincheng.biz2.dao" /> <property name="packageName" value="com.matrix.system.score.dao" /> <!-- 文件后缀名称 --> <property name="fileExtName" value=".java" /> <!-- 对应的framwork模板文件名称 --> @@ -79,7 +79,7 @@ <!-- dao接口类型 --> <property name="modelName" value="MYBATIS_DAO_IMPL" /> <!-- 包名 --> <property name="packageName" value="com.xincheng.biz2.dao" /> <property name="packageName" value="com.matrix.system.score.dao" /> <!-- 文件后缀名称 --> <property name="fileExtName" value=".xml" /> <!-- 对应的framwork模板文件名称 --> @@ -92,7 +92,7 @@ <!-- dao接口类型 --> <property name="modelName" value="SERVICE" /> <!-- 包名 --> <property name="packageName" value="com.xincheng.biz2.service" /> <property name="packageName" value="com.matrix.system.score.service" /> <!-- 文件后缀名称 --> <property name="fileExtName" value=".java" /> <!-- 对应的framwork模板文件名称 --> @@ -105,7 +105,7 @@ <!-- dao接口类型 --> <property name="modelName" value="SERVICE_IMPL" /> <!-- 包名 --> <property name="packageName" value="com.xincheng.biz2.service.impl" /> <property name="packageName" value="com.matrix.system.score.service" /> <!-- 文件后缀名称 --> <property name="fileExtName" value=".java" /> <!-- 对应的framwork模板文件名称 --> @@ -118,7 +118,7 @@ <!-- dao接口类型 --> <property name="modelName" value="ACTION" /> <!-- 包名 --> <property name="packageName" value="com.xincheng.biz2.action" /> <property name="packageName" value="com.matrix.system.score.action" /> <!-- 文件后缀名称 --> <property name="fileExtName" value=".java" /> <!-- 对应的framwork模板文件名称 --> @@ -131,7 +131,7 @@ <!-- dao接口类型 --> <property name="modelName" value="LIST" /> <!-- 包名 --> <property name="packageName" value="com.xincheng.biz2.html" /> <property name="packageName" value="com.matrix.system.score.html" /> <!-- 文件后缀名称 --> <property name="fileExtName" value=".html" /> <!-- 对应的framwork模板文件名称 --> @@ -144,7 +144,7 @@ <!-- dao接口类型 --> <property name="modelName" value="FORM" /> <!-- 包名 --> <property name="packageName" value="com.xincheng.biz2.html" /> <property name="packageName" value="com.matrix.system.score.html" /> <!-- 文件后缀名称 --> <property name="fileExtName" value=".html" /> <!-- 对应的framwork模板文件名称 --> src/main/resources/template/excelTemplateForXc/action.ftl
New file @@ -0,0 +1,20 @@ package ${codeModel.packageName}; <#list importList?keys as key> import ${importList[key]}; </#list> /** * @description ${tableClassModel.tableMemo} * @author ${dataSource.author} * @date ${time} */ @RestController @RequestMapping(value = "admin/${tableClassModel.classVariableName}") public class ${ClassName} { @Autowired private ${tableClassModel.className}Service ${tableClassModel.classVariableName}Service; } src/main/resources/template/excelTemplateForXc/dao.ftl
New file @@ -0,0 +1,14 @@ package ${codeModel.packageName}; <#list importList?keys as key> import ${importList[key]}; </#list> /** * @description ${tableClassModel.tableMemo} * @author ${dataSource.author} * @date ${time} */ public interface ${ClassName} extends BaseMapper<${tableClassModel.className}>{ } src/main/resources/template/excelTemplateForXc/daoImpl.ftl
New file @@ -0,0 +1,35 @@ <?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="${tableClassModel.qualifiedClassName}"> <!-- 定义${tableClassModel.className} 的复杂关联map --> <resultMap type="${beanQualifiedClassName}" id="${tableClassModel.className}Map"> <id property="${tableClassModel.primaryKey.property}" column="${tableClassModel.primaryKey.column}" /> <result property="createBy" column="create_by" /> <result property="createTime" column="create_time" /> <result property="updateBy" column="update_by" /> <result property="updateTime" column="update_time" /> <#list tableClassModel.mapping as item> <#if !item.isPrimaryKey> <result property="${item.property}" column="${item.column}" /> </#if> </#list> </resultMap> <!-- 定义${tableClassModel.className} 的简单map ,本map不添加其他的关联属性 --> <resultMap type="${beanQualifiedClassName}" id="${tableClassModel.className}SimpleMap"> <id property="${tableClassModel.primaryKey.property}" column="${tableClassModel.primaryKey.column}" /> <result property="createBy" column="create_by" /> <result property="createTime" column="create_time" /> <result property="updateBy" column="update_by" /> <result property="updateTime" column="update_time" /> <#list tableClassModel.mapping as item> <#if !item.isPrimaryKey> <result property="${item.property}" column="${item.column}" /> </#if> </#list> </resultMap> </mapper> src/main/resources/template/excelTemplateForXc/form.ftl
New file @@ -0,0 +1,82 @@ <!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="utf-8"> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> <!-- 本框架基本脚本和样式 --> <script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> <script type="text/javascript" th:src="@{/js/systools/MBase.js}"></script> </head> <body> <div class="ibox-content"> <form class="form-horizontal" id="dataform" onsubmit="javascript:return false;"> <input type="hidden" name="tokenUrl" th:value="${'$'}{tokenUrl}"> <input type="hidden" name="token" th:value="${'$'}{token}"> <input type="hidden" name="${tableClassModel.primaryKey.property}" th:value="${'$'}{obj.${tableClassModel.primaryKey.property}}"> <#assign x = 1> <#assign nodelSize = tableClassModel.showCount+1 > <#list tableClassModel.mapping as being> <#if being.isVisible> <#assign x = x + 1> <#if x%2 = 0 > <div class="form-group"> </#if> <label class="col-sm-2 control-label">${being.showName} <#if being.isNecessary> <span class="text-danger">*</span> </#if> </label> <div class="col-sm-4"> <input type="text" class="form-control" name="${being.property}" <#if being.columnLength??> maxLength="${being.columnLength}" dataType="s1-${being.columnLength}" </#if> <#if !being.isNecessary> ignore="ignore" </#if> th:value="${'$'}{obj.${being.property}}"nullmsg="${being.showName}不能为空"> </div> <#if x%2 = 1 || x = nodelSize> </div> </#if> </#if> </#list> <div class="form-group "> <div class="col-sm-12 text-center"> <a href="javascript:;" onclick="myForm.submit()" class="btn btn-success radius"><i class="fa fa-check"></i> 保存</a> <a class="btn btn-danger radius" href="javascript:;" onclick="MTools.closeForm()" ><i class="fa fa-close"></i> 关闭</a> </div> </div> </form> </div> </body> <script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script> <script th:inline="javascript"> MTools.autoFullSelect(); $(".select2").select2(); /*<![CDATA[*/ var obj=/*[[${'$'}{obj}]]*/ /*]]>*/ var invokeUrl=basePath+"/admin/${tableClassModel.classVariableName}/add${tableClassModel.className}"; if(obj.${tableClassModel.primaryKey.property}!=null){ invokeUrl = basePath+"/admin/${tableClassModel.classVariableName}/modify${tableClassModel.className}"; } var myForm=MForm.initForm({ invokeUrl:invokeUrl, afterSubmit:function(){ parent.myGrid.serchData(); }, }); </script> </body> </html> src/main/resources/template/excelTemplateForXc/javaBean.ftl
New file @@ -0,0 +1,38 @@ package ${codeModel.packageName}; <#list importList?keys as key> import ${importList[key]}; </#list> import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** * @description ${tableClassModel.tableMemo} * @author ${dataSource.author} * @date ${time} */ @Data @TableName("${tableClassModel.tableName}") public class ${tableClassModel.className} extends BaseEntity{ @Extend private static final long serialVersionUID = 1L; <#list tableClassModel.mapping as being> <#if being.memo!="" && being.property!="createBy" && being.property!="createTime" && being.property!="updateBy" && being.property!="updateTime" && being.property!="id"> /** * ${being.memo} */ </#if> <#if being.property!="createBy" && being.property!="createTime" && being.property!="updateBy" && being.property!="updateTime" && being.property!="id"> private ${being.classType} ${being.property}; </#if> </#list> } src/main/resources/template/excelTemplateForXc/list.ftl
New file @@ -0,0 +1,161 @@ <!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml"> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="utf-8"> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> <meta http-equiv="Cache-Control" content="no-siteapp"/> <!-- 本框架基本脚本和样式 --> <script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> <script type="text/javascript" th:src="@{/js/systools/MBase.js}"></script> </head> <body class=" container-fluid"> <div class="pd-10"> <!-- 搜索框部分start --> <div class="row form-head"> <div class="col-md-4 col-xs-12"> <button onclick="myGrid.delItems('${tableClassModel.primaryKey.property}')" type="button" matrix:btn="${tableClassModel.className?uncap_first}-dels" class="btn btn-danger btn-sm"> <i class="fa fa-trash"></i>批量删除 </button> <button onclick="openAdd()" type="button" matrix:btn="${tableClassModel.className?uncap_first}-add" class="btn btn-success btn-sm"> <i class="fa fa-plus"></i> 新增 </button> </div> <div class="col-md-8 col-xs-12"> <div class="row"> <div class="col-md-11 col-xs-12" style="text-align: right"> <form class="form-inline" id="serchform" matrix:btn="${tableClassModel.className?uncap_first}-search" > <div class="input-group"> <div class="btn-group search-list " data-for="search-text"> <button type="button" class="btn btn-default dropdown-toggle searchlist" data-toggle="dropdown"> 用户姓名 <span class="caret "></span> </button> <ul class="dropdown-menu" role="menu"> <li data-field="suName"><a>用户姓名</a></li> <li data-field="suAccount"><a>账号 </a></li> </ul> </div> <div class="form-group mr-20 ml-20"> <input id="search-text" name="suName" placeholder="输入查询关键词" type="text" class="form-control"> </div> <div class="form-group"> <button onclick="myGrid.serchData(1)" type="button" class="btn btn-info"> <i class="fa fa-search "></i> 搜索 </button> <button type="reset" class="btn btn-info "> <i class="fa fa-refresh "></i> 重置 </button> </div> </div> <!-- 高级搜索 <div class="senior-content"> <div class="serch-headline">高级搜索</div> <div> <span class="serch-title">电话:</span> <input type="text" name="suTel" class="form-control"> </div> <div class="button"> <button type="button" class="btn btn-info" onclick="myGrid.serchData()">确认</button> <button type="button" class="btn btn-warning serch-close">取消</button> </div> </div> --> </form> </div> <!-- <div class="col-md-1 text-r layui-anim" data-anim="layui-anim-up"> <a class="senior-serch">高级搜索</a> </div>--> </div> </div> </div> <div class="row"> <table id="mgrid"> <thead> <tr> <th data-checkbox="true"></th> <th data-formatter="MGrid.indexfn" data-align="center" data-width="30px">序号</th> <#list tableClassModel.mapping as being> <#if being.isVisible> <th data-field="${being.property}">${being.showName}</th> </#if> </#list> <th data-align="center" data-width="195px" data-field="${tableClassModel.primaryKey.property}" data-formatter="buidOperate">操作 </th> </tr> </thead> </table> </div> </div> <script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script> <script type="text/javascript"> var myGrid; $(function () { var delUrl = ""; delUrl = basePath + "/admin/${tableClassModel.classVariableName}/del"; myGrid = MGrid.initGrid({ url: basePath + "/admin/${tableClassModel.classVariableName}/showList", delUrl: delUrl, }); }); function buidOperate(value, row, index) { var html = ""; html += '<div class="btn-group">' + '<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">' + '操作 <span class="caret"></span>' + '</button>' + '<ul class="dropdown-menu" role="menu">' + '<li><a href="javascript:void(0)" style="display:' + value + '" onClick="openEdit(\'' + value + '\')" title="编辑">编辑</a></li>' + '<li><a href="javascript:void(0)" style="display:' + value + '" onClick="myGrid.delItem(\'' + value + '\')" title="删除">删除</a></li>' + '</ul>' + '</div>'; html += ''; return html; } //打开添加界面 function openAdd() { layer.open({ type: 2, title: "添加${tableClassModel.tableMemo}", area: [MUI.SIZE_L, '400px'], maxmin: true, content: [basePath + '/admin/${tableClassModel.classVariableName}/editForm'] }); } //打开编辑界面 function openEdit(id) { layer.open({ type: 2, title: "编辑${tableClassModel.tableMemo}", area: [MUI.SIZE_L, '400px'], maxmin: true, content: [basePath + '/admin/${tableClassModel.classVariableName}/editForm?id=' + id] }); } </script> </body> </html> src/main/resources/template/excelTemplateForXc/mybatis-config.ftl
New file @@ -0,0 +1,33 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <settings> <setting name="cacheEnabled" value="false" /> <setting name="lazyLoadingEnabled" value="false" /> <setting name="multipleResultSetsEnabled" value="true" /> <setting name="useColumnLabel" value="true" /> <setting name="useGeneratedKeys" value="false" /> <setting name="defaultExecutorType" value="SIMPLE" /> <setting name="defaultStatementTimeout" value="25000" /> </settings> <typeAliases> <#list alias as item> ${item} </#list> </typeAliases> <mappers> <#list mappers as item> ${item} </#list> </mappers> </configuration> src/main/resources/template/excelTemplateForXc/service.ftl
New file @@ -0,0 +1,20 @@ package ${codeModel.packageName}; <#list importList?keys as key> import ${importList[key]}; </#list> import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** * @description ${tableClassModel.tableMemo} * @author ${dataSource.author} * @date ${time} */ @Service public class ${tableClassModel.className}Service extends ServiceImpl<${tableClassModel.className}Dao, ${tableClassModel.className}>{ } src/main/resources/template/excelTemplateForXc/sqlFile.ftl
New file @@ -0,0 +1,54 @@ /** * ${tableClassModel.tableMemo} * @author ${dataSource.author} * @date ${time} */ CREATE TABLE ${tableClassModel.tableName}( create_by varchar(100) NOT NULL COMMENT '创建人', create_time datetime NOT NULL COMMENT '创建时间', update_by varchar(100) NOT NULL COMMENT '更新人', update_time datetime NOT NULL COMMENT '更新时间', <#list tableClassModel.mapping as being> <#if being.column = tableClassModel.primaryKey.column && (being.jdbcType = "bigint" || being.jdbcType = "int")> ${being.column} ${being.fullJdbcType} ${being.isAllowNull} AUTO_INCREMENT COMMENT '${being.memo}', <#else> ${being.column} ${being.fullJdbcType} ${being.isAllowNull} COMMENT '${being.memo}', </#if> </#list> PRIMARY KEY(${tableClassModel.primaryKey.column}) )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='${tableClassModel.tableMemo}'; <#list tableClassModel.mapping as being> <#if (being.indexName)??> ALTER TABLE ${tableClassModel.tableName} ADD INDEX ${being.indexName} (${being.column}) USING BTREE ; </#if> </#list> /** * *生成菜单的sql 默认在权限管理目录下 根据不同的主键类型生成不同的菜单SQL */ <#if tableClassModel.primaryKey.fullJdbcType = "int"> INSERT INTO `sys_function` VALUES ('开发者', now(), '开发者', now(), null, '', 'biz/${tableClassModel.className?uncap_first}-list', '否', '2', 1, '${tableClassModel.tableMemo}', '4', '${tableClassModel.className?uncap_first}', '123', '是', null); <#else> INSERT INTO `sys_function` VALUES ('开发者', now(), '开发者', now(), replace(uuid(), '-', ''), '', 'biz/${tableClassModel.className?uncap_first}-list', '否', '2', '05fb2915b39b4021a51d406473f0ee91', '${tableClassModel.tableMemo}', '4', '${tableClassModel.className?uncap_first}', '123', '是', null); </#if> src/main/resources/template/excelTemplateForXc/数据字典表(模板).xlsxBinary files differ