This commit is contained in:
admin 2021-02-20 15:35:46 +08:00
parent 3b2f9fcd45
commit dbbe8f2341
5 changed files with 36 additions and 32 deletions

View File

@ -74,6 +74,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* {@link com.github.yulichang.common.JoinAbstractLambdaWrapper}
* {@link com.github.yulichang.wrapper.interfaces.Compare}
* {@link com.github.yulichang.wrapper.interfaces.Func}
* {@link com.github.yulichang.toolkit.LambdaUtils}
* <p>
*
* @author yulichang

View File

@ -2,13 +2,14 @@
### 使用方法
#### 如需单独使用 请拷贝以下5个类
#### 如需单独使用 请拷贝以下6个类
[com.github.yulichang.common.JoinLambdaWrapper](https://gitee.com/best_handsome/mybatis-plus-join/blob/master/src/main/java/com/github/yulichang/common/JoinLambdaWrapper.java)
[com.github.yulichang.common.JoinAbstractWrapper](https://gitee.com/best_handsome/mybatis-plus-join/blob/master/src/main/java/com/github/yulichang/common/JoinAbstractLambdaWrapper.java)
[com.github.yulichang.common.JoinAbstractLambdaWrapper](https://gitee.com/best_handsome/mybatis-plus-join/blob/master/src/main/java/com/github/yulichang/common/JoinAbstractLambdaWrapper.java)
[com.github.yulichang.wrapper.interfaces.Compare](https://gitee.com/best_handsome/mybatis-plus-join/blob/master/src/main/java/com/github/yulichang/wrapper/interfaces/Compare.java)
[com.github.yulichang.wrapper.interfaces.Func](https://gitee.com/best_handsome/mybatis-plus-join/blob/master/src/main/java/com/github/yulichang/wrapper/interfaces/Func.java)
[com.github.yulichang.toolkit.LambdaUtils](https://gitee.com/best_handsome/mybatis-plus-join/blob/master/src/main/java/com/github/yulichang/toolkit/LambdaUtils.java)
#### 不使用表别名
@ -27,7 +28,6 @@ public interface UserMapper extends BaseMapper<UserDO> {
或者xml
```
<select id="userLeftJoin" resultType="UserDTO">
select
user.*,

View File

@ -11,21 +11,20 @@ import java.util.Objects;
/**
* @author yulichang
* @see com.baomidou.mybatisplus.core.toolkit.LambdaUtils
* @see PropertyNamer
* @see org.apache.ibatis.reflection.property.PropertyNamer
*/
public final class LambdaUtils {
/**
* 获取lambda属性名
* 获取属性名
*/
public static <T> String getName(SFunction<T, ?> fn) {
return PropertyNamer.methodToProperty(com.baomidou.mybatisplus.core.toolkit.LambdaUtils.resolve(fn).getImplMethodName());
}
/**
* 获取列明
* 优先获取tableField中的值
* 获取列名
*/
public static <T> String getColumn(SFunction<T, ?> fn) {
SerializedLambda lambda = com.baomidou.mybatisplus.core.toolkit.LambdaUtils.resolve(fn);

View File

@ -7,6 +7,8 @@ import java.util.Map;
import java.util.function.BiPredicate;
/**
* 将原来的泛型R改成SFunction<R, ?>
* <p>
* {@link com.baomidou.mybatisplus.core.conditions.interfaces.Compare}
*/
public interface Compare<Children> extends Serializable {

View File

@ -11,6 +11,8 @@ import java.util.function.Consumer;
import static java.util.stream.Collectors.toList;
/**
* 将原来的泛型R改成SFunction<R, ?>
* <p>
* copy {@link com.baomidou.mybatisplus.core.conditions.interfaces.Func}
*/
@SuppressWarnings("unchecked")