From 2bcce3ed7a21cfb9e5756a6011bf6f568e6832bf Mon Sep 17 00:00:00 2001 From: wangbing <1919101440@qq.com> Date: Wed, 18 Dec 2019 22:27:28 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81SQLite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 5a63ce88bfb3eeb5d6f04aa1b5a77c178a9bf1fa --- .../dbtool/javafx/manger/callable/SpringBootCallable.java | 7 ++++++- .../SpringBoot/java/frame/validation/DictValidator.java | 1 + .../java/module/system/mpr/DictItemMapper_MySQL.xml | 3 --- .../java/module/system/mpr/DictItemMapper_Oracle.xml | 3 --- .../java/module/system/mpr/DictItemMapper_SQLite.xml | 3 --- src/main/resources/modules/SpringBoot/test/test.ftl | 7 +++++-- 6 files changed, 12 insertions(+), 12 deletions(-) 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 1001d91d..25546aa1 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 @@ -692,7 +692,12 @@ public class SpringBootCallable implements Callable { { File system = Tool.createPath(dbtool.getAbsolutePath(), "system_table"); - freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/dbtool/system/ALL_TABLE_" + dataBase.toString() + ".sql", ctx); + File file = new File(system.getAbsolutePath(), "ALL_TABLE.sql"); + if (file.exists()){ + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "ALL_TABLE_.sql"), option + "/resources/dbtool/system/ALL_TABLE_" + dataBase.toString() + ".sql", ctx); + }else { + freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "ALL_TABLE.sql"), option + "/resources/dbtool/system/ALL_TABLE_" + dataBase.toString() + ".sql", ctx); + } freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DICT.sql"), option + "/resources/dbtool/system/DICT_" + dataBase.toString() + ".sql", ctx); freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "DICT_ITEM.sql"), option + "/resources/dbtool/system/DICT_ITEM_" + dataBase.toString() + ".sql", ctx); freeMarkerManager.outputTemp(Tool.createFile(system.getAbsolutePath(), "FILE.sql"), option + "/resources/dbtool/system/FILE_" + dataBase.toString() + ".sql", ctx); diff --git a/src/main/resources/modules/SpringBoot/java/frame/validation/DictValidator.java b/src/main/resources/modules/SpringBoot/java/frame/validation/DictValidator.java index 57efc871..3e0f1925 100644 --- a/src/main/resources/modules/SpringBoot/java/frame/validation/DictValidator.java +++ b/src/main/resources/modules/SpringBoot/java/frame/validation/DictValidator.java @@ -38,6 +38,7 @@ public class DictValidator implements ConstraintValidator { if (dictLoadResponse.hasError()) { constraintValidatorContext.disableDefaultConstraintViolation(); constraintValidatorContext.buildConstraintViolationWithTemplate("验证字典[" + name + "]值出现异常->" + dictLoadResponse.getErrors().get(0).getMessage()).addConstraintViolation(); + return false; } List dictItems = dictLoadResponse.getDictItems(); diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_MySQL.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_MySQL.xml index a4ee4edd..1fec7553 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_MySQL.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_MySQL.xml @@ -32,9 +32,6 @@ WHERE `IS_DELETED` = 0 - - AND `DICT_NAME` = ${r"#"}{request.dictName} - AND `KEY` = ${r"#"}{request.key} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_Oracle.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_Oracle.xml index f805346d..73f2b1b4 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_Oracle.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_Oracle.xml @@ -32,9 +32,6 @@ WHERE "IS_DELETED" = 0 - - AND "DICT_NAME" = ${r"#"}{request.dictName} - AND "KEY" = ${r"#"}{request.key} diff --git a/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_SQLite.xml b/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_SQLite.xml index a519e0f6..35f6f808 100644 --- a/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_SQLite.xml +++ b/src/main/resources/modules/SpringBoot/java/module/system/mpr/DictItemMapper_SQLite.xml @@ -32,9 +32,6 @@ WHERE "IS_DELETED" = 0 - - AND DICT_NAME = ${r"#"}{request.dictName} - AND KEY = ${r"#"}{request.key} diff --git a/src/main/resources/modules/SpringBoot/test/test.ftl b/src/main/resources/modules/SpringBoot/test/test.ftl index c1713720..efc0354d 100644 --- a/src/main/resources/modules/SpringBoot/test/test.ftl +++ b/src/main/resources/modules/SpringBoot/test/test.ftl @@ -92,17 +92,18 @@ public class ${table.getCName()}Test { ${table.getCName()}CreateResponse createResponse = ${table.getFName()}Manager.create(createRequest, token); + assertTrue(!createResponse.hasError()); + //更新数据 ${table.getCName()}UpdateRequest request = new ${table.getCName()}UpdateRequest(); <#if table.getSys()> request.setId(createResponse.getId()); -<#else> + <#list table.fields as field> <#if !field.isSystem> request.${field.setterName()}(${field.getTestValue()}); - ${table.getCName()}UpdateResponse response = ${table.getFName()}Manager.update(request,token); @@ -139,6 +140,8 @@ public class ${table.getCName()}Test { ${table.getCName()}CreateResponse createResponse = ${table.getFName()}Manager.create(createRequest, token); + assertTrue(!createResponse.hasError()); + //获得数据 ${table.getCName()}GetRequest request = new ${table.getCName()}GetRequest(); <#if table.getSys()>