Skip to content

Commit

Permalink
[0.3.5] 修复 ConditionalBuilder 对于参数未添加 AND 链接的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmJos committed Jan 29, 2022
1 parent 7acc284 commit bb4801b
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 15 deletions.
2 changes: 1 addition & 1 deletion easysql-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>cc.carm.lib</groupId>
<artifactId>easysql-parent</artifactId>
<version>0.3.4</version>
<version>0.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion easysql-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>easysql-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>0.3.4</version>
<version>0.3.5</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ protected String buildConditionSQL() {
Iterator<String> 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;
}
Expand Down
2 changes: 1 addition & 1 deletion example/easysql-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>easysql-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>0.3.4</version>
<version>0.3.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
4 changes: 2 additions & 2 deletions example/easysql-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>easysql-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>0.3.4</version>
<version>0.3.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -28,7 +28,7 @@
<dependencies>
<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>easysql-hikaricp</artifactId>
<artifactId>easysql-beecp</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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("准备进行测试...");

Expand Down
Original file line number Diff line number Diff line change
@@ -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);

}
}
11 changes: 6 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
<modelVersion>4.0.0</modelVersion>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<java.version>8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<sonar.organization>carmjos</sonar.organization>
Expand All @@ -16,7 +17,7 @@
<groupId>cc.carm.lib</groupId>
<artifactId>easysql-parent</artifactId>
<packaging>pom</packaging>
<version>0.3.4</version>
<version>0.3.5</version>

<modules>
<module>easysql-api</module>
Expand Down Expand Up @@ -198,8 +199,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.9.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
<compilerArgument>-parameters</compilerArgument>
</configuration>
Expand Down
2 changes: 1 addition & 1 deletion with-pool/easysql-beecp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>easysql-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>0.3.4</version>
<version>0.3.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
4 changes: 2 additions & 2 deletions with-pool/easysql-hikaricp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>easysql-parent</artifactId>
<groupId>cc.carm.lib</groupId>
<version>0.3.4</version>
<version>0.3.5</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -72,7 +72,7 @@
<!--项目地址 https://github.com/brettwooldridge/HikariCP/ -->
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.0.1</version>
<version>4.0.3</version>
<optional>true</optional>
<scope>compile</scope>
</dependency>
Expand Down

0 comments on commit bb4801b

Please sign in to comment.