diff --git a/src/main/java/xyz/wbsite/dbtool/javafx/manger/ProjectManager.java b/src/main/java/xyz/wbsite/dbtool/javafx/manger/ProjectManager.java index b65351f3..ccf47cd8 100644 --- a/src/main/java/xyz/wbsite/dbtool/javafx/manger/ProjectManager.java +++ b/src/main/java/xyz/wbsite/dbtool/javafx/manger/ProjectManager.java @@ -219,11 +219,11 @@ public class ProjectManager { private static ExecutorService service = Executors.newFixedThreadPool(1); public void tryGetDBmapper(DataBase dataBase) { - if (dataBase.name().toUpperCase().equals(DataBase.MySQL.name().toUpperCase())) { + if (dataBase.name().equals(DataBase.MySQL.name())) { dBmapper = new MySQLDBmapper(dataBase); - } else if (dataBase.name().toUpperCase().equals(DataBase.Oracle.name().toUpperCase())) { + } else if (dataBase.name().equals(DataBase.Oracle.name())) { dBmapper = new OracleDBmapper(dataBase); - } else if (dataBase.name().toUpperCase().equals(DataBase.SQLite.name().toUpperCase())) { + } else if (dataBase.name().equals(DataBase.SQLite.name())) { dBmapper = new SQLiteDBmapper(dataBase); } } diff --git a/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java b/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java index 74dbcdaf..b72bdd17 100644 --- a/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java +++ b/src/main/java/xyz/wbsite/dbtool/javafx/manger/callable/SpringBootCallable.java @@ -688,12 +688,12 @@ public class SpringBootCallable implements Callable { freeMarkerManager.outputTemp(Tool.createFile(tableDir.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/dbtool/tableAll.ftl", ctx); } - if (DataBase.Oracle == dataBase) { + if (DataBase.Oracle.name().equals(dataBase.name())) { File lib = Tool.createPath(root.getAbsolutePath(), "lib"); Tool.outputResource(option + "/resources/lib/ojdbc7-12.1.0.2.jar", Tool.createFile(lib.getAbsolutePath(), "ojdbc7-12.1.0.2.jar")); } - if (DataBase.SQLite == dataBase) { + if (DataBase.SQLite.name().equals(dataBase.name())) { File dbFile = Tool.createFile(root.getAbsolutePath(), project.getProjectName() + ".db"); Connection connection = null; Statement statement = null; diff --git a/src/main/resources/modules/SpringBoot/pom.ftl b/src/main/resources/modules/SpringBoot/pom.ftl index 36c0fb2f..1c0440f4 100644 --- a/src/main/resources/modules/SpringBoot/pom.ftl +++ b/src/main/resources/modules/SpringBoot/pom.ftl @@ -107,7 +107,7 @@ poi-ooxml -<#if dataBase == 'MYSQL'> +<#if dataBase == 'MySQL'> mysql mysql-connector-java @@ -123,7 +123,7 @@ -<#if dataBase == 'ORACLE'> +<#if dataBase == 'Oracle'> com.example ojdbc diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/system/ALL_TABLE.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/system/ALL_TABLE.sql index 1441db67..87b0351a 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/system/ALL_TABLE.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/system/ALL_TABLE.sql @@ -1,78 +1,197 @@ -/* -Target : MYSQL -Author -Date: ${date?string("yyyy-MM-dd")} -*/ - +<#if dataBase == 'MySQL'> -- ---------------------------- -- Table structure for DICT - 字典 +-- Target : MySQL +-- Author : wangbing +-- Date: : 2019-12-16 -- ---------------------------- - CREATE TABLE `SYS_DICT` ( - `ID` BIGINT(20) NOT NULL COMMENT '主键', - `DICT_NAME` VARCHAR(50) NOT NULL COMMENT '字典名称', - `DICT_COMMENT` VARCHAR(50) NOT NULL COMMENT '字典描述', - `VERSION` VARCHAR(50) NOT NULL COMMENT '字典版本', - `VALID` TINYINT(1) NOT NULL COMMENT '是否有效', - `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', - `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', - `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户', - `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', + `ID` BIGINT(20) NOT NULL COMMENT '主键', + `DICT_NAME` VARCHAR(50) NOT NULL COMMENT '字典名称', + `DICT_COMMENT` VARCHAR(50) NOT NULL COMMENT '字典描述', + `VERSION` VARCHAR(50) NOT NULL COMMENT '字典版本', + `VALID` TINYINT(1) NOT NULL COMMENT '是否有效', + `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', + `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', + `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', + `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', + `LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户', + `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典'; -/* -Target : MYSQL -Author -Date: 2019-01-01 -*/ - -- ---------------------------- -- Table structure for DICT_ITEM - 字典项 +-- Target : MySQL +-- Author : wangbing +-- Date: : 2019-12-16 -- ---------------------------- - CREATE TABLE `SYS_DICT_ITEM` ( - `ID` BIGINT(20) NOT NULL COMMENT '主键', - `DICT_NAME` VARCHAR(50) NOT NULL COMMENT '字典名称', - `KEY` VARCHAR(50) NOT NULL COMMENT '字典键', - `VALUE` VARCHAR(100) NOT NULL COMMENT '字典值', - `SORT` INTEGER(10) NOT NULL COMMENT '排序', - `VALID` TINYINT(1) NOT NULL COMMENT '是否有效', - `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', - `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', - `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户', - `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', + `ID` BIGINT(20) NOT NULL COMMENT '主键', + `DICT_NAME` BIGINT(20) NOT NULL COMMENT '字典名称', + `KEY` CHAR(10) NOT NULL COMMENT '字典键', + `VALUE` VARCHAR(100) NOT NULL COMMENT '字典值', + `SORT` INTEGER(10) NOT NULL COMMENT '排序', + `VALID` TINYINT(1) NOT NULL COMMENT '是否有效', + `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', + `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', + `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', + `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', + `LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户', + `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典项'; -/* -Target : MYSQL -Author -Date: 2019-01-01 -*/ - -- ---------------------------- -- Table structure for FILE - 文件 +-- Target : MySQL +-- Author : wangbing +-- Date: : 2019-12-16 -- ---------------------------- - -CREATE TABLE `SYSFILE` ( - `ID` BIGINT(20) NOT NULL COMMENT '主键', - `NAME` VARCHAR(250) NOT NULL COMMENT '文件名称', - `FILE_TYPE` VARCHAR(10) COMMENT '文件类型', - `ATTRIBUTE1` VARCHAR(50) COMMENT '扩展属性1', - `ATTRIBUTE2` VARCHAR(50) COMMENT '扩展属性2', - `LOCATION` VARCHAR(500) COMMENT '存放地址', - `URL` VARCHAR(500) COMMENT '访问地址', - `URL_DOWNLOAD` VARCHAR(500) COMMENT '下载地址', - `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', - `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', - `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', - `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', - `LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户', - `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', +CREATE TABLE `SYS_FILE` ( + `ID` BIGINT(20) NOT NULL COMMENT '主键', + `NAME` VARCHAR(250) COMMENT '文件名称', + `FILE_TYPE` VARCHAR(10) COMMENT '文件类型', + `ATTRIBUTE1` VARCHAR(50) COMMENT '扩展属性1', + `ATTRIBUTE2` VARCHAR(50) COMMENT '扩展属性2', + `LOCATION` VARCHAR(500) COMMENT '存放地址', + `URL` VARCHAR(500) COMMENT '访问地址', + `URL_DOWNLOAD` VARCHAR(500) COMMENT '下载地址', + `ROW_VERSION` BIGINT(20) NOT NULL DEFAULT 0 COMMENT '行版本', + `IS_DELETED` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否已删除', + `CREATE_BY` BIGINT(20) NOT NULL COMMENT '创建用户', + `CREATE_TIME` DATETIME NOT NULL COMMENT '创建时间', + `LAST_UPDATE_BY` BIGINT(20) DEFAULT NULL COMMENT '最后更新用户', + `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文件'; + +<#if dataBase == 'Oracle'> +-- ---------------------------- +-- Table structure for DICT - 字典 +-- Target : Oracle +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE "SYS_DICT" ( +"ID" NUMBER(19) NOT NULL, +"DICT_NAME" VARCHAR2(50) NULL, +"DICT_COMMENT" VARCHAR2(50) NULL, +"VERSION" VARCHAR2(50) NULL, +"VALID" CHAR(1) NULL, +"ROW_VERSION" NUMBER(19) NOT NULL, +"IS_DELETED" CHAR(1) NOT NULL, +"CREATE_BY" NUMBER(19) NOT NULL, +"CREATE_TIME" DATE NOT NULL, +"LAST_UPDATE_BY" NUMBER(19) NULL, +"LAST_UPDATE_TIME" DATE NULL +); +COMMENT ON TABLE "SYS_DICT" is '字典'; +COMMENT ON COLUMN "SYS_DICT"."ID" is '主键'; +COMMENT ON COLUMN "SYS_DICT"."DICT_NAME" is '字典名称'; +COMMENT ON COLUMN "SYS_DICT"."DICT_COMMENT" is '字典描述'; +COMMENT ON COLUMN "SYS_DICT"."VERSION" is '字典版本'; +COMMENT ON COLUMN "SYS_DICT"."VALID" is '是否有效'; +COMMENT ON COLUMN "SYS_DICT"."ROW_VERSION" is '行版本'; +COMMENT ON COLUMN "SYS_DICT"."IS_DELETED" is '是否已删除'; +COMMENT ON COLUMN "SYS_DICT"."CREATE_BY" is '创建用户'; +COMMENT ON COLUMN "SYS_DICT"."CREATE_TIME" is '创建时间'; +COMMENT ON COLUMN "SYS_DICT"."LAST_UPDATE_BY" is '最后更新用户'; +COMMENT ON COLUMN "SYS_DICT"."LAST_UPDATE_TIME" is '最后更新时间'; + +-- ---------------------------- +-- Table structure for DICT_ITEM - 字典项 +-- Target : Oracle +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE "SYS_DICT_ITEM" ( +"ID" NUMBER(19) NOT NULL, +"DICT_NAME" NUMBER(19) NULL, +"KEY" CHAR(10) NULL, +"VALUE" VARCHAR2(100) NULL, +"SORT" NUMBER(10) NULL, +"VALID" CHAR(1) NULL, +"ROW_VERSION" NUMBER(19) NOT NULL, +"IS_DELETED" CHAR(1) NOT NULL, +"CREATE_BY" NUMBER(19) NOT NULL, +"CREATE_TIME" DATE NOT NULL, +"LAST_UPDATE_BY" NUMBER(19) NULL, +"LAST_UPDATE_TIME" DATE NULL +); +COMMENT ON TABLE "SYS_DICT_ITEM" is '字典项'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."ID" is '主键'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."DICT_NAME" is '字典名称'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."KEY" is '字典键'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."VALUE" is '字典值'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."SORT" is '排序'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."VALID" is '是否有效'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."ROW_VERSION" is '行版本'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."IS_DELETED" is '是否已删除'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."CREATE_BY" is '创建用户'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."CREATE_TIME" is '创建时间'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."LAST_UPDATE_BY" is '最后更新用户'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."LAST_UPDATE_TIME" is '最后更新时间'; + +-- ---------------------------- +-- Table structure for FILE - 文件 +-- Target : Oracle +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE "SYS_FILE" ( +"ID" NUMBER(19) NOT NULL, +"NAME" VARCHAR2(250) NULL, +"FILE_TYPE" VARCHAR(10) NULL, +"ATTRIBUTE1" VARCHAR2(50) NULL, +"ATTRIBUTE2" VARCHAR2(50) NULL, +"LOCATION" VARCHAR2(500) NULL, +"URL" VARCHAR2(500) NULL, +"URL_DOWNLOAD" VARCHAR2(500) NULL, +"ROW_VERSION" NUMBER(19) NOT NULL, +"IS_DELETED" CHAR(1) NOT NULL, +"CREATE_BY" NUMBER(19) NOT NULL, +"CREATE_TIME" DATE NOT NULL, +"LAST_UPDATE_BY" NUMBER(19) NULL, +"LAST_UPDATE_TIME" DATE NULL +); +COMMENT ON TABLE "SYS_FILE" is '文件'; +COMMENT ON COLUMN "SYS_FILE"."ID" is '主键'; +COMMENT ON COLUMN "SYS_FILE"."NAME" is '文件名称'; +COMMENT ON COLUMN "SYS_FILE"."FILE_TYPE" is '文件类型'; +COMMENT ON COLUMN "SYS_FILE"."ATTRIBUTE1" is '扩展属性1'; +COMMENT ON COLUMN "SYS_FILE"."ATTRIBUTE2" is '扩展属性2'; +COMMENT ON COLUMN "SYS_FILE"."LOCATION" is '存放地址'; +COMMENT ON COLUMN "SYS_FILE"."URL" is '访问地址'; +COMMENT ON COLUMN "SYS_FILE"."URL_DOWNLOAD" is '下载地址'; +COMMENT ON COLUMN "SYS_FILE"."ROW_VERSION" is '行版本'; +COMMENT ON COLUMN "SYS_FILE"."IS_DELETED" is '是否已删除'; +COMMENT ON COLUMN "SYS_FILE"."CREATE_BY" is '创建用户'; +COMMENT ON COLUMN "SYS_FILE"."CREATE_TIME" is '创建时间'; +COMMENT ON COLUMN "SYS_FILE"."LAST_UPDATE_BY" is '最后更新用户'; +COMMENT ON COLUMN "SYS_FILE"."LAST_UPDATE_TIME" is '最后更新时间'; + +<#if dataBase == 'SQLite'> +-- ---------------------------- +-- Table structure for FILE - 文件 +-- Target : SQLite +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE IF NOT EXISTS `SYS_FILE` ( + `ID` BIGINT PRIMARY KEY NOT NULL, + `NAME` VARCHAR(250), + `FILE_TYPE` VARCHAR(10), + `ATTRIBUTE1` VARCHAR(50), + `ATTRIBUTE2` VARCHAR(50), + `LOCATION` VARCHAR(500), + `URL` VARCHAR(500), + `URL_DOWNLOAD` VARCHAR(500), + `ROW_VERSION` BIGINT NOT NULL, + `IS_DELETED` BOOLEAN NOT NULL, + `CREATE_BY` BIGINT NOT NULL, + `CREATE_TIME` DATETIME NOT NULL, + `LAST_UPDATE_BY` BIGINT, + `LAST_UPDATE_TIME` DATETIME +); + \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/system/DICT.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/system/DICT.sql index 060962b4..d599675e 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/system/DICT.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/system/DICT.sql @@ -1,13 +1,10 @@ -/* -Target : MYSQL -Author -Date: ${date?string("yyyy-MM-dd")} -*/ - +<#if dataBase == 'MySQL'> -- ---------------------------- -- Table structure for DICT - 字典 +-- Target : MySQL +-- Author : wangbing +-- Date: : 2019-12-16 -- ---------------------------- - CREATE TABLE `SYS_DICT` ( `ID` BIGINT(20) NOT NULL COMMENT '主键', `DICT_NAME` VARCHAR(50) NOT NULL COMMENT '字典名称', @@ -22,3 +19,59 @@ CREATE TABLE `SYS_DICT` ( `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典'; + +<#if dataBase == 'Oracle'> +-- ---------------------------- +-- Table structure for DICT - 字典 +-- Target : Oracle +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE "SYS_DICT" ( + "ID" NUMBER(19) NOT NULL, + "DICT_NAME" VARCHAR2(50) NULL, + "DICT_COMMENT" VARCHAR2(50) NULL, + "VERSION" VARCHAR2(50) NULL, + "VALID" CHAR(1) NULL, + "ROW_VERSION" NUMBER(19) NOT NULL, + "IS_DELETED" CHAR(1) NOT NULL, + "CREATE_BY" NUMBER(19) NOT NULL, + "CREATE_TIME" DATE NOT NULL, + "LAST_UPDATE_BY" NUMBER(19) NULL, + "LAST_UPDATE_TIME" DATE NULL +); + +COMMENT ON TABLE "SYS_DICT" is '字典'; +COMMENT ON COLUMN "SYS_DICT"."ID" is '主键'; +COMMENT ON COLUMN "SYS_DICT"."DICT_NAME" is '字典名称'; +COMMENT ON COLUMN "SYS_DICT"."DICT_COMMENT" is '字典描述'; +COMMENT ON COLUMN "SYS_DICT"."VERSION" is '字典版本'; +COMMENT ON COLUMN "SYS_DICT"."VALID" is '是否有效'; +COMMENT ON COLUMN "SYS_DICT"."ROW_VERSION" is '行版本'; +COMMENT ON COLUMN "SYS_DICT"."IS_DELETED" is '是否已删除'; +COMMENT ON COLUMN "SYS_DICT"."CREATE_BY" is '创建用户'; +COMMENT ON COLUMN "SYS_DICT"."CREATE_TIME" is '创建时间'; +COMMENT ON COLUMN "SYS_DICT"."LAST_UPDATE_BY" is '最后更新用户'; +COMMENT ON COLUMN "SYS_DICT"."LAST_UPDATE_TIME" is '最后更新时间'; + +<#if dataBase == 'SQLite'> +-- ---------------------------- +-- Table structure for DICT - 字典 +-- Target : SQLite +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE IF NOT EXISTS `SYS_DICT` ( + `ID` BIGINT PRIMARY KEY NOT NULL, + `DICT_NAME` VARCHAR(50) NOT NULL, + `DICT_COMMENT` VARCHAR(50) NOT NULL, + `VERSION` VARCHAR(50) NOT NULL, + `VALID` BOOLEAN NOT NULL, + `ROW_VERSION` BIGINT NOT NULL, + `IS_DELETED` BOOLEAN NOT NULL, + `CREATE_BY` BIGINT NOT NULL, + `CREATE_TIME` DATETIME NOT NULL, + `LAST_UPDATE_BY` BIGINT, + `LAST_UPDATE_TIME` DATETIME +); + \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/system/DICT_ITEM.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/system/DICT_ITEM.sql index 99ba1d6f..56fafc71 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/system/DICT_ITEM.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/system/DICT_ITEM.sql @@ -1,17 +1,14 @@ -/* -Target : MYSQL -Author -Date: ${date?string("yyyy-MM-dd")} -*/ - +<#if dataBase == 'MySQL'> -- ---------------------------- -- Table structure for DICT_ITEM - 字典项 +-- Target : MySQL +-- Author : wangbing +-- Date: : 2019-12-16 -- ---------------------------- - CREATE TABLE `SYS_DICT_ITEM` ( `ID` BIGINT(20) NOT NULL COMMENT '主键', - `DICT_NAME` VARCHAR(50) NOT NULL COMMENT '字典名称', - `KEY` VARCHAR(50) NOT NULL COMMENT '字典键', + `DICT_NAME` BIGINT(20) NOT NULL COMMENT '字典名称', + `KEY` CHAR(10) NOT NULL COMMENT '字典键', `VALUE` VARCHAR(100) NOT NULL COMMENT '字典值', `SORT` INTEGER(10) NOT NULL COMMENT '排序', `VALID` TINYINT(1) NOT NULL COMMENT '是否有效', @@ -23,3 +20,62 @@ CREATE TABLE `SYS_DICT_ITEM` ( `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典项'; + +<#if dataBase == 'Oracle'> +-- ---------------------------- +-- Table structure for DICT_ITEM - 字典项 +-- Target : Oracle +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE "SYS_DICT_ITEM" ( + "ID" NUMBER(19) NOT NULL, + "DICT_NAME" NUMBER(19) NULL, + "KEY" CHAR(10) NULL, + "VALUE" VARCHAR2(100) NULL, + "SORT" NUMBER(10) NULL, + "VALID" CHAR(1) NULL, + "ROW_VERSION" NUMBER(19) NOT NULL, + "IS_DELETED" CHAR(1) NOT NULL, + "CREATE_BY" NUMBER(19) NOT NULL, + "CREATE_TIME" DATE NOT NULL, + "LAST_UPDATE_BY" NUMBER(19) NULL, + "LAST_UPDATE_TIME" DATE NULL +); + +COMMENT ON TABLE "SYS_DICT_ITEM" is '字典项'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."ID" is '主键'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."DICT_NAME" is '字典名称'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."KEY" is '字典键'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."VALUE" is '字典值'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."SORT" is '排序'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."VALID" is '是否有效'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."ROW_VERSION" is '行版本'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."IS_DELETED" is '是否已删除'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."CREATE_BY" is '创建用户'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."CREATE_TIME" is '创建时间'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."LAST_UPDATE_BY" is '最后更新用户'; +COMMENT ON COLUMN "SYS_DICT_ITEM"."LAST_UPDATE_TIME" is '最后更新时间'; + +<#if dataBase == 'SQLite'> +-- ---------------------------- +-- Table structure for DICT_ITEM - 字典项 +-- Target : SQLite +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE IF NOT EXISTS `SYS_DICT_ITEM` ( + `ID` BIGINT PRIMARY KEY NOT NULL, + `DICT_NAME` BIGINT NOT NULL, + `KEY` CHAR(10) NOT NULL, + `VALUE` VARCHAR(100) NOT NULL, + `SORT` MEDIUMINT NOT NULL, + `VALID` BOOLEAN NOT NULL, + `ROW_VERSION` BIGINT NOT NULL, + `IS_DELETED` BOOLEAN NOT NULL, + `CREATE_BY` BIGINT NOT NULL, + `CREATE_TIME` DATETIME NOT NULL, + `LAST_UPDATE_BY` BIGINT, + `LAST_UPDATE_TIME` DATETIME +); + \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/system/FILE.sql b/src/main/resources/modules/SpringBoot/resources/dbtool/system/FILE.sql index 95487400..be592973 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/system/FILE.sql +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/system/FILE.sql @@ -1,16 +1,13 @@ -/* -Target : MYSQL -Author -Date: ${date?string("yyyy-MM-dd")} -*/ - +<#if dataBase == 'MySQL'> -- ---------------------------- -- Table structure for FILE - 文件 +-- Target : MySQL +-- Author : wangbing +-- Date: : 2019-12-16 -- ---------------------------- - -CREATE TABLE `SYSFILE` ( +CREATE TABLE `SYS_FILE` ( `ID` BIGINT(20) NOT NULL COMMENT '主键', - `NAME` VARCHAR(250) NOT NULL COMMENT '文件名称', + `NAME` VARCHAR(250) COMMENT '文件名称', `FILE_TYPE` VARCHAR(10) COMMENT '文件类型', `ATTRIBUTE1` VARCHAR(50) COMMENT '扩展属性1', `ATTRIBUTE2` VARCHAR(50) COMMENT '扩展属性2', @@ -25,3 +22,68 @@ CREATE TABLE `SYSFILE` ( `LAST_UPDATE_TIME` DATETIME DEFAULT NULL COMMENT '最后更新时间', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文件'; + +<#if dataBase == 'Oracle'> +-- ---------------------------- +-- Table structure for FILE - 文件 +-- Target : Oracle +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE "SYS_FILE" ( + "ID" NUMBER(19) NOT NULL, + "NAME" VARCHAR2(250) NULL, + "FILE_TYPE" VARCHAR(10) NULL, + "ATTRIBUTE1" VARCHAR2(50) NULL, + "ATTRIBUTE2" VARCHAR2(50) NULL, + "LOCATION" VARCHAR2(500) NULL, + "URL" VARCHAR2(500) NULL, + "URL_DOWNLOAD" VARCHAR2(500) NULL, + "ROW_VERSION" NUMBER(19) NOT NULL, + "IS_DELETED" CHAR(1) NOT NULL, + "CREATE_BY" NUMBER(19) NOT NULL, + "CREATE_TIME" DATE NOT NULL, + "LAST_UPDATE_BY" NUMBER(19) NULL, + "LAST_UPDATE_TIME" DATE NULL +); + +COMMENT ON TABLE "SYS_FILE" is '文件'; +COMMENT ON COLUMN "SYS_FILE"."ID" is '主键'; +COMMENT ON COLUMN "SYS_FILE"."NAME" is '文件名称'; +COMMENT ON COLUMN "SYS_FILE"."FILE_TYPE" is '文件类型'; +COMMENT ON COLUMN "SYS_FILE"."ATTRIBUTE1" is '扩展属性1'; +COMMENT ON COLUMN "SYS_FILE"."ATTRIBUTE2" is '扩展属性2'; +COMMENT ON COLUMN "SYS_FILE"."LOCATION" is '存放地址'; +COMMENT ON COLUMN "SYS_FILE"."URL" is '访问地址'; +COMMENT ON COLUMN "SYS_FILE"."URL_DOWNLOAD" is '下载地址'; +COMMENT ON COLUMN "SYS_FILE"."ROW_VERSION" is '行版本'; +COMMENT ON COLUMN "SYS_FILE"."IS_DELETED" is '是否已删除'; +COMMENT ON COLUMN "SYS_FILE"."CREATE_BY" is '创建用户'; +COMMENT ON COLUMN "SYS_FILE"."CREATE_TIME" is '创建时间'; +COMMENT ON COLUMN "SYS_FILE"."LAST_UPDATE_BY" is '最后更新用户'; +COMMENT ON COLUMN "SYS_FILE"."LAST_UPDATE_TIME" is '最后更新时间'; + +<#if dataBase == 'SQLite'> +-- ---------------------------- +-- Table structure for FILE - 文件 +-- Target : SQLite +-- Author : wangbing +-- Date: : 2019-12-16 +-- ---------------------------- +CREATE TABLE IF NOT EXISTS `SYS_FILE` ( + `ID` BIGINT PRIMARY KEY NOT NULL, + `NAME` VARCHAR(250), + `FILE_TYPE` VARCHAR(10), + `ATTRIBUTE1` VARCHAR(50), + `ATTRIBUTE2` VARCHAR(50), + `LOCATION` VARCHAR(500), + `URL` VARCHAR(500), + `URL_DOWNLOAD` VARCHAR(500), + `ROW_VERSION` BIGINT NOT NULL, + `IS_DELETED` BOOLEAN NOT NULL, + `CREATE_BY` BIGINT NOT NULL, + `CREATE_TIME` DATETIME NOT NULL, + `LAST_UPDATE_BY` BIGINT, + `LAST_UPDATE_TIME` DATETIME +); + \ No newline at end of file diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/table.ftl b/src/main/resources/modules/SpringBoot/resources/dbtool/table.ftl index 82a14382..17fb23b4 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/table.ftl +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/table.ftl @@ -1,14 +1,10 @@ -<#if dataBase == 'ORACLE'> -/* -Target : ORACLE -Author -Date: ${date?string("yyyy-MM-dd")} -*/ - +<#if dataBase == 'Oracle'> -- ---------------------------- -- Table structure for ${table.tableName} - ${table.tableComment?default("")} +-- Target : Oracle +-- Author : ${author} +-- Date: : ${date?string("yyyy-MM-dd")} -- ---------------------------- - CREATE TABLE "${module.modulePrefix}${table.tableName}" ( <#list table.fields as field> ${dBmapper.getFieldSql(field)}<#if field_has_next>, @@ -20,17 +16,13 @@ COMMENT ON TABLE "${module.modulePrefix?default("")}${table.tableName}" is '${ta COMMENT ON COLUMN "${module.modulePrefix?default("")}${table.tableName}"."${field.fieldName?default("")}" is '${field.fieldComment?default("")}'; -<#if dataBase == 'MYSQL'> -/* -Target : MYSQL -Author -Date: ${date?string("yyyy-MM-dd")} -*/ - +<#if dataBase == 'MySQL'> -- ---------------------------- -- Table structure for ${table.tableName} - ${table.tableComment?default("")} +-- Target : MySQL +-- Author : ${author} +-- Date: : ${date?string("yyyy-MM-dd")} -- ---------------------------- - CREATE TABLE `${module.modulePrefix?default("")}${table.tableName}` ( <#list table.fields as field> ${dBmapper.getFieldSql(field)}<#if field_has_next||module.hasSysFields>, @@ -41,16 +33,12 @@ PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='${table.tableComment?default("")}'; <#if dataBase == 'SQLite'> -/* -Target : SQLite -Author -Date: ${date?string("yyyy-MM-dd")} -*/ - -- ---------------------------- -- Table structure for ${table.tableName} - ${table.tableComment?default("")} +-- Target : SQLite +-- Author : ${author} +-- Date: : ${date?string("yyyy-MM-dd")} -- ---------------------------- - CREATE TABLE IF NOT EXISTS `${module.modulePrefix?default("")}${table.tableName}` ( <#list table.fields as field> ${dBmapper.getFieldSql(field)}<#if field_has_next>, diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/tableAll.ftl b/src/main/resources/modules/SpringBoot/resources/dbtool/tableAll.ftl index 7ca030a5..87e68812 100644 --- a/src/main/resources/modules/SpringBoot/resources/dbtool/tableAll.ftl +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/tableAll.ftl @@ -1,7 +1,10 @@ -<#if dataBase == 'ORACLE'> +<#if dataBase == 'Oracle'> <#list module.tables as table> -- ---------------------------- -- Table structure for ${table.tableName} - ${table.tableComment?default("")} +-- Target : Oracle +-- Author : ${author} +-- Date: : ${date?string("yyyy-MM-dd")} -- ---------------------------- CREATE TABLE "${module.modulePrefix?default("")}${table.tableName}" ( <#list table.fields as field> @@ -15,11 +18,13 @@ COMMENT ON COLUMN "${module.modulePrefix?default("")}${table.tableName}"."${fiel - -<#if dataBase == 'MYSQL'> +<#if dataBase == 'MySQL'> <#list module.tables as table> -- ---------------------------- -- Table structure for ${table.tableName} - ${table.tableComment?default("")} +-- Target : MySQL +-- Author : ${author} +-- Date: : ${date?string("yyyy-MM-dd")} -- ---------------------------- CREATE TABLE `${module.modulePrefix?default("")}${table.tableName}` ( <#list table.fields as field> @@ -35,11 +40,14 @@ PRIMARY KEY (`ID`) <#if dataBase == 'SQLite'> -- ---------------------------- -- Table structure for ${table.tableName} - ${table.tableComment?default("")} +-- Target : SQLite +-- Author : ${author} +-- Date: : ${date?string("yyyy-MM-dd")} -- ---------------------------- - CREATE TABLE IF NOT EXISTS `${module.modulePrefix?default("")}${table.tableName}` ( <#list table.fields as field> ${dBmapper.getFieldSql(field)}<#if field_has_next>, ); + diff --git a/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml b/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml new file mode 100644 index 00000000..bc79ec95 --- /dev/null +++ b/src/main/resources/modules/SpringBoot/resources/dbtool/wadmin.xml @@ -0,0 +1,65 @@ + + +wadmin +xyz.wbsite +wangbing + + +系统 +SYS_ +system +true + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
+
+
+
diff --git a/src/main/resources/modules/SpringMVC_Mybatis/java/mpr/mapper.ftl b/src/main/resources/modules/SpringMVC_Mybatis/java/mpr/mapper.ftl index 429c2c54..9eed755c 100644 --- a/src/main/resources/modules/SpringMVC_Mybatis/java/mpr/mapper.ftl +++ b/src/main/resources/modules/SpringMVC_Mybatis/java/mpr/mapper.ftl @@ -5,16 +5,16 @@ -<#if dataBase == 'ORACLE'> +<#if dataBase == 'Oracle'> "${db.dbprefix}${table.tableName}" -<#elseif dataBase='MYSQL'> +<#elseif dataBase='MySQL'> `${db.dbprefix}${table.tableName}` - <#if dataBase == 'ORACLE'> + <#if dataBase == 'Oracle'> <#list table.fields as f>"${f.fieldName}"<#if f_has_next>, - <#elseif dataBase='MYSQL'> + <#elseif dataBase='MySQL'> <#list table.fields as f>`${f.fieldName}`<#if f_has_next>, @@ -28,11 +28,11 @@ <#list table.fields as f> <#if f.isQuery> -<#if dataBase == 'ORACLE'> +<#if dataBase == 'Oracle'> AND ${f.fieldName} = ${r"#{"}request.${f.getFName()}} -<#elseif dataBase='MYSQL'> +<#elseif dataBase='MySQL'> AND `${f.fieldName}` = ${r"#{"}request.${f.getFName()}} @@ -44,11 +44,11 @@ <#list table.fields as f> <#if f.isQuery> -<#if dataBase == 'ORACLE'> +<#if dataBase == 'Oracle'> AND ${f.fieldName} LIKE CONCAT(CONCAT('%',${r"#{"}request.keyword}),'%') -<#elseif dataBase='MYSQL'> +<#elseif dataBase='MySQL'> AND `${f.fieldName}` LIKE CONCAT('%',${r"#{request.keyword}"},'%') @@ -94,7 +94,7 @@ 0, 0, ${r"#{"}token.userId,jdbcType=NUMERIC}, - <#if dataBase == 'ORACLE'>sysdate<#elseif dataBase == 'MYSQL'>sysdate(), + <#if dataBase == 'Oracle'>sysdate<#elseif dataBase == 'MySQL'>sysdate(), NULL, NULL ) @@ -122,7 +122,7 @@ ROW_VERSION = ROW_VERSION+1, LAST_UPDATE_BY = ${r"#{"}token.userId}, - LAST_UPDATE_TIME = <#if dataBase == 'ORACLE'>sysdate<#elseif dataBase == 'MYSQL'>sysdate() + LAST_UPDATE_TIME = <#if dataBase == 'Oracle'>sysdate<#elseif dataBase == 'MySQL'>sysdate() WHERE IS_DELETED = 0 AND ID = ${r"#{"}request.id} AND ROW_VERSION = ${r"#{"}request.rowVersion} diff --git a/src/main/resources/modules/SpringMVC_Mybatis/resources/table.ftl b/src/main/resources/modules/SpringMVC_Mybatis/resources/table.ftl index c24dab45..d4ec5c4a 100644 --- a/src/main/resources/modules/SpringMVC_Mybatis/resources/table.ftl +++ b/src/main/resources/modules/SpringMVC_Mybatis/resources/table.ftl @@ -1,6 +1,6 @@ -<#if dataBase == 'ORACLE'> +<#if dataBase == 'Oracle'> /* -Target : ORACLE +Target : Oracle Author Date: ${date?string("yyyy-MM-dd")} */ @@ -20,9 +20,9 @@ COMMENT ON TABLE ${db.dbprefix?default("")}${table.tableName} is '${table.tableC COMMENT ON COLUMN ${db.dbprefix?default("")}${table.tableName}.${field.fieldName?default("")} is '${field.fieldComment?default("")}'; -<#if dataBase == 'MYSQL'> +<#if dataBase == 'MySQL'> /* -Target : MYSQL +Target : MySQL Author Date: ${date?string("yyyy-MM-dd")} */ diff --git a/src/main/resources/modules/SpringMVC_Mybatis/resources/tableAll.ftl b/src/main/resources/modules/SpringMVC_Mybatis/resources/tableAll.ftl index a9b6cb05..73c2897c 100644 --- a/src/main/resources/modules/SpringMVC_Mybatis/resources/tableAll.ftl +++ b/src/main/resources/modules/SpringMVC_Mybatis/resources/tableAll.ftl @@ -1,4 +1,4 @@ -<#if dataBase == 'ORACLE'> +<#if dataBase == 'Oracle'> <#list db.tables as table> -- ---------------------------- -- Table structure for ${table.tableName} - ${table.tableComment?default("")} @@ -16,7 +16,7 @@ COMMENT ON COLUMN ${db.dbprefix?default("")}${table.tableName}.${field.fieldName -<#if dataBase == 'MYSQL'> +<#if dataBase == 'MySQL'> <#list db.tables as table> -- ---------------------------- -- Table structure for ${table.tableName} - ${table.tableComment?default("")}