mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
添加notLikeLeft和notLikeRight
This commit is contained in:
parent
a2bdce7614
commit
ef3301e7eb
@ -252,11 +252,21 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
|
||||
return likeValue(condition, LIKE, alias, column, val, SqlLike.LEFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Children notLikeLeft(boolean condition, String alias, KProperty<?> column, Object val) {
|
||||
return likeValue(condition, NOT_LIKE, alias, column, val, SqlLike.LEFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Children likeRight(boolean condition, String alias, KProperty<?> column, Object val) {
|
||||
return likeValue(condition, LIKE, alias, column, val, SqlLike.RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Children notLikeRight(boolean condition, String alias, KProperty<?> column, Object val) {
|
||||
return likeValue(condition, NOT_LIKE, alias, column, val, SqlLike.RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Children between(boolean condition, String alias, KProperty<?> column, Object val1, Object val2) {
|
||||
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column), BETWEEN,
|
||||
|
@ -287,6 +287,28 @@ public interface Compare<Children> extends Serializable {
|
||||
*/
|
||||
Children likeLeft(boolean condition, String alias, KProperty<?> column, Object val);
|
||||
|
||||
default Children notLikeLeft(KProperty<?> column, Object val) {
|
||||
return notLikeLeft(true, null, column, val);
|
||||
}
|
||||
|
||||
default Children notLikeLeft(String alias, KProperty<?> column, Object val) {
|
||||
return notLikeLeft(true, alias, column, val);
|
||||
}
|
||||
|
||||
default Children notLikeLeft(boolean condition, KProperty<?> column, Object val) {
|
||||
return notLikeLeft(condition, null, column, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* LIKE '%值'
|
||||
*
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param val 值
|
||||
* @return children
|
||||
*/
|
||||
Children notLikeLeft(boolean condition, String alias, KProperty<?> column, Object val);
|
||||
|
||||
|
||||
default Children likeRight(KProperty<?> column, Object val) {
|
||||
return likeRight(true, null, column, val);
|
||||
@ -310,4 +332,29 @@ public interface Compare<Children> extends Serializable {
|
||||
* @return children
|
||||
*/
|
||||
Children likeRight(boolean condition, String alias, KProperty<?> column, Object val);
|
||||
|
||||
|
||||
|
||||
default Children notLikeRight(KProperty<?> column, Object val) {
|
||||
return notLikeRight(true, null, column, val);
|
||||
}
|
||||
|
||||
default Children notLikeRight(String alias, KProperty<?> column, Object val) {
|
||||
return notLikeRight(true, alias, column, val);
|
||||
}
|
||||
|
||||
default Children notLikeRight(boolean condition, KProperty<?> column, Object val) {
|
||||
return notLikeRight(condition, null, column, val);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* LIKE '值%'
|
||||
*
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param val 值
|
||||
* @return children
|
||||
*/
|
||||
Children notLikeRight(boolean condition, String alias, KProperty<?> column, Object val);
|
||||
}
|
||||
|
@ -89,6 +89,14 @@ public interface CompareIfAbsent<Children> extends Compare<Children> {
|
||||
return likeLeft(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.LIKE_LEFT), alias, column, val);
|
||||
}
|
||||
|
||||
default Children notLikeLeftIfAbsent(KProperty<?> column, Object val) {
|
||||
return notLikeLeft(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_LEFT), null, column, val);
|
||||
}
|
||||
|
||||
default Children notLikeLeftIfAbsent(String alias, KProperty<?> column, Object val) {
|
||||
return notLikeLeft(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_LEFT), alias, column, val);
|
||||
}
|
||||
|
||||
default Children likeRightIfAbsent(KProperty<?> column, Object val) {
|
||||
return likeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.LIKE_RIGHT), null, column, val);
|
||||
}
|
||||
@ -96,4 +104,12 @@ public interface CompareIfAbsent<Children> extends Compare<Children> {
|
||||
default Children likeRightIfAbsent(String alias, KProperty<?> column, Object val) {
|
||||
return likeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.LIKE_RIGHT), alias, column, val);
|
||||
}
|
||||
|
||||
default Children notLikeRightIfAbsent(KProperty<?> column, Object val) {
|
||||
return notLikeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_RIGHT), null, column, val);
|
||||
}
|
||||
|
||||
default Children notLikeRightIfAbsent(String alias, KProperty<?> column, Object val) {
|
||||
return notLikeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_RIGHT), alias, column, val);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import java.util.stream.Collectors;
|
||||
* @author yulichang
|
||||
* @since 1.4.5
|
||||
*/
|
||||
public class DeleteJoinWrapper<T> extends MPJAbstractLambdaWrapper<T, DeleteJoinWrapper<T>> {
|
||||
public class DeleteJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, DeleteJoinWrapper<T>> {
|
||||
|
||||
/**
|
||||
* 删除表
|
||||
@ -100,6 +100,7 @@ public class DeleteJoinWrapper<T> extends MPJAbstractLambdaWrapper<T, DeleteJoin
|
||||
* 获取删除的表
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
public String getDeleteLogicSql() {
|
||||
if (StringUtils.isNotBlank(this.deleteSql.getStringValue())) {
|
||||
return this.deleteSql.getStringValue();
|
||||
@ -153,6 +154,7 @@ public class DeleteJoinWrapper<T> extends MPJAbstractLambdaWrapper<T, DeleteJoin
|
||||
/**
|
||||
* 删除表
|
||||
*/
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
public DeleteJoinWrapper<T> delete(Class<?>... deleteClass) {
|
||||
Class<T> entityClass = getEntityClass();
|
||||
Assert.notNull(entityClass, "缺少主表类型, 请使用 new MPJLambdaWrapper<>(主表.class) 或 JoinWrappers.lambda(主表.class) 构造方法");
|
||||
@ -164,6 +166,7 @@ public class DeleteJoinWrapper<T> extends MPJAbstractLambdaWrapper<T, DeleteJoin
|
||||
return typedThis;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"DuplicatedCode", "DataFlowIssue"})
|
||||
private void check(List<Class<?>> classList) {
|
||||
Class<T> entityClass = getEntityClass();
|
||||
TableInfo tableInfo = TableHelper.get(entityClass);
|
||||
@ -185,6 +188,7 @@ public class DeleteJoinWrapper<T> extends MPJAbstractLambdaWrapper<T, DeleteJoin
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
private void check() {
|
||||
if (CollectionUtils.isNotEmpty(tableList.getAll())) {
|
||||
Class<T> entityClass = getEntityClass();
|
||||
|
@ -38,8 +38,8 @@ import static java.util.stream.Collectors.joining;
|
||||
* @author yulichang
|
||||
*/
|
||||
@SuppressWarnings({"DuplicatedCode", "unused"})
|
||||
public abstract class MPJAbstractLambdaWrapper<T, Children extends MPJAbstractLambdaWrapper<T, Children>>
|
||||
extends MPJAbstractWrapper<T, Children> implements QueryJoin<Children, T> {
|
||||
public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstractLambdaWrapper<T, Children>>
|
||||
extends JoinAbstractWrapper<T, Children> implements QueryJoin<Children, T> {
|
||||
|
||||
/**
|
||||
* 主表别名
|
||||
@ -101,14 +101,14 @@ public abstract class MPJAbstractLambdaWrapper<T, Children extends MPJAbstractLa
|
||||
/**
|
||||
* 推荐使用 带 class 的构造方法
|
||||
*/
|
||||
public MPJAbstractLambdaWrapper() {
|
||||
public JoinAbstractLambdaWrapper() {
|
||||
initNeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 推荐使用此构造方法
|
||||
*/
|
||||
public MPJAbstractLambdaWrapper(Class<T> clazz) {
|
||||
public JoinAbstractLambdaWrapper(Class<T> clazz) {
|
||||
initNeed();
|
||||
setEntityClass(clazz);
|
||||
tableList.setRootClass(clazz);
|
||||
@ -119,7 +119,7 @@ public abstract class MPJAbstractLambdaWrapper<T, Children extends MPJAbstractLa
|
||||
*
|
||||
* @param entity 主表实体
|
||||
*/
|
||||
public MPJAbstractLambdaWrapper(T entity) {
|
||||
public JoinAbstractLambdaWrapper(T entity) {
|
||||
initNeed();
|
||||
setEntity(entity);
|
||||
if (entity != null) {
|
||||
@ -130,7 +130,7 @@ public abstract class MPJAbstractLambdaWrapper<T, Children extends MPJAbstractLa
|
||||
/**
|
||||
* 自定义主表别名
|
||||
*/
|
||||
public MPJAbstractLambdaWrapper(String alias) {
|
||||
public JoinAbstractLambdaWrapper(String alias) {
|
||||
this.alias = alias;
|
||||
initNeed();
|
||||
tableList.setAlias(alias);
|
||||
@ -142,7 +142,7 @@ public abstract class MPJAbstractLambdaWrapper<T, Children extends MPJAbstractLa
|
||||
* @param clazz 主表class类
|
||||
* @param alias 主表别名
|
||||
*/
|
||||
public MPJAbstractLambdaWrapper(Class<T> clazz, String alias) {
|
||||
public JoinAbstractLambdaWrapper(Class<T> clazz, String alias) {
|
||||
this.alias = alias;
|
||||
setEntityClass(clazz);
|
||||
initNeed();
|
||||
@ -156,7 +156,7 @@ public abstract class MPJAbstractLambdaWrapper<T, Children extends MPJAbstractLa
|
||||
* @param entity 主表实体类
|
||||
* @param alias 主表别名
|
||||
*/
|
||||
public MPJAbstractLambdaWrapper(T entity, String alias) {
|
||||
public JoinAbstractLambdaWrapper(T entity, String alias) {
|
||||
this.alias = alias;
|
||||
setEntity(entity);
|
||||
initNeed();
|
||||
@ -372,7 +372,7 @@ public abstract class MPJAbstractLambdaWrapper<T, Children extends MPJAbstractLa
|
||||
* 内部调用, 不建议使用
|
||||
*/
|
||||
@Override
|
||||
public <R> Children join(String keyWord, Class<R> clazz, String tableAlias, BiConsumer<MPJAbstractLambdaWrapper<T, ?>, Children> consumer) {
|
||||
public <R> Children join(String keyWord, Class<R> clazz, String tableAlias, BiConsumer<JoinAbstractLambdaWrapper<T, ?>, Children> consumer) {
|
||||
Integer oldIndex = this.getIndex();
|
||||
int newIndex = tableIndex;
|
||||
TableInfo info = TableHelper.get(clazz);
|
@ -41,7 +41,7 @@ import static java.util.stream.Collectors.joining;
|
||||
* @author yulichang
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "unused", "DuplicatedCode"})
|
||||
public abstract class MPJAbstractWrapper<T, Children extends MPJAbstractWrapper<T, Children>> extends Wrapper<T>
|
||||
public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrapper<T, Children>> extends Wrapper<T>
|
||||
implements CompareIfAbsent<Children>, Nested<Children, Children>, Join<Children>, Func<Children>, OnCompare<Children>,
|
||||
CompareStrIfAbsent<Children, String>, FuncStr<Children, String> {
|
||||
|
||||
@ -272,11 +272,21 @@ public abstract class MPJAbstractWrapper<T, Children extends MPJAbstractWrapper<
|
||||
return likeValue(condition, LIKE, alias, column, val, SqlLike.LEFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R> Children notLikeLeft(boolean condition, String alias, SFunction<R, ?> column, Object val) {
|
||||
return likeValue(condition, NOT_LIKE, alias, column, val, SqlLike.LEFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> Children likeRight(boolean condition, String alias, SFunction<X, ?> column, Object val) {
|
||||
return likeValue(condition, LIKE, alias, column, val, SqlLike.RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R> Children notLikeRight(boolean condition, String alias, SFunction<R, ?> column, Object val) {
|
||||
return likeValue(condition, NOT_LIKE, alias, column, val, SqlLike.RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> Children between(boolean condition, String alias, SFunction<X, ?> column, Object val1, Object val2) {
|
||||
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(index, alias, column), BETWEEN,
|
||||
@ -1002,11 +1012,21 @@ public abstract class MPJAbstractWrapper<T, Children extends MPJAbstractWrapper<
|
||||
return likeValue(condition, LIKE, column, val, SqlLike.LEFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Children notLikeLeft(boolean condition, String column, Object val) {
|
||||
return likeValue(condition, NOT_LIKE, column, val, SqlLike.LEFT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Children likeRight(boolean condition, String column, Object val) {
|
||||
return likeValue(condition, LIKE, column, val, SqlLike.RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Children notLikeRight(boolean condition, String column, Object val) {
|
||||
return likeValue(condition, NOT_LIKE, column, val, SqlLike.RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Children between(boolean condition, String column, Object val1, Object val2) {
|
||||
return maybeDo(condition, () -> appendSqlSegments(columnToSqlSegment(column), BETWEEN,
|
@ -31,7 +31,7 @@ import java.util.stream.Collectors;
|
||||
* @author yulichang
|
||||
*/
|
||||
@SuppressWarnings({"unused", "DuplicatedCode"})
|
||||
public class MPJLambdaWrapper<T> extends MPJAbstractLambdaWrapper<T, MPJLambdaWrapper<T>> implements
|
||||
public class MPJLambdaWrapper<T> extends JoinAbstractLambdaWrapper<T, MPJLambdaWrapper<T>> implements
|
||||
Query<MPJLambdaWrapper<T>>, QueryLabel<MPJLambdaWrapper<T>>, Chain<T>, SelectWrapper<T, MPJLambdaWrapper<T>> {
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,7 @@ import java.util.stream.Collectors;
|
||||
* @since 1.4.5
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class UpdateJoinWrapper<T> extends MPJAbstractLambdaWrapper<T, UpdateJoinWrapper<T>>
|
||||
public class UpdateJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, UpdateJoinWrapper<T>>
|
||||
implements Update<UpdateJoinWrapper<T>> {
|
||||
/**
|
||||
* SQL 更新字段内容,例如:name='1', age=2
|
||||
|
@ -305,6 +305,28 @@ public interface Compare<Children> extends Serializable {
|
||||
*/
|
||||
<R> Children likeLeft(boolean condition, String alias, SFunction<R, ?> column, Object val);
|
||||
|
||||
default <R> Children notLikeLeft(SFunction<R, ?> column, Object val) {
|
||||
return notLikeLeft(true, null, column, val);
|
||||
}
|
||||
|
||||
default <R> Children notLikeLeft(String alias, SFunction<R, ?> column, Object val) {
|
||||
return notLikeLeft(true, alias, column, val);
|
||||
}
|
||||
|
||||
default <R> Children notLikeLeft(boolean condition, SFunction<R, ?> column, Object val) {
|
||||
return notLikeLeft(condition, null, column, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* LIKE '%值'
|
||||
*
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param val 值
|
||||
* @return children
|
||||
*/
|
||||
<R> Children notLikeLeft(boolean condition, String alias, SFunction<R, ?> column, Object val);
|
||||
|
||||
default <R> Children likeRight(SFunction<R, ?> column, Object val) {
|
||||
return likeRight(true, null, column, val);
|
||||
}
|
||||
@ -326,4 +348,26 @@ public interface Compare<Children> extends Serializable {
|
||||
* @return children
|
||||
*/
|
||||
<R> Children likeRight(boolean condition, String alias, SFunction<R, ?> column, Object val);
|
||||
|
||||
default <R> Children notLikeRight(SFunction<R, ?> column, Object val) {
|
||||
return notLikeRight(true, null, column, val);
|
||||
}
|
||||
|
||||
default <R> Children notLikeRight(String alias, SFunction<R, ?> column, Object val) {
|
||||
return notLikeRight(true, alias, column, val);
|
||||
}
|
||||
|
||||
default <R> Children notLikeRight(boolean condition, SFunction<R, ?> column, Object val) {
|
||||
return notLikeRight(condition, null, column, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* LIKE '值%'
|
||||
*
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param val 值
|
||||
* @return children
|
||||
*/
|
||||
<R> Children notLikeRight(boolean condition, String alias, SFunction<R, ?> column, Object val);
|
||||
}
|
||||
|
@ -88,6 +88,14 @@ public interface CompareIfAbsent<Children> extends Compare<Children> {
|
||||
return likeLeft(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.LIKE_LEFT), alias, column, val);
|
||||
}
|
||||
|
||||
default <R> Children notLikeLeftIfAbsent(SFunction<R, ?> column, Object val) {
|
||||
return notLikeLeft(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_LEFT), null, column, val);
|
||||
}
|
||||
|
||||
default <R> Children notLikeLeftIfAbsent(String alias, SFunction<R, ?> column, Object val) {
|
||||
return notLikeLeft(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_LEFT), alias, column, val);
|
||||
}
|
||||
|
||||
default <R> Children likeRightIfAbsent(SFunction<R, ?> column, Object val) {
|
||||
return likeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.LIKE_RIGHT), null, column, val);
|
||||
}
|
||||
@ -95,4 +103,12 @@ public interface CompareIfAbsent<Children> extends Compare<Children> {
|
||||
default <R> Children likeRightIfAbsent(String alias, SFunction<R, ?> column, Object val) {
|
||||
return likeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.LIKE_RIGHT), alias, column, val);
|
||||
}
|
||||
|
||||
default <R> Children notLikeRightIfAbsent(SFunction<R, ?> column, Object val) {
|
||||
return notLikeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_RIGHT), null, column, val);
|
||||
}
|
||||
|
||||
default <R> Children notLikeRightIfAbsent(String alias, SFunction<R, ?> column, Object val) {
|
||||
return notLikeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_RIGHT), alias, column, val);
|
||||
}
|
||||
}
|
||||
|
@ -265,6 +265,23 @@ public interface CompareStr<Children, R> extends Serializable {
|
||||
*/
|
||||
Children likeLeft(boolean condition, R column, Object val);
|
||||
|
||||
/**
|
||||
* ignore
|
||||
*/
|
||||
default Children notLikeLeft(R column, Object val) {
|
||||
return notLikeLeft(true, column, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* LIKE '%值'
|
||||
*
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param val 值
|
||||
* @return children
|
||||
*/
|
||||
Children notLikeLeft(boolean condition, R column, Object val);
|
||||
|
||||
/**
|
||||
* ignore
|
||||
*/
|
||||
@ -281,4 +298,22 @@ public interface CompareStr<Children, R> extends Serializable {
|
||||
* @return children
|
||||
*/
|
||||
Children likeRight(boolean condition, R column, Object val);
|
||||
|
||||
|
||||
/**
|
||||
* ignore
|
||||
*/
|
||||
default Children notLikeRight(R column, Object val) {
|
||||
return notLikeRight(true, column, val);
|
||||
}
|
||||
|
||||
/**
|
||||
* LIKE '值%'
|
||||
*
|
||||
* @param condition 执行条件
|
||||
* @param column 字段
|
||||
* @param val 值
|
||||
* @return children
|
||||
*/
|
||||
Children notLikeRight(boolean condition, R column, Object val);
|
||||
}
|
||||
|
@ -54,4 +54,12 @@ public interface CompareStrIfAbsent<Children, R> extends CompareStr<Children, R>
|
||||
default Children likeRightIfAbsent(R column, Object val) {
|
||||
return likeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.LIKE_RIGHT), column, val);
|
||||
}
|
||||
|
||||
default Children notLikeLeftIfAbsent(R column, Object val) {
|
||||
return notLikeLeft(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_LEFT), column, val);
|
||||
}
|
||||
|
||||
default Children notLikeRightIfAbsent(R column, Object val) {
|
||||
return notLikeRight(getIfAbsent().test(val, IfAbsentSqlKeyWordEnum.NOT_LIKE_RIGHT), column, val);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.github.yulichang.interfaces.MPJBaseJoin;
|
||||
import com.github.yulichang.query.interfaces.StringJoin;
|
||||
import com.github.yulichang.toolkit.Constant;
|
||||
import com.github.yulichang.wrapper.MPJAbstractLambdaWrapper;
|
||||
import com.github.yulichang.wrapper.JoinAbstractLambdaWrapper;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
@ -45,7 +45,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
* @param clazz 关联实体类
|
||||
* @param function 条件`
|
||||
*/
|
||||
default <T> Children leftJoin(Class<T> clazz, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children leftJoin(Class<T> clazz, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(Constant.LEFT_JOIN, clazz, function);
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
* @param clazz 关联实体类
|
||||
* @param consumer 条件
|
||||
*/
|
||||
default <T> Children leftJoin(Class<T> clazz, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
default <T> Children leftJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
return join(Constant.LEFT_JOIN, clazz, consumer);
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
* @param clazz 关联实体类
|
||||
* @param function 条件
|
||||
*/
|
||||
default <T> Children leftJoin(Class<T> clazz, String alias, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children leftJoin(Class<T> clazz, String alias, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(Constant.LEFT_JOIN, clazz, alias, function);
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
* @param clazz 关联实体类
|
||||
* @param consumer 条件
|
||||
*/
|
||||
default <T> Children leftJoin(Class<T> clazz, String alias, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
default <T> Children leftJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
return join(Constant.LEFT_JOIN, clazz, alias, consumer);
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children rightJoin(Class<T> clazz, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children rightJoin(Class<T> clazz, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(Constant.RIGHT_JOIN, clazz, function);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T, X> Children rightJoin(Class<T> clazz, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
default <T, X> Children rightJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
return join(Constant.RIGHT_JOIN, clazz, consumer);
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children rightJoin(Class<T> clazz, String alias, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children rightJoin(Class<T> clazz, String alias, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(Constant.RIGHT_JOIN, clazz, alias, function);
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T, X> Children rightJoin(Class<T> clazz, String alias, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
default <T, X> Children rightJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
return join(Constant.RIGHT_JOIN, clazz, alias, consumer);
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children innerJoin(Class<T> clazz, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children innerJoin(Class<T> clazz, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(Constant.INNER_JOIN, clazz, function);
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children innerJoin(Class<T> clazz, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
default <T> Children innerJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
return join(Constant.INNER_JOIN, clazz, consumer);
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children innerJoin(Class<T> clazz, String alias, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children innerJoin(Class<T> clazz, String alias, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(Constant.INNER_JOIN, clazz, alias, function);
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children innerJoin(Class<T> clazz, String alias, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
default <T> Children innerJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
return join(Constant.INNER_JOIN, clazz, alias, consumer);
|
||||
}
|
||||
|
||||
@ -276,7 +276,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children fullJoin(Class<T> clazz, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children fullJoin(Class<T> clazz, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(Constant.FULL_JOIN, clazz, function);
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children fullJoin(Class<T> clazz, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
default <T> Children fullJoin(Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
return join(Constant.FULL_JOIN, clazz, consumer);
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children fullJoin(Class<T> clazz, String alias, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children fullJoin(Class<T> clazz, String alias, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(Constant.FULL_JOIN, clazz, alias, function);
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* ignore 参考 left join
|
||||
*/
|
||||
default <T> Children fullJoin(Class<T> clazz, String alias, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
default <T> Children fullJoin(Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
return join(Constant.FULL_JOIN, clazz, alias, consumer);
|
||||
}
|
||||
|
||||
@ -366,7 +366,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
* @param clazz 关联实体类
|
||||
* @param function 条件
|
||||
*/
|
||||
default <T> Children join(String keyWord, Class<T> clazz, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children join(String keyWord, Class<T> clazz, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(keyWord, clazz, (on, e) -> function.apply(on));
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
* @param clazz 关联实体类
|
||||
* @param function 条件
|
||||
*/
|
||||
default <T> Children join(String keyWord, Class<T> clazz, String alias, WrapperFunction<MPJAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
default <T> Children join(String keyWord, Class<T> clazz, String alias, WrapperFunction<JoinAbstractLambdaWrapper<Entity, ?>> function) {
|
||||
return join(keyWord, clazz, alias, (on, e) -> function.apply(on));
|
||||
}
|
||||
|
||||
@ -443,12 +443,12 @@ public interface QueryJoin<Children, Entity> extends MPJBaseJoin<Entity>, String
|
||||
/**
|
||||
* 内部使用, 不建议直接调用
|
||||
*/
|
||||
default <T> Children join(String keyWord, Class<T> clazz, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
default <T> Children join(String keyWord, Class<T> clazz, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer) {
|
||||
return join(keyWord, clazz, null, consumer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 内部使用, 不建议直接调用
|
||||
*/
|
||||
<T> Children join(String keyWord, Class<T> clazz, String alias, BiConsumer<MPJAbstractLambdaWrapper<Entity, ?>, Children> consumer);
|
||||
<T> Children join(String keyWord, Class<T> clazz, String alias, BiConsumer<JoinAbstractLambdaWrapper<Entity, ?>, Children> consumer);
|
||||
}
|
||||
|
@ -27,12 +27,18 @@ public class IfAbsentTest {
|
||||
assert IfAbsentEnum.NOT_EMPTY.test(" ");
|
||||
assert IfAbsentEnum.NOT_EMPTY.test("\r");
|
||||
assert IfAbsentEnum.NOT_EMPTY.test("a");
|
||||
assert IfAbsentEnum.NOT_EMPTY.test(1);
|
||||
assert IfAbsentEnum.NOT_EMPTY.test(true);
|
||||
assert IfAbsentEnum.NOT_EMPTY.test('A');
|
||||
|
||||
assert !IfAbsentEnum.NOT_BLANK.test("\t");
|
||||
assert !IfAbsentEnum.NOT_BLANK.test("");
|
||||
assert !IfAbsentEnum.NOT_BLANK.test(" ");
|
||||
assert !IfAbsentEnum.NOT_BLANK.test("\r");
|
||||
assert IfAbsentEnum.NOT_BLANK.test("a");
|
||||
assert IfAbsentEnum.NOT_EMPTY.test(1);
|
||||
assert IfAbsentEnum.NOT_EMPTY.test(true);
|
||||
assert IfAbsentEnum.NOT_EMPTY.test('A');
|
||||
|
||||
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 " +
|
||||
|
@ -0,0 +1,40 @@
|
||||
package com.github.yulichang.test.join.m;
|
||||
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
public class NotLikeLeftRightTest {
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
Reset.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
void notLikeLeftRight() {
|
||||
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.`name` NOT LIKE ?)");
|
||||
MPJLambdaWrapper<UserDO> wrapper = JoinWrappers.lambda(UserDO.class)
|
||||
.selectAll(UserDO.class)
|
||||
.notLikeLeft(UserDO::getName, "aa");
|
||||
List<UserDO> list = wrapper.list();
|
||||
list.forEach(System.out::println);
|
||||
|
||||
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.`name` NOT LIKE ?)");
|
||||
MPJLambdaWrapper<UserDO> wrapper1 = JoinWrappers.lambda(UserDO.class)
|
||||
.selectAll(UserDO.class)
|
||||
.notLikeRight(UserDO::getName, "aa");
|
||||
List<UserDO> list1 = wrapper1.list();
|
||||
list1.forEach(System.out::println);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user