From 5fd49c83e7113257169f7e7a46458196d4ce04eb Mon Sep 17 00:00:00 2001
From: yulichang <570810310@qq.com>
Date: Fri, 4 Oct 2024 22:21:05 +0800
Subject: [PATCH] feat: selectSub add String alias
---
README-zh.md | 4 +-
README.md | 4 +-
.../extension/apt/AptQueryWrapper.java | 13 +-
.../extension/kt/KtLambdaWrapper.java | 13 +-
.../yulichang/wrapper/MPJLambdaWrapper.java | 9 +-
ossrh.xml | 138 ------------------
pom.xml | 3 +
7 files changed, 33 insertions(+), 151 deletions(-)
delete mode 100644 ossrh.xml
diff --git a/README-zh.md b/README-zh.md
index e4a3ad5..271ee0d 100644
--- a/README-zh.md
+++ b/README-zh.md
@@ -121,4 +121,6 @@ MPJLambdaWrapper其他功能
# 使用文档 wiki
# 用爱发电
-
+
+
+
diff --git a/README.md b/README.md
index 38a62f4..c1fe4f6 100644
--- a/README.md
+++ b/README.md
@@ -122,4 +122,6 @@ MPJLambdaWrapper其他功能
# 使用文档 wiki
# 用爱发电
-
+
+
+
diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/extension/apt/AptQueryWrapper.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/extension/apt/AptQueryWrapper.java
index 79be9e2..4aadff7 100644
--- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/extension/apt/AptQueryWrapper.java
+++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/extension/apt/AptQueryWrapper.java
@@ -5,11 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
-import com.github.yulichang.extension.apt.matedata.BaseColumn;
-import com.github.yulichang.extension.apt.matedata.Column;
import com.github.yulichang.config.ConfigProperties;
import com.github.yulichang.extension.apt.interfaces.Query;
import com.github.yulichang.extension.apt.interfaces.QueryLabel;
+import com.github.yulichang.extension.apt.matedata.BaseColumn;
+import com.github.yulichang.extension.apt.matedata.Column;
import com.github.yulichang.extension.apt.toolkit.AptWrapperUtils;
import com.github.yulichang.extension.apt.toolkit.AptWrappers;
import com.github.yulichang.toolkit.Constant;
@@ -192,10 +192,14 @@ public class AptQueryWrapper extends AptAbstractWrapper
return selectAll(getBaseColumn());
}
+ public AptQueryWrapper selectSub(BaseColumn baseColumn, Consumer> consumer, SFunction alias) {
+ return selectSub(baseColumn, consumer, LambdaUtils.getName(alias));
+ }
+
/**
* 子查询
*/
- public AptQueryWrapper selectSub(BaseColumn baseColumn, Consumer> consumer, SFunction alias) {
+ public AptQueryWrapper selectSub(BaseColumn baseColumn, Consumer> consumer, String alias) {
AptQueryWrapper wrapper = new AptQueryWrapper(null, baseColumn, SharedString.emptyString(),
paramNameSeq, paramNameValuePairs, new MergeSegments(), new SharedString(this.paramAlias
.getStringValue()), SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(),
@@ -209,8 +213,7 @@ public class AptQueryWrapper extends AptAbstractWrapper
wrapper.subTableAlias = ConfigProperties.subQueryAlias;
consumer.accept(wrapper);
addCustomWrapper(wrapper);
- String name = LambdaUtils.getName(alias);
- this.selectColumns.add(new SelectSub(() -> AptWrapperUtils.buildSubSqlByWrapper(baseColumn.getColumnClass(), wrapper, name), hasAlias, this.alias, name));
+ this.selectColumns.add(new SelectSub(() -> AptWrapperUtils.buildSubSqlByWrapper(baseColumn.getColumnClass(), wrapper, alias), hasAlias, this.alias, alias));
return typedThis;
}
diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/extension/kt/KtLambdaWrapper.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/extension/kt/KtLambdaWrapper.java
index 652785e..93b4347 100644
--- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/extension/kt/KtLambdaWrapper.java
+++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/extension/kt/KtLambdaWrapper.java
@@ -9,7 +9,9 @@ import com.github.yulichang.extension.kt.interfaces.Query;
import com.github.yulichang.extension.kt.interfaces.QueryLabel;
import com.github.yulichang.extension.kt.toolkit.KtWrapperUtils;
import com.github.yulichang.extension.kt.toolkit.KtWrappers;
-import com.github.yulichang.toolkit.*;
+import com.github.yulichang.toolkit.Constant;
+import com.github.yulichang.toolkit.KtUtils;
+import com.github.yulichang.toolkit.TableList;
import com.github.yulichang.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.interfaces.Chain;
import com.github.yulichang.wrapper.interfaces.SelectWrapper;
@@ -204,11 +206,16 @@ public class KtLambdaWrapper extends KtAbstractLambdaWrapper KtLambdaWrapper selectSub(Class clazz, String st, Consumer> consumer, KProperty> alias) {
+ return selectSub(clazz, st, consumer, alias.getName());
+ }
+
/**
* 子查询
*/
public KtLambdaWrapper selectSub(Class> clazz, String st,
- Consumer> consumer, KProperty> alias) {
+ Consumer> consumer, String alias) {
KtLambdaWrapper> wrapper = new KtLambdaWrapper(null, clazz, SharedString.emptyString(), paramNameSeq,
paramNameValuePairs, new MergeSegments(), new SharedString(this.paramAlias.getStringValue()),
SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(), new TableList(),
@@ -222,7 +229,7 @@ public class KtLambdaWrapper extends KtAbstractLambdaWrapper KtWrapperUtils.buildSubSqlByWrapper(
- clazz, wrapper, alias.getName()), hasAlias, this.alias, alias.getName()));
+ clazz, wrapper, alias), hasAlias, this.alias, alias));
return typedThis;
}
diff --git a/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/MPJLambdaWrapper.java b/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/MPJLambdaWrapper.java
index 23696e3..cd41a9c 100644
--- a/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/MPJLambdaWrapper.java
+++ b/mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/MPJLambdaWrapper.java
@@ -241,10 +241,14 @@ public class MPJLambdaWrapper extends JoinAbstractLambdaWrapper MPJLambdaWrapper selectSub(Class clazz, String st, Consumer> consumer, SFunction alias) {
+ return selectSub(clazz, st, consumer, LambdaUtils.getName(alias));
+ }
+
/**
* 子查询
*/
- public MPJLambdaWrapper selectSub(Class clazz, String st, Consumer> consumer, SFunction alias) {
+ public MPJLambdaWrapper selectSub(Class clazz, String st, Consumer> consumer, String alias) {
MPJLambdaWrapper wrapper = new MPJLambdaWrapper(null, clazz, SharedString.emptyString(),
paramNameSeq, paramNameValuePairs, new MergeSegments(), new SharedString(this.paramAlias
.getStringValue()), SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(),
@@ -257,8 +261,7 @@ public class MPJLambdaWrapper extends JoinAbstractLambdaWrapper WrapperUtils.buildSubSqlByWrapper(clazz, wrapper, name), hasAlias, this.alias, name));
+ this.selectColumns.add(new SelectSub(() -> WrapperUtils.buildSubSqlByWrapper(clazz, wrapper, alias), hasAlias, this.alias, alias));
return typedThis;
}
diff --git a/ossrh.xml b/ossrh.xml
deleted file mode 100644
index 8e22f00..0000000
--- a/ossrh.xml
+++ /dev/null
@@ -1,138 +0,0 @@
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.2.1
-
-
- attach-sources
-
- jar-no-fork
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.9.1
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.5
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.8
- true
-
- ossrh
- https://oss.sonatype.org/
- true
- 30
-
-
-
-
-
-
- disable-javadoc-doclint
-
- [1.8,)
-
-
- -Xdoclint:none
-
-
-
- release
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 2.2.1
-
-
- attach-sources
-
- jar-no-fork
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.9.1
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.5
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.8
- true
-
- ossrh
- https://oss.sonatype.org/
- true
- 30
-
-
-
-
-
-
-
-
- ossrh
- https://oss.sonatype.org/content/repositories/snapshots
-
-
- ossrh
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
diff --git a/pom.xml b/pom.xml
index d0968b1..754cf67 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,6 +52,9 @@
8
github
UTF-8
+ UTF-8
+ UTF-8
+ -Dfile.encoding=UTF-8