From 50090f9a348105d12a6d9efa9cf7c7efa804265d Mon Sep 17 00:00:00 2001 From: xgc Date: Tue, 29 Oct 2024 16:29:45 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0like=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/conditions/ConditionBuilder.java | 19 ++++++ .../core/conditions/LambdaDeleteWrapper.java | 42 ++++++++++++ .../core/conditions/LambdaQueryWrapper.java | 64 +++++++++++++++---- .../core/conditions/LambdaUpdateWrapper.java | 42 ++++++++++++ 4 files changed, 155 insertions(+), 12 deletions(-) diff --git a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/ConditionBuilder.java b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/ConditionBuilder.java index a2a6629..862d4f3 100644 --- a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/ConditionBuilder.java +++ b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/ConditionBuilder.java @@ -264,6 +264,24 @@ public abstract class ConditionBuilder { filters.add(fn + " like '%" + value + "%'"); return this; } + protected ConditionBuilder likeLeft(String fieldName, String value) { + filters.add(wrapFieldName(fieldName) + " like '" + value + "%'"); + return this; + } + protected ConditionBuilder likeRight(String fieldName, String value) { + filters.add(wrapFieldName(fieldName) + " like '%'" + value + "'"); + return this; + } + protected ConditionBuilder likeLeft(FieldFunction fieldName, String value) { + String fn = getFieldName(fieldName); + filters.add(fn + " like '" + value + "%'"); + return this; + } + protected ConditionBuilder likeRight(FieldFunction fieldName, String value) { + String fn = getFieldName(fieldName); + filters.add(fn + " like '%" + value + "'"); + return this; + } // JSON array operations public ConditionBuilder jsonContains(FieldFunction fieldName, Object value) { @@ -369,4 +387,5 @@ public abstract class ConditionBuilder { filters.add(wrapFieldName(getFieldName(fieldName)) + " " + op + " " + convertValue(value)); return this; } + } \ No newline at end of file diff --git a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaDeleteWrapper.java b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaDeleteWrapper.java index 1c2243e..a38d771 100644 --- a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaDeleteWrapper.java +++ b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaDeleteWrapper.java @@ -180,6 +180,48 @@ public class LambdaDeleteWrapper extends AbstractChainWrapper implements super.like(fieldName,value); return this; } + //// + public LambdaDeleteWrapper likeLeft(String fieldName, String value) { + super.likeLeft(fieldName,value); + return this; + } + public LambdaDeleteWrapper likeLeft(boolean condition,String fieldName, String value) { + if(condition){ + super.likeLeft(fieldName,value); + } + return this; + } + public LambdaDeleteWrapper likeLeft(FieldFunction fieldName, String value) { + super.likeLeft(fieldName,value); + return this; + } + public LambdaDeleteWrapper likeLeft(boolean condition, FieldFunction fieldName, String value) { + if (condition) { + super.likeLeft(fieldName, value); + } + return this; + } + //// + public LambdaDeleteWrapper likeRight(String fieldName, String value) { + super.likeRight(fieldName,value); + return this; + } + public LambdaDeleteWrapper likeRight(boolean condition,String fieldName, String value) { + if(condition){ + super.likeRight(fieldName,value); + } + return this; + } + public LambdaDeleteWrapper likeRight(FieldFunction fieldName, String value) { + super.likeRight(fieldName,value); + return this; + } + public LambdaDeleteWrapper likeRight(boolean condition, FieldFunction fieldName, String value) { + if (condition) { + super.likeRight(fieldName, value); + } + return this; + } public LambdaDeleteWrapper jsonContains(String fieldName, Object value) { super.jsonContains(fieldName,value); diff --git a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaQueryWrapper.java b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaQueryWrapper.java index eb5928d..c4b2c01 100644 --- a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaQueryWrapper.java +++ b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaQueryWrapper.java @@ -307,6 +307,58 @@ public class LambdaQueryWrapper extends AbstractChainWrapper implements Wr } return this; } + public LambdaQueryWrapper like(FieldFunction fieldName, String value) { + super.like(fieldName,value); + return this; + } + public LambdaQueryWrapper like(boolean condition, FieldFunction fieldName, String value) { + if (condition) { + super.like(fieldName, value); + } + return this; + } + //// + public LambdaQueryWrapper likeLeft(String fieldName, String value) { + super.likeLeft(fieldName,value); + return this; + } + public LambdaQueryWrapper likeLeft(boolean condition,String fieldName, String value) { + if(condition){ + super.likeLeft(fieldName,value); + } + return this; + } + public LambdaQueryWrapper likeLeft(FieldFunction fieldName, String value) { + super.likeLeft(fieldName,value); + return this; + } + public LambdaQueryWrapper likeLeft(boolean condition, FieldFunction fieldName, String value) { + if (condition) { + super.likeLeft(fieldName, value); + } + return this; + } + //// + public LambdaQueryWrapper likeRight(String fieldName, String value) { + super.likeRight(fieldName,value); + return this; + } + public LambdaQueryWrapper likeRight(boolean condition,String fieldName, String value) { + if(condition){ + super.likeRight(fieldName,value); + } + return this; + } + public LambdaQueryWrapper likeRight(FieldFunction fieldName, String value) { + super.likeRight(fieldName,value); + return this; + } + public LambdaQueryWrapper likeRight(boolean condition, FieldFunction fieldName, String value) { + if (condition) { + super.likeRight(fieldName, value); + } + return this; + } public LambdaQueryWrapper jsonContains(String fieldName, Object value) { super.jsonContains(fieldName,value); @@ -438,11 +490,6 @@ public class LambdaQueryWrapper extends AbstractChainWrapper implements Wr return this; } - // Like operator - public LambdaQueryWrapper like(FieldFunction fieldName, String value) { - super.like(fieldName,value); - return this; - } // JSON array operations public LambdaQueryWrapper jsonContains(FieldFunction fieldName, Object value) { @@ -536,13 +583,6 @@ public class LambdaQueryWrapper extends AbstractChainWrapper implements Wr return this; } - public LambdaQueryWrapper like(boolean condition, FieldFunction fieldName, String value) { - if (condition) { - super.like(fieldName, value); - } - return this; - } - public LambdaQueryWrapper jsonContains(boolean condition, FieldFunction fieldName, Object value) { if (condition) { super.jsonContains(fieldName, value); diff --git a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaUpdateWrapper.java b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaUpdateWrapper.java index 4bcb7ab..ae31757 100644 --- a/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaUpdateWrapper.java +++ b/milvus-plus-core/src/main/java/org/dromara/milvus/plus/core/conditions/LambdaUpdateWrapper.java @@ -187,6 +187,48 @@ public class LambdaUpdateWrapper extends AbstractChainWrapper implements W super.like(fieldName,value); return this; } + //// + public LambdaUpdateWrapper likeLeft(String fieldName, String value) { + super.likeLeft(fieldName,value); + return this; + } + public LambdaUpdateWrapper likeLeft(boolean condition,String fieldName, String value) { + if(condition){ + super.likeLeft(fieldName,value); + } + return this; + } + public LambdaUpdateWrapper likeLeft(FieldFunction fieldName, String value) { + super.likeLeft(fieldName,value); + return this; + } + public LambdaUpdateWrapper likeLeft(boolean condition, FieldFunction fieldName, String value) { + if (condition) { + super.likeLeft(fieldName, value); + } + return this; + } + //// + public LambdaUpdateWrapper likeRight(String fieldName, String value) { + super.likeRight(fieldName,value); + return this; + } + public LambdaUpdateWrapper likeRight(boolean condition,String fieldName, String value) { + if(condition){ + super.likeRight(fieldName,value); + } + return this; + } + public LambdaUpdateWrapper likeRight(FieldFunction fieldName, String value) { + super.likeRight(fieldName,value); + return this; + } + public LambdaUpdateWrapper likeRight(boolean condition, FieldFunction fieldName, String value) { + if (condition) { + super.likeRight(fieldName, value); + } + return this; + } public LambdaUpdateWrapper jsonContains(String fieldName, Object value) { super.jsonContains(fieldName,value); From 2ba1696977982bdb9371d27e907d4125975b26ea Mon Sep 17 00:00:00 2001 From: xgc Date: Tue, 29 Oct 2024 16:36:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8F=91=E5=B8=83=E7=89=88=E6=9C=AC2.1.6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.cn.md | 6 +++--- README.md | 6 +++--- milvus-plus-parent/pom.xml | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.cn.md b/README.cn.md index 77a4a1f..ccb0c6a 100644 --- a/README.cn.md +++ b/README.cn.md @@ -31,7 +31,7 @@ org.dromara milvus-plus-core - 2.1.5 + 2.1.6 ``` @@ -41,7 +41,7 @@ Spring应用支持: org.dromara milvus-plus-boot-starter - 2.1.5 + 2.1.6 ``` @@ -51,7 +51,7 @@ Solon应用支持: org.dromara milvus-plus-solon-plugin - 2.1.5 + 2.1.6 ``` diff --git a/README.md b/README.md index eda7c40..8a2d12d 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Custom extension support: org.dromara milvus-plus-core - 2.1.5 + 2.1.6 ``` @@ -39,7 +39,7 @@ Spring application support: org.dromara milvus-plus-boot-starter - 2.1.5 + 2.1.6 ``` @@ -49,7 +49,7 @@ Solon application support: org.dromara milvus-plus-solon-plugin - 2.1.5 + 2.1.6 ``` diff --git a/milvus-plus-parent/pom.xml b/milvus-plus-parent/pom.xml index 198cfc0..8d54c76 100644 --- a/milvus-plus-parent/pom.xml +++ b/milvus-plus-parent/pom.xml @@ -30,7 +30,7 @@ - 2.1.5 + 2.1.6 ${java.version} ${java.version} 3.11.0