mirror of
https://gitee.com/dromara/MilvusPlus.git
synced 2025-12-06 17:08:27 +08:00
添加like查询左右匹配
This commit is contained in:
parent
2077fb9bbc
commit
50090f9a34
@ -264,6 +264,24 @@ public abstract class ConditionBuilder<T> {
|
||||
filters.add(fn + " like '%" + value + "%'");
|
||||
return this;
|
||||
}
|
||||
protected ConditionBuilder<T> likeLeft(String fieldName, String value) {
|
||||
filters.add(wrapFieldName(fieldName) + " like '" + value + "%'");
|
||||
return this;
|
||||
}
|
||||
protected ConditionBuilder<T> likeRight(String fieldName, String value) {
|
||||
filters.add(wrapFieldName(fieldName) + " like '%'" + value + "'");
|
||||
return this;
|
||||
}
|
||||
protected ConditionBuilder<T> likeLeft(FieldFunction<T,?> fieldName, String value) {
|
||||
String fn = getFieldName(fieldName);
|
||||
filters.add(fn + " like '" + value + "%'");
|
||||
return this;
|
||||
}
|
||||
protected ConditionBuilder<T> likeRight(FieldFunction<T,?> fieldName, String value) {
|
||||
String fn = getFieldName(fieldName);
|
||||
filters.add(fn + " like '%" + value + "'");
|
||||
return this;
|
||||
}
|
||||
|
||||
// JSON array operations
|
||||
public ConditionBuilder<T> jsonContains(FieldFunction<T,?> fieldName, Object value) {
|
||||
@ -369,4 +387,5 @@ public abstract class ConditionBuilder<T> {
|
||||
filters.add(wrapFieldName(getFieldName(fieldName)) + " " + op + " " + convertValue(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@ -180,6 +180,48 @@ public class LambdaDeleteWrapper<T> extends AbstractChainWrapper<T> implements
|
||||
super.like(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
////
|
||||
public LambdaDeleteWrapper<T> likeLeft(String fieldName, String value) {
|
||||
super.likeLeft(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaDeleteWrapper<T> likeLeft(boolean condition,String fieldName, String value) {
|
||||
if(condition){
|
||||
super.likeLeft(fieldName,value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public LambdaDeleteWrapper<T> likeLeft(FieldFunction<T,?> fieldName, String value) {
|
||||
super.likeLeft(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaDeleteWrapper<T> likeLeft(boolean condition, FieldFunction<T, ?> fieldName, String value) {
|
||||
if (condition) {
|
||||
super.likeLeft(fieldName, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
////
|
||||
public LambdaDeleteWrapper<T> likeRight(String fieldName, String value) {
|
||||
super.likeRight(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaDeleteWrapper<T> likeRight(boolean condition,String fieldName, String value) {
|
||||
if(condition){
|
||||
super.likeRight(fieldName,value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public LambdaDeleteWrapper<T> likeRight(FieldFunction<T,?> fieldName, String value) {
|
||||
super.likeRight(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaDeleteWrapper<T> likeRight(boolean condition, FieldFunction<T, ?> fieldName, String value) {
|
||||
if (condition) {
|
||||
super.likeRight(fieldName, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public LambdaDeleteWrapper<T> jsonContains(String fieldName, Object value) {
|
||||
super.jsonContains(fieldName,value);
|
||||
|
||||
@ -307,6 +307,58 @@ public class LambdaQueryWrapper<T> extends AbstractChainWrapper<T> implements Wr
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public LambdaQueryWrapper<T> like(FieldFunction<T,?> fieldName, String value) {
|
||||
super.like(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaQueryWrapper<T> like(boolean condition, FieldFunction<T, ?> fieldName, String value) {
|
||||
if (condition) {
|
||||
super.like(fieldName, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
////
|
||||
public LambdaQueryWrapper<T> likeLeft(String fieldName, String value) {
|
||||
super.likeLeft(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaQueryWrapper<T> likeLeft(boolean condition,String fieldName, String value) {
|
||||
if(condition){
|
||||
super.likeLeft(fieldName,value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public LambdaQueryWrapper<T> likeLeft(FieldFunction<T,?> fieldName, String value) {
|
||||
super.likeLeft(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaQueryWrapper<T> likeLeft(boolean condition, FieldFunction<T, ?> fieldName, String value) {
|
||||
if (condition) {
|
||||
super.likeLeft(fieldName, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
////
|
||||
public LambdaQueryWrapper<T> likeRight(String fieldName, String value) {
|
||||
super.likeRight(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaQueryWrapper<T> likeRight(boolean condition,String fieldName, String value) {
|
||||
if(condition){
|
||||
super.likeRight(fieldName,value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public LambdaQueryWrapper<T> likeRight(FieldFunction<T,?> fieldName, String value) {
|
||||
super.likeRight(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaQueryWrapper<T> likeRight(boolean condition, FieldFunction<T, ?> fieldName, String value) {
|
||||
if (condition) {
|
||||
super.likeRight(fieldName, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapper<T> jsonContains(String fieldName, Object value) {
|
||||
super.jsonContains(fieldName,value);
|
||||
@ -438,11 +490,6 @@ public class LambdaQueryWrapper<T> extends AbstractChainWrapper<T> implements Wr
|
||||
return this;
|
||||
}
|
||||
|
||||
// Like operator
|
||||
public LambdaQueryWrapper<T> like(FieldFunction<T,?> fieldName, String value) {
|
||||
super.like(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
|
||||
// JSON array operations
|
||||
public LambdaQueryWrapper<T> jsonContains(FieldFunction<T,?> fieldName, Object value) {
|
||||
@ -536,13 +583,6 @@ public class LambdaQueryWrapper<T> extends AbstractChainWrapper<T> implements Wr
|
||||
return this;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapper<T> like(boolean condition, FieldFunction<T, ?> fieldName, String value) {
|
||||
if (condition) {
|
||||
super.like(fieldName, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapper<T> jsonContains(boolean condition, FieldFunction<T, ?> fieldName, Object value) {
|
||||
if (condition) {
|
||||
super.jsonContains(fieldName, value);
|
||||
|
||||
@ -187,6 +187,48 @@ public class LambdaUpdateWrapper<T> extends AbstractChainWrapper<T> implements W
|
||||
super.like(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
////
|
||||
public LambdaUpdateWrapper<T> likeLeft(String fieldName, String value) {
|
||||
super.likeLeft(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaUpdateWrapper<T> likeLeft(boolean condition,String fieldName, String value) {
|
||||
if(condition){
|
||||
super.likeLeft(fieldName,value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public LambdaUpdateWrapper<T> likeLeft(FieldFunction<T,?> fieldName, String value) {
|
||||
super.likeLeft(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaUpdateWrapper<T> likeLeft(boolean condition, FieldFunction<T, ?> fieldName, String value) {
|
||||
if (condition) {
|
||||
super.likeLeft(fieldName, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
////
|
||||
public LambdaUpdateWrapper<T> likeRight(String fieldName, String value) {
|
||||
super.likeRight(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaUpdateWrapper<T> likeRight(boolean condition,String fieldName, String value) {
|
||||
if(condition){
|
||||
super.likeRight(fieldName,value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
public LambdaUpdateWrapper<T> likeRight(FieldFunction<T,?> fieldName, String value) {
|
||||
super.likeRight(fieldName,value);
|
||||
return this;
|
||||
}
|
||||
public LambdaUpdateWrapper<T> likeRight(boolean condition, FieldFunction<T, ?> fieldName, String value) {
|
||||
if (condition) {
|
||||
super.likeRight(fieldName, value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public LambdaUpdateWrapper<T> jsonContains(String fieldName, Object value) {
|
||||
super.jsonContains(fieldName,value);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user