Skip to content

Commit

Permalink
1.6.1 修复bank和notbank empty和notempty的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xuejmnet committed Nov 2, 2023
1 parent ed477db commit 5e77b71
Show file tree
Hide file tree
Showing 35 changed files with 168 additions and 55 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.easy-query</groupId>
<artifactId>easy-query-all</artifactId>
<packaging>pom</packaging>
<version>1.6.0</version>
<version>1.6.1</version>
<name>easy-query</name>
<description>java object query distributed connector</description>
<url>https://github.com/xuejmnet/easy-query</url>
Expand Down
8 changes: 4 additions & 4 deletions samples/console-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>samples</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<artifactId>console-demo</artifactId>
Expand All @@ -22,21 +22,21 @@
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-mysql</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<!-- apt生成代理类 -->
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-processor</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<!-- 代理api -->
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-api-proxy</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<!-- mysql驱动 -->
Expand Down
6 changes: 3 additions & 3 deletions samples/easy-query-solon-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>samples</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<groupId>com.easy.query.solon</groupId>
Expand All @@ -22,13 +22,13 @@
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-solon-plugin</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-processor</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>easy-query-all</artifactId>
<groupId>com.easy-query</groupId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -43,7 +43,7 @@
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-springboot-starter</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions samples/solon-sharding-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>samples</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<groupId>com.easy.query</groupId>
Expand All @@ -22,7 +22,7 @@
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-solon-plugin</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions samples/spring-sharding-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-processor</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-springboot-starter</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
6 changes: 3 additions & 3 deletions samples/springbootdemo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,19 @@
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-core</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-api4j</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.easy-query</groupId>
<artifactId>sql-springboot-starter</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion sql-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>easy-query-all</artifactId>
<groupId>com.easy-query</groupId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ default Filter lt(TableAvailable tableLeft, SQLFunction sqlFunctionLeft, TableAv

Filter funcColumnFilter(TableAvailable tableLeft, SQLFunction sqlFunctionLeft, TableAvailable tableRight, SQLFunction sqlFunctionRight, SQLPredicateCompare sqlPredicateCompare);


//endregion
Filter and();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import com.easy.query.core.expression.parser.core.base.core.filter.SubQueryPredicate;
import com.easy.query.core.expression.parser.core.base.core.filter.ValuePredicate;
import com.easy.query.core.expression.parser.core.base.core.filter.ValuesPredicate;
import com.easy.query.core.expression.parser.core.base.scec.core.SQLNativeChainExpressionContextImpl;
import com.easy.query.core.func.SQLFunction;

/**
* @author xuejiaming
Expand Down Expand Up @@ -88,30 +90,42 @@ default <T2> WherePredicate<T1> or(WherePredicate<T2> t2WherePredicate, SQLExpre
@Override
default WherePredicate<T1> isBank(boolean condition, String property) {
if (condition) {
getFilter().eq(getTable(), fx().bank(property), "");
SQLFunction bank = fx().bank(property);
getFilter().sqlNativeSegment(bank.sqlSegment(getTable()),c->{
bank.consume(new SQLNativeChainExpressionContextImpl(getTable(),c));
});
}
return this;
}

@Override
default WherePredicate<T1> isNotBank(boolean condition, String property) {
if (condition) {
getFilter().ne(getTable(), fx().bank(property), "");
SQLFunction bank = fx().notBank(property);
getFilter().sqlNativeSegment(bank.sqlSegment(getTable()),c->{
bank.consume(new SQLNativeChainExpressionContextImpl(getTable(),c));
});
}
return this;
}
@Override
default WherePredicate<T1> isEmpty(boolean condition, String property) {
if (condition) {
getFilter().eq(getTable(), fx().empty(property), "");
SQLFunction bank = fx().empty(property);
getFilter().sqlNativeSegment(bank.sqlSegment(getTable()),c->{
bank.consume(new SQLNativeChainExpressionContextImpl(getTable(),c));
});
}
return this;
}

@Override
default WherePredicate<T1> isNotEmpty(boolean condition, String property) {
if (condition) {
getFilter().ne(getTable(), fx().empty(property), "");
SQLFunction bank = fx().notEmpty(property);
getFilter().sqlNativeSegment(bank.sqlSegment(getTable()),c->{
bank.consume(new SQLNativeChainExpressionContextImpl(getTable(),c));
});
}
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public boolean useContains(String name){
}
return useInterceptors.contains(name);
}

/**
* 不代表不包含,表示不使用的拦截器里面是否包含
* @param name
* @return
*/
public boolean noContains(String name){
if(noInterceptors==null){
return false;
Expand Down
8 changes: 8 additions & 0 deletions sql-core/src/main/java/com/easy/query/core/func/SQLFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import com.easy.query.core.func.column.ColumnFuncSelectorImpl;
import com.easy.query.core.func.def.impl.BankSQLFunction;
import com.easy.query.core.func.def.impl.EmptySQLFunction;
import com.easy.query.core.func.def.impl.NotBankSQLFunction;
import com.easy.query.core.func.def.impl.NotEmptySQLFunction;
import com.easy.query.core.util.EasyArrayUtil;

import java.util.ArrayList;
Expand Down Expand Up @@ -212,8 +214,14 @@ default SQLFunction concat(SQLExpression1<ColumnFuncSelector> sqlExpression) {
default SQLFunction bank(String property){
return new BankSQLFunction(property);
}
default SQLFunction notBank(String property){
return new NotBankSQLFunction(property);
}

default SQLFunction empty(String property){
return new EmptySQLFunction(property);
}
default SQLFunction notEmpty(String property){
return new NotEmptySQLFunction(property);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.easy.query.core.func.def.impl;

import com.easy.query.core.expression.parser.core.available.TableAvailable;
import com.easy.query.core.expression.parser.core.base.scec.core.SQLNativeChainExpressionContext;
import com.easy.query.core.func.def.AbstractSQLFunction;

/**
* create time 2023/10/28 15:00
* 文件说明
*
* @author xuejiaming
*/
public class NotBankSQLFunction extends AbstractSQLFunction {
private final String property;

public NotBankSQLFunction(String property) {

this.property = property;
}

@Override
public String sqlSegment(TableAvailable defaultTable) {
return "({0} IS NOT NULL AND {0} <> '' AND LTRIM({0}) <> '')";
}

@Override
public int paramMarks() {
return 1;
}

@Override
protected void consume0(SQLNativeChainExpressionContext context) {
context.expression(this.property);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.easy.query.core.func.def.impl;

import com.easy.query.core.expression.parser.core.available.TableAvailable;
import com.easy.query.core.expression.parser.core.base.scec.core.SQLNativeChainExpressionContext;
import com.easy.query.core.func.def.AbstractSQLFunction;

/**
* create time 2023/10/28 15:00
* 文件说明
*
* @author xuejiaming
*/
public class NotEmptySQLFunction extends AbstractSQLFunction {
private final String property;

public NotEmptySQLFunction(String property) {

this.property = property;
}

@Override
public String sqlSegment(TableAvailable defaultTable) {
return "({0} IS NOT NULL AND {0} <> '')";
}

@Override
public int paramMarks() {
return 1;
}

@Override
protected void consume0(SQLNativeChainExpressionContext context) {
context.expression(this.property);
}
}
2 changes: 1 addition & 1 deletion sql-db-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>easy-query-all</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<artifactId>sql-db-support</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sql-db-support/sql-dameng/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>easy-query-all</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sql-db-support/sql-h2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>easy-query-all</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sql-db-support/sql-kingbase-es/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>easy-query-all</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>sql-kingbase-es</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion sql-db-support/sql-mssql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>easy-query-all</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sql-db-support/sql-mysql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>easy-query-all</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sql-db-support/sql-oracle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>easy-query-all</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion sql-db-support/sql-pgsql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.easy-query</groupId>
<artifactId>easy-query-all</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Loading

0 comments on commit 5e77b71

Please sign in to comment.