mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
Merge branch 'refs/heads/master' into snapshot
# Conflicts: # pom.xml
This commit is contained in:
commit
eb3cecf626
3
.github/workflows/depoly.yml
vendored
3
.github/workflows/depoly.yml
vendored
@ -1,8 +1,7 @@
|
|||||||
name: Maven Package
|
name: Maven Package
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
push: tags
|
||||||
types: [ created ]
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
2
.github/workflows/snapshot.yml
vendored
2
.github/workflows/snapshot.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
|||||||
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
|
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
|
||||||
|
|
||||||
- name: Publish to Apache Maven Central
|
- name: Publish to Apache Maven Central
|
||||||
run: mvn deploy -Psnapshot
|
run: mvn deploy -Prelease -Psnapshot
|
||||||
env:
|
env:
|
||||||
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
|
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
|
||||||
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
|
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
|
||||||
|
13
README-zh.md
13
README-zh.md
@ -10,7 +10,10 @@
|
|||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://central.sonatype.com/artifact/com.github.yulichang/mybatis-plus-join-boot-starter">
|
<a href="https://central.sonatype.com/artifact/com.github.yulichang/mybatis-plus-join-boot-starter">
|
||||||
<img alt="maven" src="https://img.shields.io/maven-central/v/com.github.yulichang/mybatis-plus-join-boot-starter.svg?style=flat-square">
|
<img alt="Maven central" src="https://img.shields.io/maven-central/v/com.github.yulichang/mybatis-plus-join-boot-starter.svg?style=flat-square">
|
||||||
|
</a>
|
||||||
|
<a href="https://oss.sonatype.org/content/repositories/snapshots/com/github/yulichang/mybatis-plus-join-boot-starter/">
|
||||||
|
<img alt="Sonatype Nexus (Snapshots)" src="https://img.shields.io/nexus/s/https/oss.sonatype.org/com.github.yulichang/mybatis-plus-join-boot-starter.svg">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.apache.org/licenses/LICENSE-2.0">
|
<a href="https://www.apache.org/licenses/LICENSE-2.0">
|
||||||
<img alt="code style" src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square">
|
<img alt="code style" src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square">
|
||||||
@ -115,12 +118,16 @@ MPJLambdaWrapper其他功能
|
|||||||
|
|
||||||
* <a href="https://mybatis-plus-join.github.io/pages/core/lambda/select/selectCollection.html" target="_blank">
|
* <a href="https://mybatis-plus-join.github.io/pages/core/lambda/select/selectCollection.html" target="_blank">
|
||||||
一对一,一对多使用</a>
|
一对一,一对多使用</a>
|
||||||
* <a href="https://mybatis-plus-join.github.io/pages/core/lambda/select/selectFunc.html" target="_blank">简单的SQL函数使用</a>
|
* <a href="https://mybatis-plus-join.github.io/pages/core/lambda/select/selectFunc.html" target="_blank">
|
||||||
* <a href="https://mybatis-plus-join.github.io/pages/core/lambda/join/leftJoin.html" target="_blank">ON语句多条件支持</a>
|
简单的SQL函数使用</a>
|
||||||
|
* <a href="https://mybatis-plus-join.github.io/pages/core/lambda/join/leftJoin.html" target="_blank">
|
||||||
|
ON语句多条件支持</a>
|
||||||
* <a href="https://mybatis-plus-join.github.io" target="_blank">其他全部功能请参考使用文档</a>
|
* <a href="https://mybatis-plus-join.github.io" target="_blank">其他全部功能请参考使用文档</a>
|
||||||
|
|
||||||
# <a href="https://mybatis-plus-join.github.io" target="_blank">使用文档 wiki</a>
|
# <a href="https://mybatis-plus-join.github.io" target="_blank">使用文档 wiki</a>
|
||||||
|
|
||||||
# 用爱发电
|
# 用爱发电
|
||||||
|
|
||||||
<a href="https://mybatis-plus-join.github.io/pages/quickstart/support.html" target="_blank">
|
<a href="https://mybatis-plus-join.github.io/pages/quickstart/support.html" target="_blank">
|
||||||
<img alt="支持一下mybatis-plus-join" src="https://foruda.gitee.com/images/1717191488951888381/8463cfcd_2020985.png">
|
<img alt="支持一下mybatis-plus-join" src="https://foruda.gitee.com/images/1717191488951888381/8463cfcd_2020985.png">
|
||||||
</a>
|
</a>
|
||||||
|
@ -10,7 +10,10 @@
|
|||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://central.sonatype.com/artifact/com.github.yulichang/mybatis-plus-join-boot-starter">
|
<a href="https://central.sonatype.com/artifact/com.github.yulichang/mybatis-plus-join-boot-starter">
|
||||||
<img alt="maven" src="https://img.shields.io/maven-central/v/com.github.yulichang/mybatis-plus-join-boot-starter.svg?style=flat-square">
|
<img alt="Maven central" src="https://img.shields.io/maven-central/v/com.github.yulichang/mybatis-plus-join-boot-starter.svg?style=flat-square">
|
||||||
|
</a>
|
||||||
|
<a href="https://oss.sonatype.org/content/repositories/snapshots/com/github/yulichang/mybatis-plus-join-boot-starter/">
|
||||||
|
<img alt="Sonatype Nexus (Snapshots)" src="https://img.shields.io/nexus/s/https/oss.sonatype.org/com.github.yulichang/mybatis-plus-join-boot-starter.svg">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.apache.org/licenses/LICENSE-2.0">
|
<a href="https://www.apache.org/licenses/LICENSE-2.0">
|
||||||
<img alt="code style" src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square">
|
<img alt="code style" src="https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square">
|
||||||
|
@ -64,6 +64,11 @@
|
|||||||
<artifactId>mybatis-plus-join-adapter-v355</artifactId>
|
<artifactId>mybatis-plus-join-adapter-v355</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.yulichang</groupId>
|
||||||
|
<artifactId>mybatis-plus-join-wrapper-ext</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-extension</artifactId>
|
<artifactId>mybatis-plus-extension</artifactId>
|
||||||
@ -99,5 +104,19 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
@ -3,6 +3,7 @@ package com.github.yulichang.config;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.github.yulichang.interceptor.MPJInterceptor;
|
import com.github.yulichang.interceptor.MPJInterceptor;
|
||||||
import com.github.yulichang.toolkit.InterceptorList;
|
import com.github.yulichang.toolkit.InterceptorList;
|
||||||
|
import com.github.yulichang.toolkit.MybatisJoinPlusVersion;
|
||||||
import org.apache.ibatis.logging.Log;
|
import org.apache.ibatis.logging.Log;
|
||||||
import org.apache.ibatis.logging.LogFactory;
|
import org.apache.ibatis.logging.LogFactory;
|
||||||
import org.apache.ibatis.plugin.Interceptor;
|
import org.apache.ibatis.plugin.Interceptor;
|
||||||
@ -30,7 +31,7 @@ public class MPJInterceptorConfig {
|
|||||||
System.out.println(" _ _ |_ _ _|_. ___ _ | _ . _ . _ \n" +
|
System.out.println(" _ _ |_ _ _|_. ___ _ | _ . _ . _ \n" +
|
||||||
"| | |\\/|_)(_| | |_\\ |_)||_|_\\ | (_) | | | \n" +
|
"| | |\\/|_)(_| | |_\\ |_)||_|_\\ | (_) | | | \n" +
|
||||||
" / | /\n" +
|
" / | /\n" +
|
||||||
" 1.5.2-SNAPSHOT");
|
" " + MybatisJoinPlusVersion.getVersion());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,8 @@ public class MPJQueryWrapper<T> extends AbstractWrapper<T, String, MPJQueryWrapp
|
|||||||
*/
|
*/
|
||||||
public MPJLambdaQueryWrapper<T> lambda() {
|
public MPJLambdaQueryWrapper<T> lambda() {
|
||||||
return new MPJLambdaQueryWrapper<>(getEntity(), getEntityClass(), from, sqlSelect, paramNameSeq, paramNameValuePairs,
|
return new MPJLambdaQueryWrapper<>(getEntity(), getEntityClass(), from, sqlSelect, paramNameSeq, paramNameValuePairs,
|
||||||
expression, lastSql, sqlComment, getSqlFirstField(), selectColumns, ignoreColumns, selectDistinct, ifExists);
|
expression, lastSql, sqlComment, getSqlFirstField(), selectColumns, ignoreColumns, selectDistinct, ifExists)
|
||||||
|
.setAlias(this.alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.github.yulichang.toolkit;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.JarURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.security.CodeSource;
|
||||||
|
import java.util.jar.Attributes;
|
||||||
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* copy {@link com.baomidou.mybatisplus.core.MybatisPlusVersion}
|
||||||
|
*
|
||||||
|
* @since 1.5.2
|
||||||
|
*/
|
||||||
|
public class MybatisJoinPlusVersion {
|
||||||
|
|
||||||
|
private MybatisJoinPlusVersion() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getVersion() {
|
||||||
|
return determineSpringBootVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String determineSpringBootVersion() {
|
||||||
|
final Package pkg = MybatisJoinPlusVersion.class.getPackage();
|
||||||
|
if (pkg != null && pkg.getImplementationVersion() != null) {
|
||||||
|
return pkg.getImplementationVersion();
|
||||||
|
}
|
||||||
|
CodeSource codeSource = MybatisJoinPlusVersion.class.getProtectionDomain().getCodeSource();
|
||||||
|
if (codeSource == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
URL codeSourceLocation = codeSource.getLocation();
|
||||||
|
try {
|
||||||
|
URLConnection connection = codeSourceLocation.openConnection();
|
||||||
|
if (connection instanceof JarURLConnection) {
|
||||||
|
return getImplementationVersion(((JarURLConnection) connection).getJarFile());
|
||||||
|
}
|
||||||
|
try (JarFile jarFile = new JarFile(new File(codeSourceLocation.toURI()))) {
|
||||||
|
return getImplementationVersion(jarFile);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getImplementationVersion(JarFile jarFile) throws IOException {
|
||||||
|
return jarFile.getManifest().getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -14,6 +14,7 @@ import com.github.yulichang.config.enums.LogicDelTypeEnum;
|
|||||||
import com.github.yulichang.toolkit.*;
|
import com.github.yulichang.toolkit.*;
|
||||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||||
import com.github.yulichang.wrapper.enums.PrefixEnum;
|
import com.github.yulichang.wrapper.enums.PrefixEnum;
|
||||||
|
import com.github.yulichang.wrapper.ext.Ext;
|
||||||
import com.github.yulichang.wrapper.interfaces.MConsumer;
|
import com.github.yulichang.wrapper.interfaces.MConsumer;
|
||||||
import com.github.yulichang.wrapper.interfaces.MFunction;
|
import com.github.yulichang.wrapper.interfaces.MFunction;
|
||||||
import com.github.yulichang.wrapper.interfaces.QueryJoin;
|
import com.github.yulichang.wrapper.interfaces.QueryJoin;
|
||||||
@ -40,7 +41,7 @@ import static java.util.stream.Collectors.joining;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings({"DuplicatedCode", "unused"})
|
@SuppressWarnings({"DuplicatedCode", "unused"})
|
||||||
public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstractLambdaWrapper<T, Children>>
|
public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstractLambdaWrapper<T, Children>>
|
||||||
extends JoinAbstractWrapper<T, Children> implements QueryJoin<Children, T> {
|
extends JoinAbstractWrapper<T, Children> implements QueryJoin<Children, T>, Ext<Children> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否存在对一或对多
|
* 是否存在对一或对多
|
||||||
|
@ -2,11 +2,13 @@ package com.github.yulichang.wrapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.SharedString;
|
import com.baomidou.mybatisplus.core.conditions.SharedString;
|
||||||
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.*;
|
import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
import com.github.yulichang.config.ConfigProperties;
|
import com.github.yulichang.config.ConfigProperties;
|
||||||
import com.github.yulichang.toolkit.*;
|
import com.github.yulichang.toolkit.*;
|
||||||
import com.github.yulichang.toolkit.LambdaUtils;
|
|
||||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||||
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
||||||
import com.github.yulichang.wrapper.interfaces.*;
|
import com.github.yulichang.wrapper.interfaces.*;
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.github.yulichang.wrapper.interfaces;
|
||||||
|
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param <Children> wrapper
|
||||||
|
* @auther yulichang
|
||||||
|
* @since 1.5.2
|
||||||
|
*/
|
||||||
|
public interface IExt<Children extends MPJLambdaWrapper<?>> {
|
||||||
|
|
||||||
|
Children getChildren();
|
||||||
|
}
|
||||||
|
|
@ -13,6 +13,17 @@
|
|||||||
<artifactId>test-join</artifactId>
|
<artifactId>test-join</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.yulichang</groupId>
|
||||||
|
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.github.yulichang</groupId>
|
||||||
|
<artifactId>mybatis-plus-join-wrapper-ext</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.yulichang</groupId>
|
<groupId>com.github.yulichang</groupId>
|
||||||
<artifactId>test-base</artifactId>
|
<artifactId>test-base</artifactId>
|
||||||
@ -39,5 +50,13 @@
|
|||||||
<artifactId>mybatis-plus-join-processor</artifactId>
|
<artifactId>mybatis-plus-join-processor</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ognl</groupId>
|
||||||
|
<artifactId>ognl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.javassist</groupId>
|
||||||
|
<artifactId>javassist</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.github.yulichang.test.join.repository;
|
||||||
|
|
||||||
|
import com.github.yulichang.repository.JoinCrudRepository;
|
||||||
|
import com.github.yulichang.test.join.entity.UserDO;
|
||||||
|
import com.github.yulichang.test.join.mapper.UserMapper;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class UserCrudRepository extends JoinCrudRepository<UserMapper, UserDO> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.github.yulichang.wrapper.ext;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.github.yulichang.wrapper.interfaces.IExt;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface Ext<Children extends MPJLambdaWrapper<?>> extends IExt<Children> {
|
||||||
|
|
||||||
|
default <T, R> Children cccEq(SFunction<T, ?> c, Object val) {
|
||||||
|
getChildren().eq(c, val);
|
||||||
|
return getChildren();
|
||||||
|
}
|
||||||
|
}
|
@ -128,4 +128,17 @@ class QueryWrapperTest {
|
|||||||
System.out.println(userDO);
|
System.out.println(userDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void test7() {
|
||||||
|
ThreadLocalUtils.set("SELECT tt.id AS idea, tt.user_id AS uuid, tt.tenant_id FROM user_tenant tt WHERE (tt.id <= ?) AND tt.tenant_id = 1");
|
||||||
|
MPJQueryWrapper<UserTenantDO> wrapper = new MPJQueryWrapper<UserTenantDO>()
|
||||||
|
.setAlias("tt")
|
||||||
|
.selectAll(UserTenantDO.class,"tt")
|
||||||
|
.le("tt.id ", 10);
|
||||||
|
System.out.println(wrapper.getAlias());
|
||||||
|
List<UserTenantDO> userDO = userTenantMapper.selectJoinList(UserTenantDO.class, wrapper.lambda());
|
||||||
|
System.out.println(wrapper.getAlias());
|
||||||
|
System.out.println(userDO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.github.yulichang.test.join.unit;
|
||||||
|
|
||||||
|
import com.github.yulichang.test.join.entity.UserDO;
|
||||||
|
import com.github.yulichang.test.util.Reset;
|
||||||
|
import com.github.yulichang.test.util.ThreadLocalUtils;
|
||||||
|
import com.github.yulichang.toolkit.JoinWrappers;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
public class ExtWrapperTest {
|
||||||
|
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
void setUp() {
|
||||||
|
Reset.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void applyFunc() {
|
||||||
|
ThreadLocalUtils.set("SELECT t.id, t.pid, t.`name`, t.`json`, " +
|
||||||
|
"t.sex, t.head_img, t.create_time, t.address_id, " +
|
||||||
|
"t.address_id2, t.del, t.create_by, t.update_by " +
|
||||||
|
"FROM `user` t WHERE t.del = false AND (t.id = ?)");
|
||||||
|
MPJLambdaWrapper<UserDO> wrapper = JoinWrappers.lambda(UserDO.class)
|
||||||
|
.selectAll()
|
||||||
|
.cccEq(UserDO::getId, 1);
|
||||||
|
wrapper.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -3,7 +3,7 @@ package com.github.yulichang.test.join.unit;
|
|||||||
import com.github.yulichang.test.join.dto.UserDTO;
|
import com.github.yulichang.test.join.dto.UserDTO;
|
||||||
import com.github.yulichang.test.join.entity.AddressDO;
|
import com.github.yulichang.test.join.entity.AddressDO;
|
||||||
import com.github.yulichang.test.join.entity.UserDO;
|
import com.github.yulichang.test.join.entity.UserDO;
|
||||||
import com.github.yulichang.test.join.mapper.UserMapper;
|
import com.github.yulichang.test.join.repository.UserCrudRepository;
|
||||||
import com.github.yulichang.test.util.Reset;
|
import com.github.yulichang.test.util.Reset;
|
||||||
import com.github.yulichang.test.util.ThreadLocalUtils;
|
import com.github.yulichang.test.util.ThreadLocalUtils;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
@ -19,7 +19,7 @@ import java.util.List;
|
|||||||
public class StringColumTest {
|
public class StringColumTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserMapper userMapper;
|
private UserCrudRepository userCrudRepository;
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
void setUp() {
|
void setUp() {
|
||||||
@ -33,7 +33,7 @@ public class StringColumTest {
|
|||||||
ThreadLocalUtils.set("SELECT (SELECT id FROM `user` u WHERE u.id = t.id) id, t.`name` AS PName, t.`name` PName, t.`name`," +
|
ThreadLocalUtils.set("SELECT (SELECT id FROM `user` u WHERE u.id = t.id) id, t.`name` AS PName, t.`name` PName, t.`name`," +
|
||||||
" (SELECT id FROM `user` u WHERE u.id = t.id), t1.id AS joina_id, t1.user_id, t1.area_id, t1.tel, " +
|
" (SELECT id FROM `user` u WHERE u.id = t.id), t1.id AS joina_id, t1.user_id, t1.area_id, t1.tel, " +
|
||||||
"t1.address, t1.del FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false");
|
"t1.address, t1.del FROM `user` t LEFT JOIN address t1 ON (t1.user_id = t.id) WHERE t.del = false AND t1.del = false");
|
||||||
List<UserDTO> l3 = userMapper.selectJoinList(UserDTO.class, new MPJLambdaWrapper<UserDO>()
|
List<UserDTO> l3 = userCrudRepository.selectJoinList(UserDTO.class, new MPJLambdaWrapper<UserDO>()
|
||||||
.select("(select id from `user` u where u.id = t.id) id")
|
.select("(select id from `user` u where u.id = t.id) id")
|
||||||
.select("t.`name` as PName")
|
.select("t.`name` as PName")
|
||||||
.select("t.`name` PName")
|
.select("t.`name` PName")
|
||||||
|
@ -18,14 +18,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ognl</groupId>
|
<groupId>ognl</groupId>
|
||||||
<artifactId>ognl</artifactId>
|
<artifactId>ognl</artifactId>
|
||||||
<version>3.4.3</version>
|
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.javassist</groupId>
|
<groupId>org.javassist</groupId>
|
||||||
<artifactId>javassist</artifactId>
|
<artifactId>javassist</artifactId>
|
||||||
<version>3.30.2-GA</version>
|
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
<relativePath>../../pom.xml</relativePath>
|
<relativePath>../../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
<version>${revision}</version>
|
||||||
|
|
||||||
<artifactId>mybatis-plus-join-solon-plugin</artifactId>
|
<artifactId>mybatis-plus-join-solon-plugin</artifactId>
|
||||||
|
|
||||||
|
16
plugin/mybatis-plus-join-wrapper-ext/pom.xml
Normal file
16
plugin/mybatis-plus-join-wrapper-ext/pom.xml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.github.yulichang</groupId>
|
||||||
|
<artifactId>mybatis-plus-join-root</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<version>${revision}</version>
|
||||||
|
|
||||||
|
<artifactId>mybatis-plus-join-wrapper-ext</artifactId>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.github.yulichang.wrapper.ext;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义Wrapper扩展
|
||||||
|
*
|
||||||
|
* @param <Wrapper> wrapper 一般是指 MPJLambdaWrapper
|
||||||
|
* @auther yulichang
|
||||||
|
* @since 1.5.2
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public interface Ext<Wrapper> {
|
||||||
|
}
|
87
pom.xml
87
pom.xml
@ -38,12 +38,14 @@
|
|||||||
|
|
||||||
<module>plugin/mybatis-plus-join-solon-plugin</module>
|
<module>plugin/mybatis-plus-join-solon-plugin</module>
|
||||||
<module>plugin/mybatis-plus-join-processor</module>
|
<module>plugin/mybatis-plus-join-processor</module>
|
||||||
|
<module>plugin/mybatis-plus-join-wrapper-ext</module>
|
||||||
|
|
||||||
<module>mybatis-plus-join-test</module>
|
<module>mybatis-plus-join-test</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<revision>1.5.2-SNAPSHOT</revision>
|
<version>1.5.2</version>
|
||||||
|
<revision>${version}</revision>
|
||||||
<mybatis.plus.version>3.5.9</mybatis.plus.version>
|
<mybatis.plus.version>3.5.9</mybatis.plus.version>
|
||||||
|
|
||||||
<jdkVersion>17</jdkVersion>
|
<jdkVersion>17</jdkVersion>
|
||||||
@ -66,82 +68,25 @@
|
|||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ognl</groupId>
|
||||||
|
<artifactId>ognl</artifactId>
|
||||||
|
<version>3.4.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.javassist</groupId>
|
||||||
|
<artifactId>javassist</artifactId>
|
||||||
|
<version>3.30.2-GA</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<profile>
|
||||||
<id>snapshot</id>
|
<id>snapshot</id>
|
||||||
<build>
|
<properties>
|
||||||
<plugins>
|
<revision>${version}-SNAPSHOT</revision>
|
||||||
<plugin>
|
</properties>
|
||||||
<groupId>org.sonatype.plugins</groupId>
|
|
||||||
<artifactId>nexus-staging-maven-plugin</artifactId>
|
|
||||||
<extensions>true</extensions>
|
|
||||||
<configuration>
|
|
||||||
<serverId>maven</serverId>
|
|
||||||
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
|
|
||||||
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-sources</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar-no-fork</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-javadocs</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
|
||||||
<additionalJOptions>
|
|
||||||
<additionalJOption>-Xdoclint:none</additionalJOption>
|
|
||||||
</additionalJOptions>
|
|
||||||
<charset>UTF-8</charset>
|
|
||||||
<docencoding>UTF-8</docencoding>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<phase>verify</phase>
|
|
||||||
<goals>
|
|
||||||
<goal>sign</goal>
|
|
||||||
</goals>
|
|
||||||
<configuration>
|
|
||||||
<gpgArguments>
|
|
||||||
<arg>--pinentry-mode</arg>
|
|
||||||
<arg>loopback</arg>
|
|
||||||
</gpgArguments>
|
|
||||||
</configuration>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
<distributionManagement>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>maven</id>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
</distributionManagement>
|
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>release</id>
|
<id>release</id>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user