-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathautoCode.sql
76 lines (56 loc) · 30.8 KB
/
autoCode.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
SQLyog Ultimate v11.33 (64 bit)
MySQL - 5.1.73-community : Database - auto_code
*********************************************************************
*/
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`auto_code` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `auto_code`;
/*Table structure for table `back_user` */
DROP TABLE IF EXISTS `back_user`;
CREATE TABLE `back_user` (
`username` VARCHAR(20) NOT NULL,
`password` VARCHAR(50) NOT NULL,
`add_time` DATETIME NOT NULL,
PRIMARY KEY (`username`)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
/*Data for the table `back_user` */
INSERT INTO `back_user`(`username`,`password`,`add_time`) VALUES ('aaaa','123456','2015-01-05 11:52:26'),('admin','admin','2014-06-24 10:12:49');
/*Table structure for table `datasource_config` */
DROP TABLE IF EXISTS `datasource_config`;
CREATE TABLE `datasource_config` (
`dc_id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(20) DEFAULT NULL,
`driver_class` VARCHAR(50) DEFAULT NULL,
`jdbc_url` VARCHAR(100) DEFAULT NULL,
`username` VARCHAR(50) DEFAULT NULL,
`password` VARCHAR(50) DEFAULT NULL,
`back_user` VARCHAR(20) DEFAULT NULL,
PRIMARY KEY (`dc_id`),
KEY `f_username_user` (`username`)
) ENGINE=INNODB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*Data for the table `datasource_config` */
INSERT INTO `datasource_config`(`dc_id`,`name`,`driver_class`,`jdbc_url`,`username`,`password`,`back_user`) VALUES (4,'aaa','com.mysql.jdbc.Driver','jdbc:mysql://localhost:3306/auto_code','root','root','admin'),(5,'ISP','net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://192.168.9.31:1433;databaseName=isp','sa','isp#123','admin'),(6,'rms','com.mysql.jdbc.Driver','jdbc:mysql://localhost:3306/rms','root','root','admin');
/*Table structure for table `template_config` */
DROP TABLE IF EXISTS `template_config`;
CREATE TABLE `template_config` (
`tc_id` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) DEFAULT NULL,
`save_path` VARCHAR(100) DEFAULT NULL,
`suffix` VARCHAR(20) DEFAULT NULL,
`content` TEXT,
`back_user` VARCHAR(20) DEFAULT NULL,
PRIMARY KEY (`tc_id`),
KEY `f_backuser` (`back_user`)
) ENGINE=INNODB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
/*Data for the table `template_config` */
INSERT INTO `template_config` VALUES ('2', 'Entity', NULL, '', 'package ${context.packageName}.entity;\r\n\r\npublic class ${context.javaBeanName} {\r\n#foreach($column in $columns) \r\n private ${column.javaType} ${column.javaFieldName};\r\n#end\r\n\r\n#foreach(${column} in ${columns}) \r\n public void set${column.javaFieldNameUF}(${column.javaType} ${column.javaFieldName}){\r\n this.${column.javaFieldName} = ${column.javaFieldName};\r\n }\r\n\r\n public ${column.javaType} get${column.javaFieldNameUF}(){\r\n return this.${column.javaFieldName};\r\n }\r\n\r\n#end}', 'admin'), ('3', 'DAO', NULL, 'java', 'package ${context.packageName}.dao;\r\n\r\nimport ${context.packageName}.entity.${context.javaBeanName};\r\nimport org.durcframework.dao.BaseDao;\r\n\r\npublic interface ${context.javaBeanName}Dao extends BaseDao<${context.javaBeanName}> {\r\n}', 'admin'), ('4', 'Service', NULL, 'java', 'package ${context.packageName}.service;\r\n\r\nimport ${context.packageName}.dao.${context.javaBeanName}Dao;\r\nimport ${context.packageName}.entity.${context.javaBeanName};\r\nimport org.durcframework.service.CrudService;\r\nimport org.springframework.stereotype.Service;\r\n\r\n@Service\r\npublic class ${context.javaBeanName}Service extends CrudService<${context.javaBeanName}, ${context.javaBeanName}Dao> {\r\n\r\n}\r\n', 'admin'), ('5', 'SearchEntity', NULL, '', 'package ${context.packageName}.entity;\r\n\r\nimport java.util.Date;\r\n\r\nimport org.durcframework.entity.SearchEntity;\r\nimport org.durcframework.expression.annotation.ValueField;\r\n\r\npublic class ${context.javaBeanName}Sch extends SearchEntity{\r\n\r\n#foreach($column in $columns) \r\n private ${column.javaTypeBox} ${column.javaFieldName}Sch;\r\n#end\r\n\r\n#foreach(${column} in ${columns}) \r\n public void set${column.javaFieldNameUF}Sch(${column.javaTypeBox} ${column.javaFieldName}Sch){\r\n this.${column.javaFieldName}Sch = ${column.javaFieldName}Sch;\r\n }\r\n \r\n @ValueField(column = \"${column.columnName}\")\r\n public ${column.javaTypeBox} get${column.javaFieldNameUF}Sch(){\r\n return this.${column.javaFieldName}Sch;\r\n }\r\n\r\n#end\r\n\r\n}', 'admin'), ('6', 'Mybatis', NULL, '', '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\" >\r\n<mapper namespace=\"${context.packageName}.dao.${context.javaBeanName}Dao\">\r\n <resultMap id=\"queryResultMap\" type=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n #foreach($column in $columns)\r\n <result column=\"${column.columnName}\" property=\"${column.javaFieldName}\" jdbcType=\"${column.mybatisJdbcType}\" />\r\n #end\r\n </resultMap>\r\n\r\n <select id=\"find\" parameterType=\"org.durcframework.expression.ExpressionQuery\"\r\n resultMap=\"queryResultMap\">\r\n SELECT *\r\n FROM ${table.tableName} t\r\n <include refid=\"expressionBlock.where\" />\r\n <choose>\r\n <when test=\"sortname == null\">\r\n ORDER BY ${context.javaPkName} desc\r\n </when>\r\n <otherwise>\r\n ORDER BY #{sortname,jdbcType=VARCHAR} ${sortorder}\r\n </otherwise>\r\n </choose>\r\n <if test=\"!isQueryAll\">\r\n LIMIT\r\n #{firstResult,jdbcType=INTEGER},#{pageSize,jdbcType=INTEGER}\r\n </if>\r\n </select>\r\n\r\n\r\n <select id=\"findTotalCount\" parameterType=\"org.durcframework.expression.ExpressionQuery\"\r\n resultType=\"java.lang.Integer\">\r\n SELECT count(*) FROM ${table.tableName} t\r\n <include refid=\"expressionBlock.where\" />\r\n </select>\r\n\r\n <insert id=\"save\" parameterType=\"org.durcframework.autocode.entity.DataSourceConfig\"\r\n#if(${pkColumn.isIdentity})\r\n keyProperty=\"${context.javaPkName}\" keyColumn=\"${context.pkName}\" useGeneratedKeys=\"true\"\r\n#end\r\n >\r\n INSERT INTO ${table.tableName}\r\n (\r\n #set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isIdentityPk}) \r\n #if($i > 0),#end ${column.columnName}\r\n #set($i=$i+1)\r\n #end \r\n #end\r\n )\r\n VALUES (\r\n #set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isIdentityPk}) \r\n #if($i > 0),#end #{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\r\n #set($i=$i+1)\r\n #end \r\n #end\r\n \r\n )\r\n </insert>\r\n\r\n\r\n <update id=\"update\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n UPDATE ${table.tableName}\r\n SET \r\n#set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isPk}) \r\n #if($i > 0),#end ${column.columnName}=#{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\r\n #set($i=$i+1)\r\n #end \r\n #end \r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </update>\r\n\r\n <select id=\"get\" resultMap=\"queryResultMap\" parameterType=\"java.io.Serializable\">\r\n SELECT *\r\n FROM ${table.tableName}\r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </select>\r\n \r\n <delete id=\"del\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n DELETE FROM ${table.tableName}\r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </delete>\r\n\r\n</mapper>', 'admin'), ('7', 'mybatis_1', NULL, '', '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\" >\r\n<mapper namespace=\"${context.packageName}.dao.${context.javaBeanName}Dao\">\r\n <resultMap id=\"queryResultMap\" type=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n #foreach($column in $columns)\r\n <result column=\"${column.columnName}\" property=\"${column.javaFieldName}\" jdbcType=\"${column.mybatisJdbcType}\" />\r\n #end\r\n </resultMap>\r\n\r\n <select id=\"find\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\"\r\n resultMap=\"queryResultMap\">\r\n SELECT *\r\n FROM ${table.tableName} t \r\n WHERE 1=1\r\n #foreach($column in $columns)\r\n <if test=\"${column.javaFieldName}!=null\">\r\n AND ${column.columnName} = #{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\r\n </if>\r\n #end\r\n ORDER BY ${context.javaPkName} desc\r\n\r\n </select>\r\n\r\n\r\n <insert id=\"save\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\"\r\n#if(${pkColumn.isIdentity})\r\n keyProperty=\"${context.javaPkName}\" keyColumn=\"${context.pkName}\" useGeneratedKeys=\"true\"\r\n#end\r\n >\r\n INSERT INTO ${table.tableName}\r\n (\r\n #set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isIdentityPk}) \r\n #if($i > 0),#end ${column.columnName}\r\n #set($i=$i+1)\r\n #end \r\n #end\r\n )\r\n VALUES (\r\n #set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isIdentityPk}) \r\n #if($i > 0),#end #{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\r\n #set($i=$i+1)\r\n #end \r\n #end\r\n \r\n )\r\n </insert>\r\n\r\n\r\n <update id=\"update\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n UPDATE ${table.tableName}\r\n SET \r\n#set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isPk}) \r\n #if($i > 0),#end ${column.columnName}=#{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\r\n #set($i=$i+1)\r\n #end \r\n #end \r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </update>\r\n\r\n <select id=\"get\" resultMap=\"queryResultMap\" parameterType=\"java.io.Serializable\">\r\n SELECT *\r\n FROM ${table.tableName}\r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </select>\r\n \r\n <delete id=\"del\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n DELETE FROM ${table.tableName}\r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </delete>\r\n\r\n</mapper>', 'admin'), ('8', 'durc_Entity', 'entity', 'java', 'package ${context.packageName}.entity;\r\n\r\n\r\npublic class ${context.javaBeanName} {\r\n#foreach($column in $columns) \r\n private ${column.javaType} ${column.javaFieldName};\r\n#end\r\n\r\n#foreach(${column} in ${columns}) \r\n public void set${column.javaFieldNameUF}(${column.javaType} ${column.javaFieldName}){\r\n this.${column.javaFieldName} = ${column.javaFieldName};\r\n }\r\n\r\n public ${column.javaType} get${column.javaFieldNameUF}(){\r\n return this.${column.javaFieldName};\r\n }\r\n\r\n#end\r\n}', 'admin'), ('9', 'durc_DAO', 'dao', 'java', 'package ${context.packageName}.dao;\r\n\r\nimport org.durcframework.core.dao.BaseDao;\r\nimport ${context.packageName}.entity.${context.javaBeanName};\r\n\r\npublic interface ${context.javaBeanName}Dao extends BaseDao<${context.javaBeanName}> {\r\n}', 'admin'), ('10', 'durc_Service', 'service', 'java', 'package ${context.packageName}.service;\r\n\r\nimport org.durcframework.core.service.CrudService;\r\nimport ${context.packageName}.dao.${context.javaBeanName}Dao;\r\nimport ${context.packageName}.entity.${context.javaBeanName};\r\nimport org.springframework.stereotype.Service;\r\n\r\n@Service\r\npublic class ${context.javaBeanName}Service extends CrudService<${context.javaBeanName}, ${context.javaBeanName}Dao> {\r\n\r\n}', 'admin'), ('11', 'durc_SearchEntity', 'entity', 'java', 'package ${context.packageName}.entity;\r\n\r\nimport java.util.Date;\r\n\r\nimport org.durcframework.entity.SearchEntity;\r\nimport org.durcframework.core.expression.annotation.ValueField;\r\n\r\npublic class ${context.javaBeanName}Sch extends SearchEntity{\r\n\r\n#foreach($column in $columns) \r\n private ${column.javaTypeBox} ${column.javaFieldName}Sch;\r\n#end\r\n\r\n#foreach(${column} in ${columns}) \r\n public void set${column.javaFieldNameUF}Sch(${column.javaTypeBox} ${column.javaFieldName}Sch){\r\n this.${column.javaFieldName}Sch = ${column.javaFieldName}Sch;\r\n }\r\n \r\n @ValueField(column = \"${column.columnName}\")\r\n public ${column.javaTypeBox} get${column.javaFieldNameUF}Sch(){\r\n return this.${column.javaFieldName}Sch;\r\n }\r\n\r\n#end\r\n\r\n}', 'admin'), ('12', 'durc_Mybatis', 'mybatis/mapper', 'xml', '<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\" >\r\n<mapper namespace=\"${context.packageName}.dao.${context.javaBeanName}Dao\">\r\n <resultMap id=\"queryResultMap\" type=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n #foreach($column in $columns)\r\n <result column=\"${column.columnName}\" property=\"${column.javaFieldName}\" jdbcType=\"${column.mybatisJdbcType}\" />\r\n #end\r\n </resultMap>\r\n\r\n <select id=\"find\" parameterType=\"org.durcframework.core.expression.ExpressionQuery\"\r\n resultMap=\"queryResultMap\">\r\n SELECT t.*\r\n FROM ${table.tableName} t\r\n <include refid=\"expressionBlock.where\" />\r\n <choose>\r\n <when test=\"sortname == null\">\r\n ORDER BY t.${context.pkName} desc\r\n </when>\r\n <otherwise>\r\n ORDER BY ${order}\r\n </otherwise>\r\n </choose>\r\n <if test=\"!isQueryAll\">\r\n LIMIT\r\n #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}\r\n </if>\r\n </select>\r\n\r\n\r\n <select id=\"findTotalCount\" parameterType=\"org.durcframework.core.expression.ExpressionQuery\"\r\n resultType=\"java.lang.Integer\">\r\n SELECT count(*) FROM ${table.tableName} t\r\n <include refid=\"expressionBlock.where\" />\r\n </select>\r\n\r\n <insert id=\"save\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\"\r\n#if(${pkColumn.isIdentity})\r\n keyProperty=\"${context.javaPkName}\" keyColumn=\"${context.pkName}\" useGeneratedKeys=\"true\"\r\n#end\r\n >\r\n INSERT INTO ${table.tableName}\r\n (\r\n #set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isIdentityPk}) \r\n #if($i > 0),#end `${column.columnName}`\r\n #set($i=$i+1)\r\n #end \r\n #end\r\n )\r\n VALUES (\r\n #set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isIdentityPk}) \r\n #if($i > 0),#end #{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\r\n #set($i=$i+1)\r\n #end \r\n #end\r\n \r\n )\r\n </insert>\r\n\r\n\r\n <update id=\"update\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n UPDATE ${table.tableName}\r\n SET \r\n#set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isPk}) \r\n #if($i > 0),#end ${column.columnName}=#{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\r\n #set($i=$i+1)\r\n #end \r\n #end \r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </update>\r\n\r\n <select id=\"get\" resultMap=\"queryResultMap\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n SELECT t.*\r\n FROM ${table.tableName} t\r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </select>\r\n \r\n <delete id=\"del\" parameterType=\"${context.packageName}.entity.${context.javaBeanName}\">\r\n DELETE FROM ${table.tableName}\r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </delete>\r\n\r\n</mapper>', 'admin'), ('13', 'durc_jspPage', 'views', 'jsp', '<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\"\r\n pageEncoding=\"UTF-8\"%>\r\n<%@ include file=\"../taglib.jsp\" %>\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n<title>${table.tableName}</title>\r\n<style type=\"text/css\">\r\n.fm_lab{text-align: right;padding:10px;}\r\n</style>\r\n</head>\r\n<body>\r\n <div id=\"toolbar\">\r\n <a href=\"#\" class=\"easyui-linkbutton\" iconCls=\"icon-add\" plain=\"true\" onclick=\"crud.add()\">添加</a>\r\n </div>\r\n <table id=\"dg\"></table>\r\n \r\n <div id=\"dlg\" class=\"easyui-dialog\" style=\"width:520px;height:380px;padding:10px 20px\"\r\n closed=\"true\" modal=\"true\" buttons=\"#dlg-buttons\">\r\n <form id=\"fm\" method=\"post\">\r\n <table>\r\n#foreach($column in $columns)\r\n #if(!${column.isIdentityPk})\r\n <tr>\r\n <td class=\"fm_lab\">${column.javaFieldName}:</td><td><input name=\"${column.javaFieldName}\" type=\"text\" class=\"easyui-validatebox\" required=\"true\"></td>\r\n </tr>\r\n #end\r\n#end\r\n\r\n </table>\r\n </form>\r\n </div>\r\n <div id=\"dlg-buttons\">\r\n <a href=\"#\" class=\"easyui-linkbutton\" iconCls=\"icon-ok\" onclick=\"crud.save(); return false;\">保存</a>\r\n <a href=\"#\" class=\"easyui-linkbutton\" iconCls=\"icon-cancel\" onclick=\"crud.closeDlg(); return false;\">取消</a>\r\n </div>\r\n \r\n<jsp:include page=\"../easyui_lib.jsp\"></jsp:include>\r\n<script type=\"text/javascript\">\r\nvar that = this;\r\nvar crud = Crud.create({\r\n pk:\'${context.javaPkName}\'\r\n ,listUrl:ctx + \'list${context.javaBeanName}.do\'\r\n ,addUrl:ctx + \'add${context.javaBeanName}.do\'\r\n ,updateUrl:ctx + \'update${context.javaBeanName}.do\'\r\n ,delUrl:ctx + \'del${context.javaBeanName}.do\'\r\n ,dlgId:\'dlg\'\r\n ,formId:\'fm\'\r\n ,gridId:\'dg\'\r\n});\r\n\r\ncrud.buildGrid([\r\n#set($i=0)\r\n#foreach($column in $columns)\r\n #if($i>0),#end\r\n #if(!${column.isIdentityPk})\r\n {field:\'${column.javaFieldName}\',title:\'${column.javaFieldName}\'}\r\n #set($i=$i+1)\r\n #end \r\n#end \r\n ,crud.createOperColumn() \r\n]);\r\n</script>\r\n</body>\r\n</html>', 'admin'), ('14', 'durc_Controller', 'controller', 'java', 'package ${context.packageName}.controller;\r\n\r\nimport org.durcframework.core.GridResult;\r\nimport org.durcframework.core.MessageResult;\r\nimport org.durcframework.core.controller.CrudController;\r\nimport ${context.packageName}.entity.${context.javaBeanName};\r\nimport ${context.packageName}.entity.${context.javaBeanName}Sch;\r\nimport ${context.packageName}.service.${context.javaBeanName}Service;\r\nimport org.springframework.stereotype.Controller;\r\nimport org.springframework.web.bind.annotation.RequestMapping;\r\nimport org.springframework.web.bind.annotation.ResponseBody;\r\n\r\n@Controller\r\npublic class ${context.javaBeanName}Controller extends\r\n CrudController<${context.javaBeanName}, ${context.javaBeanName}Service> {\r\n\r\n @RequestMapping(\"/add${context.javaBeanName}.do\")\r\n public @ResponseBody\r\n MessageResult add${context.javaBeanName}(${context.javaBeanName} entity) {\r\n return this.save(entity);\r\n }\r\n\r\n @RequestMapping(\"/list${context.javaBeanName}.do\")\r\n public @ResponseBody\r\n GridResult list${context.javaBeanName}(${context.javaBeanName}Sch searchEntity) {\r\n return this.query(searchEntity);\r\n }\r\n\r\n @RequestMapping(\"/update${context.javaBeanName}.do\")\r\n public @ResponseBody\r\n MessageResult update${context.javaBeanName}(${context.javaBeanName} entity) {\r\n return this.update(enity);\r\n }\r\n\r\n @RequestMapping(\"/del${context.javaBeanName}.do\")\r\n public @ResponseBody\r\n MessageResult del${context.javaBeanName}(${context.javaBeanName} entity) {\r\n return this.delete(enity);\r\n }\r\n \r\n}', 'admin'), ('15', 'sw-mybatis', NULL, '', '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<!DOCTYPE mapper PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\" >\r\n<mapper namespace=\"${context.packageName}.dao.${context.javaBeanName}Dao\">\r\n<resultMap type=\"${context.packageName}.pojo.${context.javaBeanName}\" id=\"BaseResultMap\">\r\n#foreach($column in $columns)\r\n <result property=\"${column.javaFieldName}\" column=\"${column.columnName}\" jdbcType=\"${column.mybatisJdbcType}\"/>\r\n#end \r\n</resultMap>\r\n <select id=\"query\" resultMap=\"BaseResultMap\" parameterType=\"com.shunwang.business.framework.mybatis.query.ConditionQuery\" >\r\n <if test=\"paramMap.rp>0\">\r\n SELECT t0.* FROM (\r\n </if>\r\n select row_number() over(order by\r\n <choose>\r\n <when test=\"paramMap.orderCol!=null\">\r\n ${paramMap.orderCol}\r\n </when>\r\n <otherwise>\r\n ${context.pkName} desc\r\n </otherwise>\r\n </choose>\r\n ) row\r\n #set ($i=0) \r\n #foreach($column in $columns) \r\n #if($i > 0),#end ${column.columnName}\r\n #set($i=$i+1) \r\n #end\r\n from ${table.tableName} t \r\n <include refid=\"conditionQuery.core\" />\r\n <if test=\"paramMap.rp > 0\">\r\n ) t0 WHERE t0.row BETWEEN (#{paramMap.firstResult}+1) AND\r\n (#{paramMap.firstResult} +\r\n #{paramMap.rp})\r\n </if>\r\n </select>\r\n <select id=\"get\" resultMap=\"BaseResultMap\" parameterType=\"java.lang.Integer\" >\r\n SELECT \r\n#set ($i=0) \r\n #foreach($column in $columns) \r\n #if($i > 0),#end \r\n ${column.columnName}\r\n #set($i=$i+1) \r\n #end\r\n FROM ${table.tableName}\r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </select>\r\n <delete id=\"delete\" parameterType=\"com.icafe8.back.adjustBatch.pojo.AdjustBatch\" >\r\n DELETE FROM ${table.tableName}\r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </delete>\r\n <insert id=\"save\" parameterType=\"${context.packageName}.pojo.${context.javaBeanName}\" useGeneratedKeys=\"true\" keyProperty=\"${context.javaPkName}\">\r\n INSERT INTO ${table.tableName}\r\n (\r\n #set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isIdentityPk}) \r\n #if($i > 0),#end ${column.columnName}\r\n #set($i=$i+1)\r\n #end \r\n #end\r\n )\r\n VALUES (\r\n #set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isIdentityPk}) \r\n #if($i > 0),#end #{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\r\n #set($i=$i+1)\r\n #end \r\n #end\r\n \r\n )\r\n </insert>\r\n <select id=\"queryCnt\" parameterType=\"com.shunwang.business.framework.mybatis.query.ConditionQuery\" resultType=\"java.lang.Integer\" >\r\n select count(*) from ${table.tableName} t\r\n <include refid=\"conditionQuery.core\" />\r\n </select>\r\n\r\n <update id=\"update\" parameterType=\"${context.packageName}.pojo.${context.javaBeanName}\">\r\n UPDATE ${table.tableName}\r\n SET \r\n#set ($i=0) \r\n #foreach($column in $columns) \r\n #if(!${column.isPk}) \r\n #if($i > 0),#end ${column.columnName}=#{${column.javaFieldName},jdbcType=${column.mybatisJdbcType}}\r\n #set($i=$i+1)\r\n #end \r\n #end \r\n WHERE ${context.pkName} = #{${context.javaPkName},jdbcType=${context.mybatisPkType}}\r\n </update>\r\n</mapper>', 'admin'), ('16', 'sw-pojo', NULL, '', 'package ${context.packageName}.pojo;\r\n\r\nimport com.shunwang.business.framework.pojo.BasePojo;\r\n\r\npublic class ${context.javaBeanName} extends BasePojo {\r\n#foreach($column in $columns) \r\n private ${column.javaType} ${column.javaFieldName};\r\n#end\r\n\r\n#foreach(${column} in ${columns}) \r\n public void set${column.javaFieldNameUF}(${column.javaType} ${column.javaFieldName}){\r\n this.${column.javaFieldName} = ${column.javaFieldName};\r\n }\r\n\r\n public ${column.javaType} get${column.javaFieldNameUF}(){\r\n return this.${column.javaFieldName};\r\n }\r\n\r\n#end\r\n}', 'admin'), ('17', 'sw-dao', NULL, '', 'package ${context.packageName}.dao;\r\n\r\nimport com.shunwang.business.framework.dao.CrudDao;\r\n\r\npublic interface ${context.javaBeanName}Dao extends CrudDao<${context.javaBeanName}> {\r\n}', 'admin'), ('18', 'sw-bo', NULL, '', 'package ${context.packageName}.bo;\r\n\r\nimport com.shunwang.business.framework.bo.CrudBo;\r\n\r\n@Service\r\npublic class ${context.javaBeanName}Service extends CrudBo<${context.javaBeanName}, ${context.javaBeanName}Dao> {\r\n\r\n}', 'admin'),('19','durc_jspCRUD',NULL,NULL,'<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\"\r\n pageEncoding=\"UTF-8\"%>\r\n<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n<title>增删改查列子</title>\r\n</head>\r\n<body>\r\n\r\n <div class=\"easyui-panel search-panel\">\r\n <form id=\"schForm\">\r\n <table>\r\n <tr>\r\n#foreach($column in $columns)\r\n #if(!${column.isIdentityPk})\r\n <td class=\"fm_lab\">${column.javaFieldName}:</td><td><input name=\"${column.javaFieldName}Sch\" type=\"text\"></td> \r\n #end\r\n#end\r\n<td><a id=\"schBtn\" href=\"#\" class=\"easyui-linkbutton\" iconCls=\"icon-search\">查询</a></td>\r\n </tr>\r\n </table>\r\n </form>\r\n </div>\r\n\r\n <div id=\"toolbar\">\r\n <a id=\"addBtn\" href=\"#\" class=\"easyui-linkbutton\" iconCls=\"icon-add\" plain=\"true\">添加</a>\r\n </div>\r\n \r\n <table id=\"dg\"></table>\r\n \r\n <div id=\"dlg\" class=\"easyui-dialog\" style=\"width:320px;height:280px;padding:10px 20px\"\r\n closed=\"true\" modal=\"true\" buttons=\"#dlg-buttons\">\r\n <form id=\"fm\" method=\"post\">\r\n <table>\r\n#foreach($column in $columns)\r\n #if(!${column.isIdentityPk})\r\n <tr>\r\n <td class=\"fm_lab\">${column.javaFieldName}:</td><td><input name=\"${column.javaFieldName}\" type=\"text\" class=\"easyui-validatebox\" required=\"true\"></td>\r\n </tr>\r\n #end\r\n#end\r\n </table>\r\n </form>\r\n </div>\r\n <div id=\"dlg-buttons\">\r\n <a id=\"saveBtn\" href=\"#\" class=\"easyui-linkbutton\" iconCls=\"icon-ok\">保存</a>\r\n <a id=\"cancelBtn\" href=\"#\" class=\"easyui-linkbutton\" iconCls=\"icon-cancel\">取消</a>\r\n </div>\r\n \r\n<jsp:include page=\"../easyui_lib.jsp\"></jsp:include>\r\n<script type=\"text/javascript\">\r\n#set($jq=\"$\") \r\n(function(){\r\nvar that = this;\r\n\r\nvar pk = \'${context.javaPkName}\'; // java类中的主键字段\r\nvar listUrl = ctx + \'list${context.javaBeanName}.do\'; // 查询\r\nvar addUrl = ctx + \'add${context.javaBeanName}.do\'; // 添加\r\nvar updateUrl = ctx + \'update${context.javaBeanName}.do\'; // 修改\r\nvar delUrl = ctx + \'del${context.javaBeanName}.do\'; // 删除\r\nvar submitUrl = \'\'; // 提交URL\r\n\r\nvar toolbarId = \'toolbar\'; // 工具条ID\r\n\r\nvar ${jq}dialog = ${jq}(\'#dlg\'); // 窗口\r\nvar ${jq}form = ${jq}(\'#fm\'); // 表单\r\nvar ${jq}grid = ${jq}(\'#dg\'); // 表格\r\nvar ${jq}schForm = ${jq}(\'#schForm\'); // 查询表单\r\n\r\nvar ${jq}schBtn = ${jq}(\'#schBtn\'); // 查询按钮\r\nvar ${jq}saveBtn = ${jq}(\'#saveBtn\'); // 保存按钮\r\nvar ${jq}cancelBtn = ${jq}(\'#cancelBtn\'); // 取消按钮\r\nvar ${jq}addBtn = ${jq}(\'#addBtn\'); // 添加按钮\r\n\r\n// 初始化表格\r\n${jq}grid.datagrid({ \r\n url:listUrl\r\n ,columns:[[\r\n#set($i=0)\r\n#foreach($column in $columns)\r\n #if($i>0),#end\r\n #if(!${column.isIdentityPk})\r\n {field:\'${column.javaFieldName}\',title:\'${column.javaFieldName}\'}\r\n #set($i=$i+1)\r\n #end \r\n#end \r\n ,{field:\'_btn1\',title:\'操作\',align:\'center\',formatter:function(val,row){\r\n return \'<a href=\"#\" onclick=\"\'+FunUtil.createFun(that,\'edit\',row)+\' return false;\">修改</a>\'\r\n + \'<span class=\"opt-split\">|</span>\'\r\n + \'<a href=\"#\" onclick=\"\'+FunUtil.createFun(that,\'del\',row)+\' return false;\">删除</a>\'\r\n }}\r\n ]]\r\n ,toolbar:\'#\' + toolbarId\r\n ,pagination:true\r\n ,fitColumns:true\r\n ,singleSelect:true\r\n ,striped:true\r\n ,pageSize:20\r\n});\r\n\r\n// 初始化事件\r\n${jq}addBtn.click(function(){\r\n ${jq}dialog.dialog(\'open\').dialog(\'setTitle\',\'添加\');\r\n ${jq}form.form(\'reset\');\r\n submitUrl = addUrl;\r\n});\r\n\r\n${jq}schBtn.click(function(){\r\n var data = getFormData(${jq}schForm);\r\n ${jq}grid.datagrid(\'load\',data);\r\n});\r\n\r\n${jq}saveBtn.click(function(){\r\n save();\r\n});\r\n\r\n${jq}cancelBtn.click(function(){\r\n ${jq}dialog.dialog(\'close\');\r\n});\r\n\r\n\r\n// 编辑\r\nthis.edit = function(row){\r\n if (row){\r\n ${jq}dialog.dialog(\'open\').dialog(\'setTitle\',\'修改\');\r\n ${jq}form.form(\'clear\').form(\'load\',row);\r\n \r\n submitUrl = updateUrl + [\'?\',pk,\'=\',row[pk]].join(\'\');\r\n }\r\n}\r\n\r\n// 保存\r\nthis.save = function(){\r\n var self = this;\r\n ${jq}form.form(\'submit\',{\r\n url: submitUrl,\r\n onSubmit: function(){\r\n return ${jq}(this).form(\'validate\');\r\n },\r\n success: function(resultTxt){\r\n var result = ${jq}.parseJSON(resultTxt);\r\n Action.execResult(result,function(result){\r\n ${jq}dialog.dialog(\'close\');// close the dialog\r\n ${jq}grid.datagrid(\'reload\');\r\n });\r\n }\r\n });\r\n}\r\n\r\n// 删除\r\nthis.del = function(row){\r\n if(row){\r\n ${jq}.messager.confirm(\'确认\',\'确定要删除该数据吗?\',function(r){\r\n if (r){\r\n Action.post(delUrl,row,function(result){\r\n Action.execResult(result,function(result){\r\n ${jq}grid.datagrid(\'reload\');\r\n });\r\n });\r\n }\r\n });\r\n }\r\n}\r\n\r\n})();\r\n</script>\r\n</body>\r\n</html>','admin');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;