From bb4801b41c83fb507e57c456d4ac27c7b3e7f3de Mon Sep 17 00:00:00 2001 From: carm Date: Sat, 29 Jan 2022 21:20:07 +0800 Subject: [PATCH] =?UTF-8?q?[0.3.5]=20=E4=BF=AE=E5=A4=8D=20ConditionalBuild?= =?UTF-8?q?er=20=E5=AF=B9=E4=BA=8E=E5=8F=82=E6=95=B0=E6=9C=AA=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20AND=20=E9=93=BE=E6=8E=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- easysql-api/pom.xml | 2 +- easysql-impl/pom.xml | 2 +- .../impl/AbstractConditionalBuilder.java | 4 ++-- example/easysql-demo/pom.xml | 2 +- example/easysql-test/pom.xml | 4 ++-- .../cc/carm/lib/easysql/testrunner/Main.java | 2 ++ .../easysql/testrunner/tests/DeleteTest.java | 22 +++++++++++++++++++ pom.xml | 11 +++++----- with-pool/easysql-beecp/pom.xml | 2 +- with-pool/easysql-hikaricp/pom.xml | 4 ++-- 10 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 example/easysql-test/src/main/java/cc/carm/lib/easysql/testrunner/tests/DeleteTest.java diff --git a/easysql-api/pom.xml b/easysql-api/pom.xml index 936e0fce..6dc9958f 100644 --- a/easysql-api/pom.xml +++ b/easysql-api/pom.xml @@ -5,7 +5,7 @@ cc.carm.lib easysql-parent - 0.3.4 + 0.3.5 4.0.0 diff --git a/easysql-impl/pom.xml b/easysql-impl/pom.xml index af16f6e2..9e31a423 100644 --- a/easysql-impl/pom.xml +++ b/easysql-impl/pom.xml @@ -5,7 +5,7 @@ easysql-parent cc.carm.lib - 0.3.4 + 0.3.5 4.0.0 diff --git a/easysql-impl/src/main/java/cc/carm/lib/easysql/builder/impl/AbstractConditionalBuilder.java b/easysql-impl/src/main/java/cc/carm/lib/easysql/builder/impl/AbstractConditionalBuilder.java index a00b3bc2..c96fd453 100644 --- a/easysql-impl/src/main/java/cc/carm/lib/easysql/builder/impl/AbstractConditionalBuilder.java +++ b/easysql-impl/src/main/java/cc/carm/lib/easysql/builder/impl/AbstractConditionalBuilder.java @@ -120,9 +120,9 @@ protected String buildConditionSQL() { Iterator iterator = conditionSQLs.iterator(); while (iterator.hasNext()) { conditionBuilder.append(iterator.next()); - if (iterator.hasNext()) conditionBuilder.append(" "); + if (iterator.hasNext()) conditionBuilder.append(" AND "); } - return conditionBuilder.toString(); + return conditionBuilder.toString().trim(); } else { return null; } diff --git a/example/easysql-demo/pom.xml b/example/easysql-demo/pom.xml index dfd215c9..7ed25a8b 100644 --- a/example/easysql-demo/pom.xml +++ b/example/easysql-demo/pom.xml @@ -5,7 +5,7 @@ easysql-parent cc.carm.lib - 0.3.4 + 0.3.5 ../../pom.xml 4.0.0 diff --git a/example/easysql-test/pom.xml b/example/easysql-test/pom.xml index 083059c7..c2a88085 100644 --- a/example/easysql-test/pom.xml +++ b/example/easysql-test/pom.xml @@ -5,7 +5,7 @@ easysql-parent cc.carm.lib - 0.3.4 + 0.3.5 ../../pom.xml 4.0.0 @@ -28,7 +28,7 @@ ${project.parent.groupId} - easysql-hikaricp + easysql-beecp ${project.version} compile diff --git a/example/easysql-test/src/main/java/cc/carm/lib/easysql/testrunner/Main.java b/example/easysql-test/src/main/java/cc/carm/lib/easysql/testrunner/Main.java index f7196f01..021c4506 100644 --- a/example/easysql-test/src/main/java/cc/carm/lib/easysql/testrunner/Main.java +++ b/example/easysql-test/src/main/java/cc/carm/lib/easysql/testrunner/Main.java @@ -2,6 +2,7 @@ import cc.carm.lib.easysql.EasySQL; import cc.carm.lib.easysql.api.SQLManager; +import cc.carm.lib.easysql.testrunner.tests.DeleteTest; import cc.carm.lib.easysql.testrunner.tests.QueryCloseTest; import cc.carm.lib.easysql.testrunner.tests.QueryFunctionTest; import cc.carm.lib.easysql.testrunner.tests.TableCreateTest; @@ -49,6 +50,7 @@ public static void main(String[] args) { // tests.add(new SQLUpdateBatchTests()); // tests.add(new SQLUpdateReturnKeysTest()); tests.add(new QueryFunctionTest()); + tests.add(new DeleteTest()); print("准备进行测试..."); diff --git a/example/easysql-test/src/main/java/cc/carm/lib/easysql/testrunner/tests/DeleteTest.java b/example/easysql-test/src/main/java/cc/carm/lib/easysql/testrunner/tests/DeleteTest.java new file mode 100644 index 00000000..4f826da9 --- /dev/null +++ b/example/easysql-test/src/main/java/cc/carm/lib/easysql/testrunner/tests/DeleteTest.java @@ -0,0 +1,22 @@ +package cc.carm.lib.easysql.testrunner.tests; + +import cc.carm.lib.easysql.api.SQLManager; +import cc.carm.lib.easysql.testrunner.EasySQLTest; + +import java.sql.SQLException; + +public class DeleteTest extends EasySQLTest { + + + @Override + public void onTest(SQLManager sqlManager) throws SQLException { + + Integer changes = sqlManager.createDelete("test_user_table") + .addCondition("id", ">", 5) + .addNotNullCondition("username") + .build().execute(); + + System.out.println("change(s): " + changes); + + } +} diff --git a/pom.xml b/pom.xml index 741535aa..838ebf10 100644 --- a/pom.xml +++ b/pom.xml @@ -5,8 +5,9 @@ 4.0.0 - 11 - 11 + 8 + ${java.version} + ${java.version} UTF-8 UTF-8 carmjos @@ -16,7 +17,7 @@ cc.carm.lib easysql-parent pom - 0.3.4 + 0.3.5 easysql-api @@ -198,8 +199,8 @@ maven-compiler-plugin 3.9.0 - 1.8 - 1.8 + ${java.version} + ${java.version} UTF-8 -parameters diff --git a/with-pool/easysql-beecp/pom.xml b/with-pool/easysql-beecp/pom.xml index 10db0270..0ab3f09f 100644 --- a/with-pool/easysql-beecp/pom.xml +++ b/with-pool/easysql-beecp/pom.xml @@ -5,7 +5,7 @@ easysql-parent cc.carm.lib - 0.3.4 + 0.3.5 ../../pom.xml 4.0.0 diff --git a/with-pool/easysql-hikaricp/pom.xml b/with-pool/easysql-hikaricp/pom.xml index ce114d2a..4124c821 100644 --- a/with-pool/easysql-hikaricp/pom.xml +++ b/with-pool/easysql-hikaricp/pom.xml @@ -5,7 +5,7 @@ easysql-parent cc.carm.lib - 0.3.4 + 0.3.5 ../../pom.xml 4.0.0 @@ -72,7 +72,7 @@ com.zaxxer HikariCP - 5.0.1 + 4.0.3 true compile