-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/master' into snapshot
# Conflicts: # pom.xml
- Loading branch information
Showing
22 changed files
with
253 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
name: Maven Package | ||
|
||
on: | ||
release: | ||
types: [ created ] | ||
push: tags | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...tis-plus-join-core/src/main/java/com/github/yulichang/toolkit/MybatisJoinPlusVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
mybatis-plus-join-core/src/main/java/com/github/yulichang/wrapper/interfaces/IExt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...test-join/src/main/java/com/github/yulichang/test/join/repository/UserCrudRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> { | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
mybatis-plus-join-test/test-join/src/main/java/com/github/yulichang/wrapper/ext/Ext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...join-test/test-join/src/test/java/com/github/yulichang/test/join/unit/ExtWrapperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.