1 Star 0 Fork 955

cqmrzeng/autoCode

forked from tanghc/code-gen 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
update-2016-4-12-bui.sql 19.62 KB
一键复制 编辑 原始数据 按行查看 历史
tanghc 提交于 2016-05-09 16:24 . 更新模板
insert into `template_config` (`name`, `save_path`, `suffix`, `file_name`, `content`, `back_user`) values('bui_Entity','entity','java','${context.javaBeanName}.java','package ${context.packageName}.entity;\n\n/**\n ${table.comment}\n*/\npublic class ${context.javaBeanName} {\n#foreach($column in $columns)\n // ${column.comment}\n private ${column.javaTypeBox} ${column.javaFieldName};\n#end\n\n#foreach(${column} in ${columns}) \n public void set${column.javaFieldNameUF}(${column.javaTypeBox} ${column.javaFieldName}){\n this.${column.javaFieldName} = ${column.javaFieldName};\n }\n\n public ${column.javaTypeBox} get${column.javaFieldNameUF}(){\n return this.${column.javaFieldName};\n }\n\n#end\n}','admin');
insert into `template_config` (`name`, `save_path`, `suffix`, `file_name`, `content`, `back_user`) values('bui_DAO','dao','java','${context.javaBeanName}Dao.java','package ${context.packageName}.dao;\n\nimport org.durcframework.core.dao.BaseDao;\nimport ${context.packageName}.entity.${context.javaBeanName};\n\npublic interface ${context.javaBeanName}Dao extends BaseDao<${context.javaBeanName}> {\n}','admin');
insert into `template_config` (`name`, `save_path`, `suffix`, `file_name`, `content`, `back_user`) values('bui_Service','service','java','${context.javaBeanName}Service.java','package ${context.packageName}.service;\n\nimport org.durcframework.core.service.CrudService;\nimport ${context.packageName}.dao.${context.javaBeanName}Dao;\nimport ${context.packageName}.entity.${context.javaBeanName};\nimport org.springframework.stereotype.Service;\n\n@Service\npublic class ${context.javaBeanName}Service extends CrudService<${context.javaBeanName}, ${context.javaBeanName}Dao> {\n\n}','admin');
insert into `template_config` (`name`, `save_path`, `suffix`, `file_name`, `content`, `back_user`) values('bui_Mybatis','mapper','xml','${context.javaBeanNameLF}Mapper.xml','<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\" >\n<!-- \n This file is automatically generated by autoCode(https://git.oschina.net/durcframework/autoCode)\n-->\n<mapper namespace=\"${context.packageName}.dao.${context.javaBeanName}Dao\">\n <!-- \n 字段备注信息:\n#foreach($column in $columns)\n ${column.columnName} : ${column.comment}\n#end\n -->\n <resultMap id=\"queryResultMap\" type=\"${context.packageName}.entity.${context.javaBeanName}\">\n #foreach($column in $columns)\n <result column=\"${column.columnName}\" property=\"${column.javaFieldName}\" jdbcType=\"${column.mybatisJdbcType}\" />\n #end\n </resultMap>\n \n <!-- 根据条件查询记录 -->\n <select id=\"find\" parameterType=\"org.durcframework.core.expression.ExpressionQuery\"\n resultMap=\"queryResultMap\">\n SELECT \n #set ($i=0) \n #foreach($column in $columns) \n #if($i > 0),#end t.${column.columnName}\n#set($i=$i +1) \n #end\n FROM ${table.tableName} t\n <include refid=\"expressionBlock.where\" />\n <choose>\n <when test=\"sortname == null\">\n ORDER BY t.${context.pkName} desc\n </when>\n <otherwise>\n ORDER BY ${order}\n </otherwise>\n </choose>\n <if test=\"!isQueryAll\">\n LIMIT\n #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}\n </if>\n </select>\n\n <!-- 根据条件查询记录数 -->\n <select id=\"findTotalCount\" parameterType=\"org.durcframework.core.expression.ExpressionQuery\"\n resultType=\"java.lang.Integer\">\n SELECT count(*) FROM ${table.tableName} t\n <include refid=\"expressionBlock.where\" />\n </select>\n\n <!-- 保存,保存全部字段 -->\n <insert id=\"save\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\"\n#if(${pkColumn.isIdentity})\n keyProperty=\"${context.javaPkName}\" keyColumn=\"${context.pkName}\" useGeneratedKeys=\"true\"\n#end\n >\n INSERT INTO ${table.tableName}\n (\n #set ($i=0) \n #foreach($column in $columns) \n #if(!${column.isIdentityPk}) \n #if($i > 0),#end `${column.columnName}`\n#set($i=$i +1)\n #end \n #end\n )\n VALUES (\n #set ($i=0) \n #foreach($column in $columns) \n #if(!${column.isIdentityPk}) \n #if($i > 0),#end #{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\n#set($i=$i +1)\n #end \n #end\n \n )\n </insert>\n \n <!-- 保存,保存不为NULL的字段 -->\n <insert id=\"saveNotNull\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\"\n #if(${pkColumn.isIdentity})\n keyProperty=\"${context.javaPkName}\" keyColumn=\"${context.pkName}\" useGeneratedKeys=\"true\"\n #end\n >\n INSERT INTO ${table.tableName}\n \n <trim prefix=\"(\" suffix=\")\" suffixOverrides=\",\"> \n\n #foreach($column in $columns) \n #if(!${column.isIdentityPk}) \n <if test=\"${column.javaFieldName} != null\">\n `${column.columnName}`,\n </if>\n #end \n #end\n </trim>\n <trim prefix=\"values (\" suffix=\")\" suffixOverrides=\",\"> \n #foreach($column in $columns) \n #if(!${column.isIdentityPk}) \n <if test=\"${column.javaFieldName} != null\" >\n #{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}, \n </if>\n #end \n #end\n </trim>\n </insert>\n\n <!-- 更新,更新全部字段 -->\n <update id=\"update\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\n UPDATE ${table.tableName}\n <set> \n #foreach($column in $columns) \n #if(!${column.isPk}) \n ${column.columnName}=#{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}, \n #end \n #end\n </set> \n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\n </update>\n \n <!-- 根据指定条件更新 -->\n <update id=\"updateByExpression\">\n UPDATE ${table.tableName}\n <set> \n #foreach($column in $columns) \n #if(!${column.isPk}) \n ${column.columnName}=#{entity.${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}, \n #end \n #end\n </set>\n <include refid=\"expressionBlock.updateWhere\" />\n </update>\n \n <!-- 更新不为NULL的字段 -->\n <update id=\"updateNotNull\" parameterType=\"app.entity.OrderInfo\">\n UPDATE ${table.tableName}\n <set>\n #foreach($column in $columns) \n #if(!${column.isPk}) \n <if test=\"${column.javaFieldName} != null\" >\n ${column.columnName}=#{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}, \n </if>\n #end \n #end\n </set>\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\n </update>\n \n <!-- 根据指定条件更新不为NULL的字段 -->\n <update id=\"updateNotNullByExpression\">\n UPDATE ${table.tableName}\n <set>\n #foreach($column in $columns) \n #if(!${column.isPk}) \n <if test=\"entity.${column.javaFieldName} != null\" >\n ${column.columnName}=#{entity.${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}, \n </if>\n #end \n #end\n </set>\n <include refid=\"expressionBlock.updateWhere\" />\n </update>\n\n <!-- 根据主键获取单条记录 -->\n <select id=\"get\" resultMap=\"queryResultMap\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\n SELECT \n #set ($i=0) \n #foreach($column in $columns) \n #if($i > 0),#end t.${column.columnName}\n#set($i=$i +1) \n #end\n FROM ${table.tableName} t\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\n </select>\n \n <!-- 根据条件获取单条记录 -->\n <select id=\"getByExpression\" resultMap=\"queryResultMap\" parameterType=\"org.durcframework.core.expression.ExpressionQuery\">\n SELECT\n #set ($i=0) \n #foreach($column in $columns) \n #if($i > 0),#end t.${column.columnName}\n #set($i=$i +1) \n #end\n FROM ${table.tableName} t\n <include refid=\"expressionBlock.where\" />\n </select>\n \n <!-- 根据主键删除记录 -->\n <delete id=\"del\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\n DELETE FROM ${table.tableName}\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\n </delete> \n \n <!-- 根据条件删除记录 -->\n <delete id=\"delByExpression\" parameterType=\"org.durcframework.core.expression.ExpressionQuery\">\n DELETE FROM ${table.tableName}\n <include refid=\"expressionBlock.where\" />\n </delete>\n\n</mapper>','admin');
insert into `template_config` (`name`, `save_path`, `suffix`, `file_name`, `content`, `back_user`) values('bui_Controller','controller','java','${context.javaBeanName}Controller.java','package ${context.packageName}.controller;\n\nimport org.durcframework.core.GridResult;\nimport org.durcframework.core.MessageResult;\nimport org.durcframework.core.controller.CrudController;\nimport ${context.packageName}.entity.${context.javaBeanName};\nimport ${context.packageName}.entity.${context.javaBeanName}Sch;\nimport ${context.packageName}.service.${context.javaBeanName}Service;\nimport org.springframework.stereotype.Controller;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.bind.annotation.ResponseBody;\n\n@Controller\npublic class ${context.javaBeanName}Controller extends\n CrudController<${context.javaBeanName}, ${context.javaBeanName}Service> {\n\n @RequestMapping(\"/add${context.javaBeanName}.do\")\n public @ResponseBody\n MessageResult add${context.javaBeanName}(${context.javaBeanName} entity) {\n return this.save(entity);\n }\n\n @RequestMapping(\"/list${context.javaBeanName}.do\")\n public @ResponseBody\n GridResult list${context.javaBeanName}(${context.javaBeanName}Sch searchEntity) {\n return this.query(searchEntity);\n }\n\n @RequestMapping(\"/update${context.javaBeanName}.do\")\n public @ResponseBody\n MessageResult update${context.javaBeanName}(${context.javaBeanName} entity) {\n return this.update(entity);\n }\n\n @RequestMapping(\"/del${context.javaBeanName}.do\")\n public @ResponseBody\n MessageResult del${context.javaBeanName}(${context.javaBeanName} entity) {\n return this.delete(entity);\n }\n \n}','admin');
insert into `template_config` (`name`, `save_path`, `suffix`, `file_name`, `content`, `back_user`) values('bui_jsp','jsp',NULL,'${context.javaBeanNameLF}.jsp','#set($jq=\"$\")\n<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\"\n pageEncoding=\"UTF-8\"%>\n<%@ include file=\"taglib.jsp\" %>\n<c:set var=\"bui\" value=\"${jq}{res}bui/\"/>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n <head>\n <title>后台管理</title>\n <script type=\"text/javascript\">var ctx = \'${ctx}\';</script>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <link href=\"${jq}{bui}css/dpl-min.css\" rel=\"stylesheet\" type=\"text/css\" />\n <link href=\"${jq}{bui}css/bui-min.css\" rel=\"stylesheet\" type=\"text/css\" />\n <link href=\"${jq}{bui}css/page-min.css\" rel=\"stylesheet\" type=\"text/css\" />\n </head>\n<body>\n \n <div class=\"container\">\n <div class=\"row\">\n <form id=\"searchForm\" class=\"form-horizontal\">\n <div class=\"row\"> \n #foreach($column in $columns)\n #if(!${column.isIdentityPk})\n <div class=\"control-group span8\">\n <label class=\"control-label\">${column.javaFieldName}:</label>\n <div class=\"controls\">\n <input type=\"text\" class=\"control-text\" name=\"${column.javaFieldName}Sch\">\n </div>\n </div> \n #end\n #end\n\n\n <div class=\"control-group\">\n <div class=\"controls\">\n <button type=\"button\" id=\"schBtn\" class=\"button button-primary\">搜索</button>\n </div>\n </div>\n </div>\n </form>\n </div>\n <hr>\n <div class=\"search-grid-container\">\n <div id=\"grid\"></div>\n </div>\n </div>\n \n <div id=\"content\" class=\"hide\">\n <form id=\"J_Form\" class=\"form-horizontal\"> \n #foreach($column in $columns)\n #if(!${column.isIdentityPk}) \n <div class=\"row\">\n <div class=\"control-group span8\">\n <label class=\"control-label\"><s>*</s>${column.javaFieldName}</label>\n <div class=\"controls\">\n <input name=\"${column.javaFieldName}\" data-rules=\"{required:true}\" class=\"input-normal control-text\" type=\"text\"/>\n </div>\n </div>\n </div>\n #end\n #end \n\n </form>\n </div>\n \n <script type=\"text/javascript\" src=\"${jq}{bui}js/jquery-1.8.1.min.js\"></script>\n <script type=\"text/javascript\" src=\"${jq}{bui}js/bui-min.js\"></script>\n <script type=\"text/javascript\" src=\"${jq}{res}js/common.js\"></script>\n \n<script type=\"text/javascript\">\n${jq}(function(){\n var TYPE_ADD = \'add\', TYPE_EDIT = \'update\',TYPE_REMOVE = \'remove\';\n \n var listUrl = ctx + \'list${context.javaBeanName}.do\'; // 查询\n var addUrl = ctx + \'add${context.javaBeanName}.do\'; // 添加\n var updateUrl = ctx + \'update${context.javaBeanName}.do\'; // 修改\n var delUrl = ctx + \'del${context.javaBeanName}.do\'; // 删除\n var exportUrl = ctx + \'export${context.javaBeanName}.do\'; // 导出 \n \n var Grid = BUI.Grid;\n var Store = BUI.Data.Store;\n var Form = BUI.Form;\n \n var grid; // 表格\n var store; // 数据\n var schForm; // 查询form\n var editing;// 编辑表单\n\n function init() {\n initForm();\n initData();\n initEditing();\n initGrid();\n initEvent();\n }\n \n function initForm() {\n var formCfg = {\n srcNode : \'#searchForm\' \n ,value : {}\n };\n schForm = new Form.HForm(formCfg);\n schForm.render();\n }\n \n function initData() {\n store = new Store({\n url : listUrl,\n autoLoad:true,\n totalProperty:\'total\',\n pageSize:10, // 配置分页数目\n proxy : {\n save : { //也可以是一个字符串,那么增删改,都会往那么路径提交数据,同时附加参数saveType\n addUrl : addUrl,\n updateUrl : updateUrl,\n removeUrl : delUrl\n }\n ,method:\'POST\'\n }\n \n });\n }\n \n function initEditing() {\n editing = new BUI.Editor.DialogEditor({\n contentId:\'content\'\n ,form:{srcNode:${jq}(\'#J_Form\')}\n ,buttons:[\n {text:\'确定\',elCls : \'button button-primary\',handler : function(){\n save();\n }}\n ,{text:\'取消\',elCls : \'button\',handler : function(){\n this.close();\n }}\n ]\n });\n }\n \n function initGrid() {\n var columns = [\n #set($i=0)\n#foreach($column in $columns)\n #if(!${column.isIdentityPk}) \n #if($i>0),#end {title:\'${column.javaFieldName}\',dataIndex:\'${column.javaFieldName}\'}\n #set($i=$i+1)\n #end \n#end \n ,{title:\'操作\',dataIndex:\'\',width:200,renderer : function(value,obj){\n var updateStr = \'<span class=\"grid-command btn-edit\">修改</span>\';\n var delStr = \'<span class=\"grid-command btn-del\">删除</span>\';\n return updateStr + delStr;\n }}\n ]; \n \n grid = new Grid.Grid({\n render:\'#grid\'\n ,columns : columns\n ,loadMask: true\n ,store: store\n ,emptyDataTpl : \'<div class=\"centered\"><h2>查询的数据不存在</h2></div>\'\n ,tbar : {\n items : [\n {text : \'<i class=\"icon-plus\"></i>新建\',btnCls : \'button button-small\',handler:add}\n ,{text : \'<i class=\"icon-download\"></i>导出\',btnCls : \'button button-small\',handler:exportFile}\n ]\n }\n // 底部工具栏\n ,bbar:{\n // pagingBar:表明包含分页栏\n pagingBar:true\n }\n });\n\n grid.render();\n }\n \n function initEvent() {\n //监听事件,删除一条记录\n grid.on(\'cellclick\',function(ev){\n var sender = ${jq}(ev.domTarget); //点击的Dom\n if(sender.hasClass(\'btn-del\')){\n var record = ev.record;\n del(record);\n }\n if(sender.hasClass(\'btn-edit\')){\n var record = ev.record;\n edit(record);\n }\n });\n \n ${jq}(\'#schBtn\').on(\'click\',function(ev){\n ev.preventDefault();\n search();\n });\n }\n \n \n //////// functions ////////\n \n function search() {\n var param = schForm.serializeToObject();\n param.start = 0;\n store.load(param);\n }\n \n function exportFile() {\n var data = schForm.serializeToObject();\n ExportUtil.doExport(exportUrl,data);\n }\n \n function save() {\n editing.valid();\n if(editing.isValid()) {\n var editType = editing.get(\'editType\');\n var form = editing.get(\'form\');\n var curRecord = editing.get(\'record\'); // 表格中的数据\n var record = form.serializeToObject(); // 表单数据\n \n BUI.mix(curRecord,record); // 将record赋值到curRecord中\n \n store.save(editType,curRecord,function(){\n store.load();\n editing.close();\n })\n }\n }\n \n function add(){\n editing.set(\'editType\',TYPE_ADD);\n showEditor({});\n }\n \n function edit(record) {\n editing.set(\'editType\',TYPE_EDIT);\n showEditor(record);\n }\n \n function showEditor(record) {\n editing.set(\'record\',record);\n editing.show();\n editing.setValue(record,true); //设置值,并且隐藏错误\n }\n \n function del(record){\n if(record){\n BUI.Message.Confirm(\'确认要删除选中的记录么?\',function(){\n store.save(TYPE_REMOVE,record,function(){\n store.load();\n })\n },\'question\');\n }\n }\n \n init();\n \n});\n</script>\n\n</body>\n</html>\n','admin');
insert into `template_config` (`name`, `save_path`, `suffix`, `file_name`, `content`, `back_user`) values('bui_SearchEntity','entity',NULL,'${context.javaBeanName}Sch.java','package ${context.packageName}.entity;\n\nimport org.durcframework.core.expression.annotation.ValueField;\nimport org.durcframework.core.support.SearchBUI;\n\npublic class ${context.javaBeanName}Sch extends SearchBUI {\n\n#foreach($column in $columns) \n private ${column.javaTypeBox} ${column.javaFieldName}Sch;\n#end\n\n#foreach(${column} in ${columns}) \n public void set${column.javaFieldNameUF}Sch(${column.javaTypeBox} ${column.javaFieldName}Sch){\n this.${column.javaFieldName}Sch = ${column.javaFieldName}Sch;\n }\n \n @ValueField(column = \"${column.columnName}\")\n public ${column.javaTypeBox} get${column.javaFieldNameUF}Sch(){\n return this.${column.javaFieldName}Sch;\n }\n\n#end\n\n}','admin');
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cqmrzeng/autoCode.git
git@gitee.com:cqmrzeng/autoCode.git
cqmrzeng
autoCode
autoCode
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385