1 Star 0 Fork 955

cqmrzeng/autoCode

forked from tanghc/code-gen 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vui.sql 16.94 KB
一键复制 编辑 原始数据 按行查看 历史
tanghc 提交于 2016-08-04 16:48 . 更新模板
insert into `template_config` (`name`, `save_path`, `suffix`, `file_name`, `content`, `back_user`) values('v_Entity','entity',NULL,'${context.javaBeanName}.java','package ${context.packageName}.entity;\n\n#if( \"${table.comment}\" != \"\" )\n/**\n ${table.comment}\n*/\n#end\npublic class ${context.javaBeanName} {\n#foreach($column in $columns)\n#if( \"${column.comment}\" != \"\" )\n // ${column.comment}\n#end\n private ${column.javaTypeBox} ${column.javaFieldName};\n#end\n\n#foreach(${column} in ${columns})\n#if( \"${column.comment}\" != \"\" )\n /** 设置 ${column.comment},对应字段 ${table.tableName}.${column.columnName} */\n#end \n public void set${column.javaFieldNameUF}(${column.javaTypeBox} ${column.javaFieldName}){\n this.${column.javaFieldName} = ${column.javaFieldName};\n }\n#if( \"${column.comment}\" != \"\" )\n /** 获取 ${column.comment},对应字段 ${table.tableName}.${column.columnName} */\n#end \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('v_DAO','dao',NULL,'${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('v_Service','service',NULL,'${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('v_SearchEntity','entity',NULL,'${context.javaBeanName}Sch.java','package ${context.packageName}.entity;\n\nimport org.durcframework.core.expression.annotation.ValueField;\nimport org.durcframework.core.support.SearchEasyUI;\n\npublic class ${context.javaBeanName}Sch extends SearchEasyUI {\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');
insert into `template_config` (`name`, `save_path`, `suffix`, `file_name`, `content`, `back_user`) values('v_Controller','controller',NULL,'${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 MessageResult add${context.javaBeanName}(${context.javaBeanName} entity) {\n return this.save(entity);\n }\n\n @RequestMapping(\"/list${context.javaBeanName}.do\")\n public @ResponseBody GridResult list${context.javaBeanName}(${context.javaBeanName}Sch searchEntity) {\n return this.query(searchEntity);\n }\n\n @RequestMapping(\"/update${context.javaBeanName}.do\")\n public @ResponseBody MessageResult update${context.javaBeanName}(${context.javaBeanName} entity) {\n return this.update(entity);\n }\n\n @RequestMapping(\"/del${context.javaBeanName}.do\")\n public @ResponseBody 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('v_Mybatis','mapper',NULL,'${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 <resultMap id=\"queryResultMap\" type=\"${context.packageName}.entity.${context.javaBeanName}\">\n #foreach($column in $columns)\n #if( \"${column.comment}\" != \"\" )\n <!-- ${column.comment} -->\n #end\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=\"${context.packageName}.entity.${context.javaBeanName}\">\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('v_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<!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 </head>\n<body>\n <form id=\"searchForm\">\n <table>\n <tr>\n#foreach($column in $columns)\n #if(!${column.isIdentityPk})\n <th>${column.javaFieldName}:</th><td><input type=\"text\" name=\"${column.javaFieldName}Sch\"></td> \n #end\n#end\n <td>\n <button type=\"button\" id=\"schBtn\" class=\"button button-primary\">搜索</button>\n </td>\n </tr>\n </table>\n <button type=\"button\" id=\"schBtn\" class=\"button button-primary\">搜索</button>\n </form>\n <hr>\n <div class=\"grid-bar\"> \n <button type=\"button\" id=\"addBtn\" class=\"button button-primary\">新增</button> \n </div>\n \n <div id=\"grid\"></div>\n \n <div id=\"dlg\" class=\"hide\">\n <form id=\"editForm\">\n <input type=\"hidden\" name=\"orderId\">\n <table>\n #foreach($column in $columns)\n #if(!${column.isIdentityPk}) \n <tr> \n <th><s>*</s>${column.javaFieldName}</th>\n <td>\n <input name=\"${column.javaFieldName}\" \n rules=\"[\n {rule:{notNull:true},errorMsg:\'不能为空\'}\n ]\"\n type=\"text\"/>\n </td> \n </tr>\n #end\n #end \n\n </table>\n </form>\n </div>\n \n\n<script type=\"text/javascript\">\n\nVUI.use([\'PageForm\'],function(){\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 ${jq}schBtn = ${jq}(\'#schBtn\'); // 查询按钮\n var ${jq}addBtn = ${jq}(\'#addBtn\'); // 添加按钮\n var ${jq}exportBtn = ${jq}(\'#exportBtn\');\n \n var grid; // 表格\n var schForm,pageForm; \n var dialog;// 编辑表单\n\n function init() {\n initEditing();\n initGrid();\n initEvent();\n initForm();\n }\n \n function initForm() {\n schForm = new VUI.Form({formId:\'searchForm\'});\n \n pageForm = new VUI.PageForm({\n formId:\'editForm\'\n ,grid:grid\n ,win:dialog\n ,crudUrl:{\n add:addUrl\n ,update:updateUrl\n ,del:delUrl\n }\n });\n }\n \n function initEditing() {\n dialog = new VUI.DialogForm({\n contentId:\'dlg\'\n ,formId:\'editForm\'\n ,onOk:function(){\n save();\n }\n });\n }\n \n function initGrid() {\n \n grid = new VUI.Grid({\n renderId:\'grid\'\n ,url:listUrl\n ,columns : [[\n {title:\'订单编号\',field:\'orderId\'}\n ,{title:\'手机号\',field:\'mobile\'}\n ,{title:\'城市名\',field:\'cityName\'}\n ,{title:\'地址\',field:\'address\'}\n ,{title:\'下单时间\',field:\'createDate\'}\n ,{title:\'操作\',field:\'\',width:200,formatter : 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 ,striped:true // 斑马线\n ,pagination :true\n ,rownumbers :true\n });\n\n }\n \n function initEvent() {\n grid.on(\'ClickCell\',function(ev){\n var sender = ${jq}(ev.target); //点击的Dom\n if(sender.hasClass(\'btn-del\')){\n var record = ev.row;\n del(record);\n }\n if(sender.hasClass(\'btn-edit\')){\n var record = ev.row;\n edit(record);\n }\n });\n \n ${jq}schBtn.on(\'click\',function(ev){\n search();\n });\n \n ${jq}addBtn.on(\'click\',function(ev){\n add();\n });\n \n ${jq}exportBtn.on(\'click\',function(ev){\n exportFile();\n });\n }\n \n \n //////// functions ////////\n \n function search() {\n grid.load(schForm.getData());\n }\n \n function exportFile() {\n var data = schForm.getData();\n ExportUtil.doExport(exportUrl,data);\n }\n \n function save() {\n pageForm.save();\n }\n \n function add(){\n pageForm.add();\n }\n \n function edit(record) {\n pageForm.update(record);\n }\n \n function del(record){\n pageForm.del(record);\n }\n \n init();\n \n});\n\n</script>\n</body>\n</html>','admin');
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cqmrzeng/autoCode.git
git@gitee.com:cqmrzeng/autoCode.git
cqmrzeng
autoCode
autoCode
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385