mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
调整名称
This commit is contained in:
parent
9e65e33301
commit
14ea2c45b0
@ -2,7 +2,6 @@ package com.github.yulichang.adapter.jsqlparser.v46;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
|
||||
import net.sf.jsqlparser.schema.Column;
|
||||
import net.sf.jsqlparser.statement.Statement;
|
||||
@ -41,7 +40,7 @@ public class JSqlParserHelperV46 {
|
||||
} else {
|
||||
col = selectExpressionItem.getAlias().getName();
|
||||
}
|
||||
if (StringUtils.isNotBlank(col)) {
|
||||
if (isNotBlank(col)) {
|
||||
columConsumer.accept(col);
|
||||
}
|
||||
}
|
||||
@ -56,4 +55,9 @@ public class JSqlParserHelperV46 {
|
||||
throw new RuntimeException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isNotBlank(String str) {
|
||||
return str != null && !str.trim().isEmpty();
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.github.yulichang.adapter.jsqlparser;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
|
||||
import net.sf.jsqlparser.schema.Column;
|
||||
import net.sf.jsqlparser.statement.Statement;
|
||||
@ -38,7 +37,7 @@ public class JSqlParserHelper {
|
||||
} else {
|
||||
col = item.getAlias().getName();
|
||||
}
|
||||
if (StringUtils.isNotBlank(col)) {
|
||||
if (isNotBlank(col)) {
|
||||
columConsumer.accept(col);
|
||||
}
|
||||
}
|
||||
@ -51,4 +50,8 @@ public class JSqlParserHelper {
|
||||
throw new RuntimeException(throwable);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNotBlank(String str) {
|
||||
return str != null && !str.trim().isEmpty();
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,10 @@ public interface IAdapter {
|
||||
return tableFieldInfo.isPrimitive();
|
||||
}
|
||||
|
||||
default boolean isWithUpdateFill(TableFieldInfo tableFieldInfo) {
|
||||
return tableFieldInfo.isWithUpdateFill();
|
||||
}
|
||||
|
||||
default String mpjMapping(TableFieldInfo tableFieldInfo) {
|
||||
return tableFieldInfo.getMapping();
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.github.yulichang.adapter.base.tookit;
|
||||
|
||||
public class CharSequenceUtils {
|
||||
|
||||
public static boolean isBlank(String str) {
|
||||
return str == null || str.trim().isEmpty();
|
||||
}
|
||||
|
||||
public static boolean isNotBlank(String str) {
|
||||
return !isBlank(str);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--suppress ALL -->
|
||||
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-adapter</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<artifactId>mybatis-plus-join-adapter-v320</artifactId>
|
||||
<version>${revision}</version>
|
||||
<name>mybatis-plus-join-adapter-v320</name>
|
||||
|
||||
<description>An enhanced toolkit of Mybatis-Plus to simplify development.</description>
|
||||
<url>https://github.com/yulichang/mybatis-plus-join</url>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache License, Version 2.0</name>
|
||||
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>mybatis-plus-join</id>
|
||||
<name>yulichang</name>
|
||||
<email>yu_lichang@qq.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/yulichang/mybatis-plus-join.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/yulichang/mybatis-plus-join.git</developerConnection>
|
||||
<url>https://github.com/yulichang/mybatis-plus-join</url>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-adapter-base</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,98 @@
|
||||
package com.github.yulichang.adapter.v320;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.github.yulichang.adapter.base.IAdapter;
|
||||
import com.github.yulichang.adapter.base.metadata.OrderFieldInfo;
|
||||
import com.github.yulichang.adapter.base.tookit.CharSequenceUtils;
|
||||
import com.github.yulichang.adapter.jsqlparser.v46.JSqlParserHelperV46;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.type.TypeHandler;
|
||||
import org.apache.ibatis.type.TypeHandlerRegistry;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* @author yulichang
|
||||
* @since 1.4.3
|
||||
*/
|
||||
public class Adapter320 implements IAdapter {
|
||||
|
||||
@Override
|
||||
public boolean mpjHasLogic(TableInfo tableInfo) {
|
||||
return tableInfo.isLogicDelete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mpjIsPrimitive(TableFieldInfo tableFieldInfo) {
|
||||
return tableFieldInfo.getPropertyType().isPrimitive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWithUpdateFill(TableFieldInfo tableFieldInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String mpjMapping(TableFieldInfo tableFieldInfo) {
|
||||
String el = tableFieldInfo.getEl();
|
||||
if (el != null && el.contains(StringPool.COMMA)) {
|
||||
return el.substring(el.indexOf(StringPool.COMMA) + 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableFieldInfo mpjGetLogicField(TableInfo tableInfo) {
|
||||
return tableInfo.getFieldList().stream().filter(f -> Objects.nonNull(f.getLogicDeleteValue())
|
||||
|| Objects.nonNull(f.getLogicNotDeleteValue())).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mpjHasPK(TableInfo tableInfo) {
|
||||
return CharSequenceUtils.isNotBlank(tableInfo.getKeyProperty()) ||
|
||||
CharSequenceUtils.isNotBlank(tableInfo.getKeyColumn());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration mpjGetConfiguration(TableInfo tableInfo) {
|
||||
return tableInfo.getConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Field mpjGetField(TableFieldInfo fieldInfo, Supplier<Field> supplier) {
|
||||
return supplier.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderFieldInfo> mpjGetOrderField(TableInfo tableInfo) {
|
||||
throw new UnsupportedOperationException("不支持排序");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parserColum(String alias, String from, String selectSql, Consumer<String> columConsumer) {
|
||||
JSqlParserHelperV46.parserColum(alias, from, selectSql, columConsumer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeHandler<?> getTypeHandler(Configuration configuration, Class<?> propertyType, Class<? extends TypeHandler<?>> typeHandlerClass, Field field) {
|
||||
TypeHandlerRegistry registry = configuration.getTypeHandlerRegistry();
|
||||
TypeHandler<?> typeHandler = registry.getMappingTypeHandler(typeHandlerClass);
|
||||
if (typeHandler == null) {
|
||||
typeHandler = registry.getInstance(propertyType, typeHandlerClass);
|
||||
}
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wrapperInnerPage(Interceptor interceptor, Predicate<Object> predicate, Function<Object, Object> function) {
|
||||
}
|
||||
}
|
@ -3,9 +3,9 @@ package com.github.yulichang.adapter.v33x;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.adapter.base.IAdapter;
|
||||
import com.github.yulichang.adapter.base.metadata.OrderFieldInfo;
|
||||
import com.github.yulichang.adapter.base.tookit.CharSequenceUtils;
|
||||
import com.github.yulichang.adapter.base.tookit.VersionUtils;
|
||||
import com.github.yulichang.adapter.jsqlparser.v46.JSqlParserHelperV46;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
@ -42,7 +42,7 @@ public class Adapter33x implements IAdapter {
|
||||
@Override
|
||||
public String mpjMapping(TableFieldInfo tableFieldInfo) {
|
||||
String el = tableFieldInfo.getEl();
|
||||
if (StringUtils.isNotBlank(el) && el.contains(StringPool.COMMA)) {
|
||||
if (el != null && el.contains(StringPool.COMMA)) {
|
||||
return el.substring(el.indexOf(StringPool.COMMA) + 1);
|
||||
}
|
||||
return null;
|
||||
@ -56,8 +56,8 @@ public class Adapter33x implements IAdapter {
|
||||
|
||||
@Override
|
||||
public boolean mpjHasPK(TableInfo tableInfo) {
|
||||
return StringUtils.isNotBlank(tableInfo.getKeyProperty()) ||
|
||||
StringUtils.isNotBlank(tableInfo.getKeyColumn());
|
||||
return CharSequenceUtils.isNotBlank(tableInfo.getKeyProperty()) ||
|
||||
CharSequenceUtils.isNotBlank(tableInfo.getKeyColumn());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,7 +3,6 @@ package com.github.yulichang.adapter.v3431;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.adapter.base.IAdapter;
|
||||
import com.github.yulichang.adapter.base.metadata.OrderFieldInfo;
|
||||
import com.github.yulichang.adapter.base.tookit.VersionUtils;
|
||||
@ -34,7 +33,7 @@ public class Adapter3431 implements IAdapter {
|
||||
public String mpjMapping(TableFieldInfo tableFieldInfo) {
|
||||
if (v) {
|
||||
String el = tableFieldInfo.getEl();
|
||||
if (StringUtils.isNotBlank(el) && el.contains(StringPool.COMMA)) {
|
||||
if (el != null && el.contains(StringPool.COMMA)) {
|
||||
return el.substring(el.indexOf(StringPool.COMMA) + 1);
|
||||
}
|
||||
return null;
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
<modules>
|
||||
<module>mybatis-plus-join-adapter-base</module>
|
||||
<module>mybatis-plus-join-adapter-v320</module>
|
||||
<module>mybatis-plus-join-adapter-v33x</module>
|
||||
<module>mybatis-plus-join-adapter-v3431</module>
|
||||
<module>mybatis-plus-join-adapter-v352</module>
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.github.yulichang.autoconfigure;
|
||||
|
||||
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusLanguageDriverAutoConfiguration;
|
||||
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
|
||||
import com.github.yulichang.autoconfigure.conditional.JoinSqlInjectorCondition;
|
||||
import com.github.yulichang.autoconfigure.consumer.MybatisPlusJoinIfExistsConsumer;
|
||||
@ -54,7 +53,7 @@ import java.util.Optional;
|
||||
@ConditionalOnClass({SqlSessionFactory.class, SqlSessionFactoryBean.class})
|
||||
@ConditionalOnSingleCandidate(DataSource.class)
|
||||
@EnableConfigurationProperties(MybatisPlusJoinProperties.class)
|
||||
@AutoConfigureAfter({DataSourceAutoConfiguration.class, MybatisPlusLanguageDriverAutoConfiguration.class})
|
||||
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
|
||||
public class MybatisPlusJoinAutoConfiguration {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(MybatisPlusJoinAutoConfiguration.class);
|
||||
|
@ -39,6 +39,11 @@
|
||||
<artifactId>mybatis-plus-join-annotation</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-adapter-v320</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-adapter-v33x</artifactId>
|
||||
|
@ -3,6 +3,7 @@ package com.github.yulichang.adapter;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
|
||||
import com.github.yulichang.adapter.base.IAdapter;
|
||||
import com.github.yulichang.adapter.base.tookit.VersionUtils;
|
||||
import com.github.yulichang.adapter.v320.Adapter320;
|
||||
import com.github.yulichang.adapter.v33x.Adapter33x;
|
||||
import com.github.yulichang.adapter.v3431.Adapter3431;
|
||||
import com.github.yulichang.adapter.v355.Adapter355;
|
||||
@ -21,7 +22,7 @@ public class AdapterHelper {
|
||||
|
||||
|
||||
static {
|
||||
String lastAdapter = "3.5.8";
|
||||
String lastAdapter = "3.5.9";
|
||||
String version = Optional.ofNullable(VersionUtils.getVersion()).orElse(lastAdapter);
|
||||
|
||||
if (VersionUtils.compare(version, "3.5.6") >= 0) {
|
||||
@ -32,8 +33,10 @@ public class AdapterHelper {
|
||||
adapter = new Adapter3431();
|
||||
} else if (VersionUtils.compare(version, "3.3.0") >= 0) {
|
||||
adapter = new Adapter33x();
|
||||
} else if (VersionUtils.compare(version, "3.2.0") >= 0) {
|
||||
adapter = new Adapter320();
|
||||
} else {
|
||||
throw ExceptionUtils.mpe("MPJ需要MP版本3.3.0+,当前MP版本%s", version);
|
||||
throw ExceptionUtils.mpe("MPJ需要MP版本3.2.0+,当前MP版本%s", version);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.github.yulichang.config.enums;
|
||||
|
||||
import com.github.yulichang.toolkit.MPJStringUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.wrapper.interfaces.MPredicate;
|
||||
|
||||
import java.io.Serializable;
|
||||
@ -21,11 +21,11 @@ public enum IfExistsEnum implements MPredicate<Object>, Serializable {
|
||||
/**
|
||||
* 非空字符串 例: "" -> false, " " -> true ...
|
||||
*/
|
||||
NOT_EMPTY(val -> NOT_NULL.and(v -> !(v instanceof CharSequence) || MPJStringUtils.isNotEmpty((CharSequence) v)).test(val)),
|
||||
NOT_EMPTY(val -> NOT_NULL.and(v -> !(v instanceof CharSequence) || StrUtils.isNotEmpty((CharSequence) v)).test(val)),
|
||||
/**
|
||||
* NOT_BLANK 非空白字符串 例: "" -> false, " " -> false, "\r" -> false, "abc" -> true ...
|
||||
*/
|
||||
NOT_BLANK(val -> NOT_NULL.and(v -> !(v instanceof CharSequence) || MPJStringUtils.isNotBlank((CharSequence) v)).test(val));
|
||||
NOT_BLANK(val -> NOT_NULL.and(v -> !(v instanceof CharSequence) || StrUtils.isNotBlank((CharSequence) v)).test(val));
|
||||
|
||||
private final MPredicate<Object> predicate;
|
||||
|
||||
|
@ -6,18 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
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.config.enums.LogicDelTypeEnum;
|
||||
import com.github.yulichang.extension.apt.interfaces.QueryJoin;
|
||||
import com.github.yulichang.toolkit.Constant;
|
||||
import com.github.yulichang.toolkit.LogicInfoUtils;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import com.github.yulichang.toolkit.TableMap;
|
||||
import com.github.yulichang.extension.apt.matedata.BaseColumn;
|
||||
import com.github.yulichang.extension.apt.matedata.Column;
|
||||
import com.github.yulichang.toolkit.*;
|
||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||
import com.github.yulichang.wrapper.interfaces.MFunction;
|
||||
import com.github.yulichang.wrapper.segments.PageInfo;
|
||||
@ -124,7 +120,7 @@ public abstract class AptAbstractWrapper<T, Children extends AptAbstractWrapper<
|
||||
* 构造方法
|
||||
*/
|
||||
protected AptAbstractWrapper(BaseColumn<T> baseColumn) {
|
||||
this.alias = StringUtils.isNotBlank(baseColumn.getAlias()) ? baseColumn.getAlias() : this.alias;
|
||||
this.alias = StrUtils.isNotBlank(baseColumn.getAlias()) ? baseColumn.getAlias() : this.alias;
|
||||
setEntityClass(baseColumn.getColumnClass());
|
||||
this.baseColumn = baseColumn;
|
||||
initNeed();
|
||||
@ -136,7 +132,7 @@ public abstract class AptAbstractWrapper<T, Children extends AptAbstractWrapper<
|
||||
* @param entity 主表实体类
|
||||
*/
|
||||
protected AptAbstractWrapper(BaseColumn<T> baseColumn, T entity) {
|
||||
this.alias = StringUtils.isNotBlank(baseColumn.getAlias()) ? baseColumn.getAlias() : this.alias;
|
||||
this.alias = StrUtils.isNotBlank(baseColumn.getAlias()) ? baseColumn.getAlias() : this.alias;
|
||||
setEntity(entity);
|
||||
this.baseColumn = baseColumn;
|
||||
initNeed();
|
||||
@ -310,10 +306,10 @@ public abstract class AptAbstractWrapper<T, Children extends AptAbstractWrapper<
|
||||
* 获取连表部分语句
|
||||
*/
|
||||
public String getFrom() {
|
||||
if (StringUtils.isBlank(from.getStringValue())) {
|
||||
if (StrUtils.isBlank(from.getStringValue())) {
|
||||
StringBuilder value = new StringBuilder();
|
||||
for (Children wrapper : onWrappers) {
|
||||
if (StringUtils.isBlank(wrapper.from.getStringValue())) {
|
||||
if (StrUtils.isBlank(wrapper.from.getStringValue())) {
|
||||
if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) {
|
||||
TableInfo tableInfo = TableHelper.getAssert(wrapper.getJoinClass());
|
||||
if (AdapterHelper.getAdapter().mpjHasLogic(tableInfo)) {
|
||||
@ -371,7 +367,7 @@ public abstract class AptAbstractWrapper<T, Children extends AptAbstractWrapper<
|
||||
Children instance = instance(newIndex, keyWord, baseColumn.getColumnClass(), info.getTableName());
|
||||
instance.isMain = false;
|
||||
onWrappers.add(instance);
|
||||
if (StringUtils.isBlank(baseColumn.getAlias())) {
|
||||
if (StrUtils.isBlank(baseColumn.getAlias())) {
|
||||
aptIndex.put(baseColumn, subTableAlias + newIndex);
|
||||
instance.alias = subTableAlias;
|
||||
instance.hasAlias = false;
|
||||
@ -410,7 +406,7 @@ public abstract class AptAbstractWrapper<T, Children extends AptAbstractWrapper<
|
||||
*/
|
||||
public boolean isUseAnnotationOrderBy() {
|
||||
final String _sqlSegment = this.getSqlSegment();
|
||||
if (StringUtils.isBlank(_sqlSegment)) {
|
||||
if (StrUtils.isBlank(_sqlSegment)) {
|
||||
return true;
|
||||
}
|
||||
final String _sqlSegmentToUpperCase = _sqlSegment.toUpperCase();
|
||||
|
@ -14,6 +14,7 @@ import com.github.yulichang.extension.apt.toolkit.AptWrapperUtils;
|
||||
import com.github.yulichang.extension.apt.toolkit.AptWrappers;
|
||||
import com.github.yulichang.toolkit.Constant;
|
||||
import com.github.yulichang.toolkit.LambdaUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.TableMap;
|
||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
||||
@ -291,7 +292,7 @@ public class AptQueryWrapper<T> extends AptAbstractWrapper<T, AptQueryWrapper<T>
|
||||
*/
|
||||
@Override
|
||||
public String getSqlSelect() {
|
||||
if (StringUtils.isBlank(sqlSelect.getStringValue()) && CollectionUtils.isNotEmpty(selectColumns)) {
|
||||
if (StrUtils.isBlank(sqlSelect.getStringValue()) && CollectionUtils.isNotEmpty(selectColumns)) {
|
||||
String s = selectColumns.stream().map(i -> {
|
||||
if (i.isStr()) {
|
||||
return i.getColumn();
|
||||
|
@ -19,6 +19,7 @@ import com.github.yulichang.extension.apt.interfaces.OnCompare;
|
||||
import com.github.yulichang.extension.apt.matedata.Column;
|
||||
import com.github.yulichang.toolkit.LambdaUtils;
|
||||
import com.github.yulichang.toolkit.MPJSqlInjectionUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.Ref;
|
||||
import com.github.yulichang.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
||||
@ -170,7 +171,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
|
||||
/**
|
||||
* 设置 IfExists
|
||||
* .IfExists(val -> val != null && StringUtils.isNotBlank(val))
|
||||
* .IfExists(val -> val != null && StrUtils.isNotBlank(val))
|
||||
*
|
||||
* @param IfExists 判断
|
||||
* @return Children
|
||||
@ -579,7 +580,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
*/
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
protected final String formatSqlMaybeWithParam(String sqlStr, String mapping, Object... params) {
|
||||
if (StringUtils.isBlank(sqlStr)) {
|
||||
if (StrUtils.isBlank(sqlStr)) {
|
||||
// todo 何时会这样?
|
||||
return null;
|
||||
}
|
||||
@ -678,7 +679,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
|
||||
@Override
|
||||
public String getSqlComment() {
|
||||
if (StringUtils.isNotBlank(sqlComment.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(sqlComment.getStringValue())) {
|
||||
return "/*" + StringEscape.escapeRawString(sqlComment.getStringValue()) + "*/";
|
||||
}
|
||||
return null;
|
||||
@ -686,7 +687,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
|
||||
@Override
|
||||
public String getSqlFirst() {
|
||||
if (StringUtils.isNotBlank(sqlFirst.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(sqlFirst.getStringValue())) {
|
||||
return StringEscape.escapeRawString(sqlFirst.getStringValue());
|
||||
}
|
||||
return null;
|
||||
@ -863,7 +864,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
public <V> Children allEqStr(boolean condition, Map<String, V> params, boolean null2IsNull) {
|
||||
if (condition && CollectionUtils.isNotEmpty(params)) {
|
||||
params.forEach((k, v) -> {
|
||||
if (StringUtils.checkValNotNull(v)) {
|
||||
if (StrUtils.checkValNotNull(v)) {
|
||||
eq(k, v);
|
||||
} else {
|
||||
if (null2IsNull) {
|
||||
@ -880,7 +881,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
if (condition && CollectionUtils.isNotEmpty(params)) {
|
||||
params.forEach((k, v) -> {
|
||||
if (filter.test(k, v)) {
|
||||
if (StringUtils.checkValNotNull(v)) {
|
||||
if (StrUtils.checkValNotNull(v)) {
|
||||
eq(k, v);
|
||||
} else {
|
||||
if (null2IsNull) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.github.yulichang.extension.apt.resultmap;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
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.toolkit.LambdaUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||
import com.github.yulichang.wrapper.resultmap.IResult;
|
||||
import com.github.yulichang.wrapper.segments.SelectCache;
|
||||
@ -93,7 +93,7 @@ public class Result implements IResult {
|
||||
SelectCache normal = normalMap.get(column.getProperty());
|
||||
result.selectNormal = normal;
|
||||
result.column = column;
|
||||
if (StringUtils.isBlank(result.property)) {
|
||||
if (StrUtils.isBlank(result.property)) {
|
||||
result.property = normal.getColumProperty();
|
||||
}
|
||||
if (Objects.isNull(result.javaType)) {
|
||||
|
@ -4,12 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.extension.apt.AptQueryWrapper;
|
||||
import com.github.yulichang.toolkit.LogicInfoUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import com.github.yulichang.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.extension.apt.AptQueryWrapper;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@ -26,18 +26,18 @@ public class AptWrapperUtils {
|
||||
String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
|
||||
boolean hasWhere = false;
|
||||
String entityWhere = getEntitySql(tableInfo, wrapper);
|
||||
if (StringUtils.isNotBlank(entityWhere)) {
|
||||
if (StrUtils.isNotBlank(entityWhere)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String mainLogic = mainLogic(hasWhere, clazz, wrapper);
|
||||
if (StringUtils.isNotBlank(mainLogic)) {
|
||||
if (StrUtils.isNotBlank(mainLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String subLogic = subLogic(hasWhere, wrapper);
|
||||
if (StringUtils.isNotBlank(subLogic)) {
|
||||
if (StrUtils.isNotBlank(subLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StringUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StrUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
|
||||
|
||||
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
|
||||
@ -59,18 +59,18 @@ public class AptWrapperUtils {
|
||||
String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
|
||||
boolean hasWhere = false;
|
||||
String entityWhere = getEntitySql(tableInfo, wrapper);
|
||||
if (StringUtils.isNotBlank(entityWhere)) {
|
||||
if (StrUtils.isNotBlank(entityWhere)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String mainLogic = mainLogic(hasWhere, clazz, wrapper);
|
||||
if (StringUtils.isNotBlank(mainLogic)) {
|
||||
if (StrUtils.isNotBlank(mainLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String subLogic = subLogic(hasWhere, wrapper);
|
||||
if (StringUtils.isNotBlank(subLogic)) {
|
||||
if (StrUtils.isNotBlank(subLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StringUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StrUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
|
||||
|
||||
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
|
||||
@ -129,7 +129,7 @@ public class AptWrapperUtils {
|
||||
return StringPool.EMPTY;
|
||||
}
|
||||
String info = LogicInfoUtils.getLogicInfo(null, clazz, true, wrapper.getAlias());
|
||||
if (StringUtils.isNotBlank(info)) {
|
||||
if (StrUtils.isNotBlank(info)) {
|
||||
if (hasWhere) {
|
||||
return " AND " + info;
|
||||
}
|
||||
@ -140,7 +140,7 @@ public class AptWrapperUtils {
|
||||
|
||||
private static String subLogic(boolean hasWhere, AptQueryWrapper<?> wrapper) {
|
||||
String sql = wrapper.getSubLogicSql();
|
||||
if (StringUtils.isNotBlank(sql)) {
|
||||
if (StrUtils.isNotBlank(sql)) {
|
||||
if (hasWhere) {
|
||||
return sql;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.config.ConfigProperties;
|
||||
import com.github.yulichang.config.enums.LogicDelTypeEnum;
|
||||
@ -363,10 +362,10 @@ public abstract class KtAbstractLambdaWrapper<T, Children extends KtAbstractLamb
|
||||
* 获取连表部分语句
|
||||
*/
|
||||
public String getFrom() {
|
||||
if (StringUtils.isBlank(from.getStringValue())) {
|
||||
if (StrUtils.isBlank(from.getStringValue())) {
|
||||
StringBuilder value = new StringBuilder();
|
||||
for (Children wrapper : onWrappers) {
|
||||
if (StringUtils.isBlank(wrapper.from.getStringValue())) {
|
||||
if (StrUtils.isBlank(wrapper.from.getStringValue())) {
|
||||
if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) {
|
||||
TableInfo tableInfo = TableHelper.getAssert(wrapper.getJoinClass());
|
||||
if (AdapterHelper.getAdapter().mpjHasLogic(tableInfo)) {
|
||||
@ -408,7 +407,7 @@ public abstract class KtAbstractLambdaWrapper<T, Children extends KtAbstractLamb
|
||||
instance.isNo = true;
|
||||
instance.isMain = false;
|
||||
onWrappers.add(instance);
|
||||
if (StringUtils.isBlank(tableAlias)) {
|
||||
if (StrUtils.isBlank(tableAlias)) {
|
||||
tableList.put(oldIndex, clazz, false, subTableAlias, newIndex);
|
||||
instance.alias = subTableAlias;
|
||||
instance.hasAlias = false;
|
||||
@ -453,7 +452,7 @@ public abstract class KtAbstractLambdaWrapper<T, Children extends KtAbstractLamb
|
||||
*/
|
||||
public boolean isUseAnnotationOrderBy() {
|
||||
final String _sqlSegment = this.getSqlSegment();
|
||||
if (StringUtils.isBlank(_sqlSegment)) {
|
||||
if (StrUtils.isBlank(_sqlSegment)) {
|
||||
return true;
|
||||
}
|
||||
final String _sqlSegmentToUpperCase = _sqlSegment.toUpperCase();
|
||||
|
@ -16,10 +16,7 @@ import com.github.yulichang.extension.kt.interfaces.CompareIfExists;
|
||||
import com.github.yulichang.extension.kt.interfaces.Func;
|
||||
import com.github.yulichang.extension.kt.interfaces.OnCompare;
|
||||
import com.github.yulichang.extension.kt.segments.FuncArgs;
|
||||
import com.github.yulichang.toolkit.KtUtils;
|
||||
import com.github.yulichang.toolkit.MPJSqlInjectionUtils;
|
||||
import com.github.yulichang.toolkit.Ref;
|
||||
import com.github.yulichang.toolkit.TableList;
|
||||
import com.github.yulichang.toolkit.*;
|
||||
import com.github.yulichang.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
||||
import com.github.yulichang.wrapper.enums.PrefixEnum;
|
||||
@ -195,7 +192,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
|
||||
public Children allEq(boolean condition, Map<KProperty<?>, ?> params, boolean null2IsNull) {
|
||||
if (condition && CollectionUtils.isNotEmpty(params)) {
|
||||
params.forEach((k, v) -> {
|
||||
if (StringUtils.checkValNotNull(v)) {
|
||||
if (StrUtils.checkValNotNull(v)) {
|
||||
eq(k, v);
|
||||
} else {
|
||||
if (null2IsNull) {
|
||||
@ -601,7 +598,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
|
||||
*/
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
protected final String formatSqlMaybeWithParam(String sqlStr, String mapping, Object... params) {
|
||||
if (StringUtils.isBlank(sqlStr)) {
|
||||
if (StrUtils.isBlank(sqlStr)) {
|
||||
// todo 何时会这样?
|
||||
return null;
|
||||
}
|
||||
@ -703,7 +700,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
|
||||
|
||||
@Override
|
||||
public String getSqlComment() {
|
||||
if (StringUtils.isNotBlank(sqlComment.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(sqlComment.getStringValue())) {
|
||||
return "/*" + StringEscape.escapeRawString(sqlComment.getStringValue()) + "*/";
|
||||
}
|
||||
return null;
|
||||
@ -711,7 +708,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
|
||||
|
||||
@Override
|
||||
public String getSqlFirst() {
|
||||
if (StringUtils.isNotBlank(sqlFirst.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(sqlFirst.getStringValue())) {
|
||||
return StringEscape.escapeRawString(sqlFirst.getStringValue());
|
||||
}
|
||||
return null;
|
||||
@ -839,7 +836,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
|
||||
public <V> Children allEqStr(boolean condition, Map<String, V> params, boolean null2IsNull) {
|
||||
if (condition && CollectionUtils.isNotEmpty(params)) {
|
||||
params.forEach((k, v) -> {
|
||||
if (StringUtils.checkValNotNull(v)) {
|
||||
if (StrUtils.checkValNotNull(v)) {
|
||||
eq(k, v);
|
||||
} else {
|
||||
if (null2IsNull) {
|
||||
@ -856,7 +853,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
|
||||
if (condition && CollectionUtils.isNotEmpty(params)) {
|
||||
params.forEach((k, v) -> {
|
||||
if (filter.test(k, v)) {
|
||||
if (StringUtils.checkValNotNull(v)) {
|
||||
if (StrUtils.checkValNotNull(v)) {
|
||||
eq(k, v);
|
||||
} else {
|
||||
if (null2IsNull) {
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.*;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.toolkit.LogicInfoUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import com.github.yulichang.toolkit.TableList;
|
||||
import com.github.yulichang.wrapper.interfaces.DeleteChain;
|
||||
@ -71,7 +72,7 @@ public class KtDeleteJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtDeleteJ
|
||||
*/
|
||||
@Override
|
||||
public String getDeleteSql() {
|
||||
if (StringUtils.isNotBlank(this.deleteSql.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(this.deleteSql.getStringValue())) {
|
||||
return this.deleteSql.getStringValue();
|
||||
}
|
||||
String delete = null;
|
||||
@ -89,7 +90,7 @@ public class KtDeleteJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtDeleteJ
|
||||
if (CollectionUtils.isNotEmpty(deleteTableName)) {
|
||||
delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName);
|
||||
}
|
||||
if (StringUtils.isBlank(delete)) {
|
||||
if (StrUtils.isBlank(delete)) {
|
||||
delete = this.alias;
|
||||
}
|
||||
deleteSql.setStringValue(delete);
|
||||
@ -101,7 +102,7 @@ public class KtDeleteJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtDeleteJ
|
||||
*/
|
||||
@Override
|
||||
public String getDeleteLogicSql() {
|
||||
if (StringUtils.isNotBlank(this.deleteSql.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(this.deleteSql.getStringValue())) {
|
||||
return this.deleteSql.getStringValue();
|
||||
}
|
||||
String delete = null;
|
||||
@ -119,7 +120,7 @@ public class KtDeleteJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtDeleteJ
|
||||
if (CollectionUtils.isNotEmpty(deleteTableName)) {
|
||||
delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(delete)) {
|
||||
if (StrUtils.isNotBlank(delete)) {
|
||||
delete = StringPool.COMMA + delete;
|
||||
} else {
|
||||
delete = StringPool.EMPTY;
|
||||
|
@ -12,6 +12,7 @@ import com.github.yulichang.extension.kt.toolkit.KtWrapperUtils;
|
||||
import com.github.yulichang.extension.kt.toolkit.KtWrappers;
|
||||
import com.github.yulichang.toolkit.Constant;
|
||||
import com.github.yulichang.toolkit.KtUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.TableList;
|
||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||
import com.github.yulichang.wrapper.interfaces.Chain;
|
||||
@ -363,7 +364,7 @@ public class KtLambdaWrapper<T> extends KtAbstractLambdaWrapper<T, KtLambdaWrapp
|
||||
*/
|
||||
@Override
|
||||
public String getSqlSelect() {
|
||||
if (StringUtils.isBlank(sqlSelect.getStringValue()) && CollectionUtils.isNotEmpty(selectColumns)) {
|
||||
if (StrUtils.isBlank(sqlSelect.getStringValue()) && CollectionUtils.isNotEmpty(selectColumns)) {
|
||||
String s = selectColumns.stream().map(i -> {
|
||||
if (i.isStr()) {
|
||||
return i.getColumn();
|
||||
|
@ -7,11 +7,8 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.*;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.extension.kt.interfaces.Update;
|
||||
import com.github.yulichang.toolkit.Constant;
|
||||
import com.github.yulichang.toolkit.KtUtils;
|
||||
import com.github.yulichang.toolkit.*;
|
||||
import com.github.yulichang.toolkit.ReflectionKit;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import com.github.yulichang.toolkit.TableList;
|
||||
import com.github.yulichang.wrapper.interfaces.UpdateChain;
|
||||
import kotlin.reflect.KProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -142,7 +139,7 @@ public class KtUpdateJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtUpdateJ
|
||||
|
||||
@Override
|
||||
public KtUpdateJoinWrapper<T> setSql(boolean condition, String sql) {
|
||||
if (condition && StringUtils.isNotBlank(sql)) {
|
||||
if (condition && StrUtils.isNotBlank(sql)) {
|
||||
if (Objects.isNull(sqlSet)) {
|
||||
sqlSet = new ArrayList<>();
|
||||
}
|
||||
@ -153,7 +150,7 @@ public class KtUpdateJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtUpdateJ
|
||||
|
||||
@Override
|
||||
public String getSqlSet() {
|
||||
if (StringUtils.isNotBlank(sqlSetStr.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(sqlSetStr.getStringValue())) {
|
||||
return sqlSetStr.getStringValue();
|
||||
}
|
||||
StringBuilder set = new StringBuilder(StringPool.EMPTY);
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.github.yulichang.extension.kt.interfaces;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.extension.kt.resultmap.MybatisLabel;
|
||||
import com.github.yulichang.extension.kt.resultmap.MybatisLabelFree;
|
||||
import com.github.yulichang.toolkit.KtUtils;
|
||||
import com.github.yulichang.toolkit.MPJReflectionKit;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.support.FieldCache;
|
||||
import com.github.yulichang.wrapper.interfaces.MFunction;
|
||||
import com.github.yulichang.wrapper.resultmap.Label;
|
||||
@ -137,7 +137,7 @@ public interface QueryLabel<Children> {
|
||||
FieldCache field = fieldMap.get(dtoFieldName);
|
||||
Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类");
|
||||
MybatisLabel.Builder<?, ?> builder;
|
||||
builder = new MybatisLabel.Builder<>(StringUtils.isBlank(prefix) ? null : prefix,
|
||||
builder = new MybatisLabel.Builder<>(StrUtils.isBlank(prefix) ? null : prefix,
|
||||
dtoFieldName, child, field.getType(), (Class<?>) field.getType(), true);
|
||||
addLabel(builder.build(), false);
|
||||
return getChildren();
|
||||
@ -169,7 +169,7 @@ public interface QueryLabel<Children> {
|
||||
String dtoFieldName = dtoField.getName();
|
||||
FieldCache field = MPJReflectionKit.getFieldMap(KtUtils.ref(dtoField)).get(dtoFieldName);
|
||||
Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类");
|
||||
MybatisLabel.Builder<?, ?> builder = new MybatisLabel.Builder<>(StringUtils.isBlank(prefix) ? null : prefix,
|
||||
MybatisLabel.Builder<?, ?> builder = new MybatisLabel.Builder<>(StrUtils.isBlank(prefix) ? null : prefix,
|
||||
dtoFieldName, child, field.getType(), (Class<?>) field.getType(), false);
|
||||
MybatisLabel.Builder<?, ?> cfBuilder = collection.apply(builder);
|
||||
addLabel(cfBuilder.build(), false);
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.yulichang.extension.kt.resultmap;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.toolkit.KtUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||
import com.github.yulichang.wrapper.resultmap.IResult;
|
||||
import com.github.yulichang.wrapper.segments.SelectCache;
|
||||
@ -71,7 +71,7 @@ public class Result implements IResult {
|
||||
String name = column.getName();
|
||||
SelectCache normal = normalMap.get(name);
|
||||
result.selectNormal = normal;
|
||||
if (StringUtils.isBlank(result.property)) {
|
||||
if (StrUtils.isBlank(result.property)) {
|
||||
result.property = normal.getColumProperty();
|
||||
}
|
||||
if (Objects.isNull(result.javaType)) {
|
||||
|
@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.extension.kt.KtLambdaWrapper;
|
||||
import com.github.yulichang.toolkit.LogicInfoUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import com.github.yulichang.toolkit.sql.SqlScriptUtils;
|
||||
|
||||
@ -26,18 +26,18 @@ public class KtWrapperUtils {
|
||||
String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
|
||||
boolean hasWhere = false;
|
||||
String entityWhere = getEntitySql(tableInfo, wrapper);
|
||||
if (StringUtils.isNotBlank(entityWhere)) {
|
||||
if (StrUtils.isNotBlank(entityWhere)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String mainLogic = mainLogic(hasWhere, clazz, wrapper);
|
||||
if (StringUtils.isNotBlank(mainLogic)) {
|
||||
if (StrUtils.isNotBlank(mainLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String subLogic = subLogic(hasWhere, wrapper);
|
||||
if (StringUtils.isNotBlank(subLogic)) {
|
||||
if (StrUtils.isNotBlank(subLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StringUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StrUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
|
||||
|
||||
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
|
||||
@ -59,18 +59,18 @@ public class KtWrapperUtils {
|
||||
String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
|
||||
boolean hasWhere = false;
|
||||
String entityWhere = getEntitySql(tableInfo, wrapper);
|
||||
if (StringUtils.isNotBlank(entityWhere)) {
|
||||
if (StrUtils.isNotBlank(entityWhere)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String mainLogic = mainLogic(hasWhere, clazz, wrapper);
|
||||
if (StringUtils.isNotBlank(mainLogic)) {
|
||||
if (StrUtils.isNotBlank(mainLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String subLogic = subLogic(hasWhere, wrapper);
|
||||
if (StringUtils.isNotBlank(subLogic)) {
|
||||
if (StrUtils.isNotBlank(subLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StringUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StrUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
|
||||
|
||||
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
|
||||
@ -128,7 +128,7 @@ public class KtWrapperUtils {
|
||||
return StringPool.EMPTY;
|
||||
}
|
||||
String info = LogicInfoUtils.getLogicInfo(null, clazz, true, wrapper.getAlias());
|
||||
if (StringUtils.isNotBlank(info)) {
|
||||
if (StrUtils.isNotBlank(info)) {
|
||||
if (hasWhere) {
|
||||
return " AND " + info;
|
||||
}
|
||||
@ -139,7 +139,7 @@ public class KtWrapperUtils {
|
||||
|
||||
private static String subLogic(boolean hasWhere, KtLambdaWrapper<?> wrapper) {
|
||||
String sql = wrapper.getSubLogicSql();
|
||||
if (StringUtils.isNotBlank(sql)) {
|
||||
if (StrUtils.isNotBlank(sql)) {
|
||||
if (hasWhere) {
|
||||
return sql;
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.adapter.base.tookit.VersionUtils;
|
||||
import com.github.yulichang.config.ConfigProperties;
|
||||
@ -167,7 +166,7 @@ public class MPJInterceptor implements Interceptor {
|
||||
}
|
||||
} else {
|
||||
FieldCache field = fieldMap.get(i.getColumProperty());
|
||||
if (StringUtils.isNotBlank(i.getTagColumn())) {
|
||||
if (StrUtils.isNotBlank(i.getTagColumn())) {
|
||||
columnSet.add(i.getTagColumn());
|
||||
if (Objects.nonNull(field)) {
|
||||
ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), i.getColumProperty(),
|
||||
@ -176,7 +175,7 @@ public class MPJInterceptor implements Interceptor {
|
||||
}
|
||||
} else if (wrapper.isResultMap()) {
|
||||
AdapterHelper.getAdapter().parserColum(wrapper.getAlias(), wrapper.getFrom(), i.getColumn(), col -> {
|
||||
String tagCol = MPJStringUtils.getTargetColumn(col);
|
||||
String tagCol = StrUtils.getTargetColumn(col);
|
||||
FieldCache strField = fieldMap.get(tagCol);
|
||||
columnSet.add(tagCol);
|
||||
if (Objects.nonNull(strField)) {
|
||||
@ -240,10 +239,10 @@ public class MPJInterceptor implements Interceptor {
|
||||
String index = r.getIndex();
|
||||
if (columnSet.contains(columnName)) {
|
||||
columnName = getColumn(columnSet, columnName, 0);
|
||||
label = new SelectLabel(r.getSelectNormal(), null, mybatisLabel.getOfType(), columnName, StringUtils.isNotBlank(index), index, r.getBaseColumn());
|
||||
label = new SelectLabel(r.getSelectNormal(), null, mybatisLabel.getOfType(), columnName, StrUtils.isNotBlank(index), index, r.getBaseColumn());
|
||||
} else {
|
||||
columnSet.add(columnName);
|
||||
label = new SelectLabel(r.getSelectNormal(), null, mybatisLabel.getOfType(), StringUtils.isNotBlank(index), index, r.getBaseColumn());
|
||||
label = new SelectLabel(r.getSelectNormal(), null, mybatisLabel.getOfType(), StrUtils.isNotBlank(index), index, r.getBaseColumn());
|
||||
}
|
||||
columnList.add(label);
|
||||
ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), r.getProperty(), columnName, r.getJavaType());
|
||||
|
@ -6,11 +6,11 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.adapter.base.metadata.OrderFieldInfo;
|
||||
import com.github.yulichang.config.ConfigProperties;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
@ -102,7 +102,7 @@ public interface MPJBaseMethod extends Constants {
|
||||
return true;
|
||||
})
|
||||
.map(i -> getSqlWhere(i, newPrefix)).filter(Objects::nonNull).collect(joining(NEWLINE));
|
||||
if (!withId || StringUtils.isBlank(tableInfo.getKeyProperty())) {
|
||||
if (!withId || StrUtils.isBlank(tableInfo.getKeyProperty())) {
|
||||
return filedSqlScript;
|
||||
}
|
||||
String newKeyProperty = newPrefix + tableInfo.getKeyProperty();
|
||||
@ -138,7 +138,7 @@ public interface MPJBaseMethod extends Constants {
|
||||
}
|
||||
|
||||
default String convertIfProperty(String prefix, String property) {
|
||||
return StringUtils.isNotBlank(prefix) ? prefix.substring(0, prefix.length() - 1) + "['" + property + "']" : property;
|
||||
return StrUtils.isNotBlank(prefix) ? prefix.substring(0, prefix.length() - 1) + "['" + property + "']" : property;
|
||||
}
|
||||
|
||||
|
||||
@ -249,7 +249,7 @@ public interface MPJBaseMethod extends Constants {
|
||||
final String newPrefix = prefix == null ? EMPTY : prefix;
|
||||
// 默认: column=
|
||||
String sqlSet = "${ew.alias}." + tableFieldInfo.getColumn() + EQUALS;
|
||||
if (StringUtils.isNotBlank(tableFieldInfo.getUpdate())) {
|
||||
if (StrUtils.isNotBlank(tableFieldInfo.getUpdate())) {
|
||||
sqlSet += String.format(tableFieldInfo.getUpdate(), tableFieldInfo.getColumn());
|
||||
} else {
|
||||
sqlSet += SqlScriptUtils.safeParam(newPrefix + tableFieldInfo.getEl());
|
||||
@ -258,7 +258,7 @@ public interface MPJBaseMethod extends Constants {
|
||||
if (ignoreIf) {
|
||||
return sqlSet;
|
||||
}
|
||||
if (tableFieldInfo.isWithUpdateFill()) {
|
||||
if (AdapterHelper.getAdapter().isWithUpdateFill(tableFieldInfo)) {
|
||||
// 不进行 if 包裹
|
||||
return sqlSet;
|
||||
}
|
||||
@ -266,7 +266,7 @@ public interface MPJBaseMethod extends Constants {
|
||||
}
|
||||
|
||||
default String mpjConvertIfProperty(String prefix, String property) {
|
||||
return StringUtils.isNotBlank(prefix) ? prefix.substring(0, prefix.length() - 1) + "['" + property + "']" : property;
|
||||
return StrUtils.isNotBlank(prefix) ? prefix.substring(0, prefix.length() - 1) + "['" + property + "']" : property;
|
||||
}
|
||||
|
||||
default String mpjConvertIf(TableFieldInfo tableFieldInfo, final String sqlScript, final String property, final FieldStrategy fieldStrategy) {
|
||||
|
@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.interfaces.MPJBaseJoin;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ public class SelectList extends com.baomidou.mybatisplus.core.injector.methods.S
|
||||
@Override
|
||||
protected String sqlOrderBy(TableInfo table) {
|
||||
String orderBy = super.sqlOrderBy(table);
|
||||
if (StringUtils.isBlank(orderBy)) {
|
||||
if (StrUtils.isBlank(orderBy)) {
|
||||
return orderBy;
|
||||
}
|
||||
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),
|
||||
|
@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.interfaces.MPJBaseJoin;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ public class SelectMaps extends com.baomidou.mybatisplus.core.injector.methods.S
|
||||
@Override
|
||||
protected String sqlOrderBy(TableInfo table) {
|
||||
String orderBy = super.sqlOrderBy(table);
|
||||
if (StringUtils.isBlank(orderBy)) {
|
||||
if (StrUtils.isBlank(orderBy)) {
|
||||
return orderBy;
|
||||
}
|
||||
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),
|
||||
|
@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.interfaces.MPJBaseJoin;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ public class SelectMapsPage extends com.baomidou.mybatisplus.core.injector.metho
|
||||
@Override
|
||||
protected String sqlOrderBy(TableInfo table) {
|
||||
String orderBy = super.sqlOrderBy(table);
|
||||
if (StringUtils.isBlank(orderBy)) {
|
||||
if (StrUtils.isBlank(orderBy)) {
|
||||
return orderBy;
|
||||
}
|
||||
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),
|
||||
|
@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.interfaces.MPJBaseJoin;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
|
||||
/**
|
||||
@ -52,7 +52,7 @@ public class SelectObjs extends com.baomidou.mybatisplus.core.injector.methods.S
|
||||
@Override
|
||||
protected String sqlOrderBy(TableInfo table) {
|
||||
String orderBy = super.sqlOrderBy(table);
|
||||
if (StringUtils.isBlank(orderBy)) {
|
||||
if (StrUtils.isBlank(orderBy)) {
|
||||
return orderBy;
|
||||
}
|
||||
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),
|
||||
|
@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.interfaces.MPJBaseJoin;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
|
||||
/**
|
||||
@ -49,7 +49,7 @@ public class SelectOne extends com.baomidou.mybatisplus.core.injector.methods.Se
|
||||
@Override
|
||||
protected String sqlOrderBy(TableInfo table) {
|
||||
String orderBy = super.sqlOrderBy(table);
|
||||
if (StringUtils.isBlank(orderBy)) {
|
||||
if (StrUtils.isBlank(orderBy)) {
|
||||
return orderBy;
|
||||
}
|
||||
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),
|
||||
|
@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.interfaces.MPJBaseJoin;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
|
||||
/**
|
||||
@ -37,7 +37,7 @@ public class SelectPage extends com.baomidou.mybatisplus.core.injector.methods.S
|
||||
@Override
|
||||
protected String sqlOrderBy(TableInfo table) {
|
||||
String orderBy = super.sqlOrderBy(table);
|
||||
if (StringUtils.isBlank(orderBy)) {
|
||||
if (StrUtils.isBlank(orderBy)) {
|
||||
return orderBy;
|
||||
}
|
||||
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),
|
||||
|
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.github.yulichang.config.ConfigProperties;
|
||||
import com.github.yulichang.query.interfaces.CompareIfExists;
|
||||
import com.github.yulichang.query.interfaces.StringJoin;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import com.github.yulichang.toolkit.ThrowOptional;
|
||||
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
||||
@ -237,7 +238,7 @@ public class MPJLambdaQueryWrapper<T> extends AbstractLambdaWrapper<T, MPJLambda
|
||||
|
||||
@Override
|
||||
public String getSqlSelect() {
|
||||
if (StringUtils.isBlank(sqlSelect.getStringValue())) {
|
||||
if (StrUtils.isBlank(sqlSelect.getStringValue())) {
|
||||
if (CollectionUtils.isNotEmpty(ignoreColumns)) {
|
||||
selectColumns.removeIf(ignoreColumns::contains);
|
||||
}
|
||||
@ -260,7 +261,7 @@ public class MPJLambdaQueryWrapper<T> extends AbstractLambdaWrapper<T, MPJLambda
|
||||
}
|
||||
|
||||
public MPJLambdaQueryWrapper<T> setAlias(String alias) {
|
||||
Assert.isTrue(StringUtils.isNotBlank(alias), "别名不能为空");
|
||||
Assert.isTrue(StrUtils.isNotBlank(alias), "别名不能为空");
|
||||
this.alias = alias;
|
||||
return typedThis;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import com.github.yulichang.config.ConfigProperties;
|
||||
import com.github.yulichang.query.interfaces.CompareIfExists;
|
||||
import com.github.yulichang.query.interfaces.StringJoin;
|
||||
import com.github.yulichang.toolkit.MPJSqlInjectionUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import com.github.yulichang.toolkit.ThrowOptional;
|
||||
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
||||
@ -249,7 +250,7 @@ public class MPJQueryWrapper<T> extends AbstractWrapper<T, String, MPJQueryWrapp
|
||||
|
||||
@Override
|
||||
public String getSqlSelect() {
|
||||
if (StringUtils.isBlank(sqlSelect.getStringValue())) {
|
||||
if (StrUtils.isBlank(sqlSelect.getStringValue())) {
|
||||
if (CollectionUtils.isNotEmpty(ignoreColumns)) {
|
||||
selectColumns.removeIf(ignoreColumns::contains);
|
||||
}
|
||||
@ -277,7 +278,7 @@ public class MPJQueryWrapper<T> extends AbstractWrapper<T, String, MPJQueryWrapp
|
||||
* @param alias 主表别名
|
||||
*/
|
||||
public MPJQueryWrapper<T> setAlias(String alias) {
|
||||
Assert.isTrue(StringUtils.isNotBlank(alias), "别名不能为空");
|
||||
Assert.isTrue(StrUtils.isNotBlank(alias), "别名不能为空");
|
||||
this.alias = alias;
|
||||
return this;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.github.yulichang.toolkit;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.base.JoinMapper;
|
||||
|
||||
import java.util.Map;
|
||||
@ -39,7 +38,7 @@ public class MPJTableMapperHelper {
|
||||
}
|
||||
|
||||
public static Class<?> getMapperForName(String name) {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
if (StrUtils.isBlank(name)) {
|
||||
return null;
|
||||
}
|
||||
return CACHE_MAPPER.get(name);
|
||||
|
@ -34,7 +34,7 @@ import static java.util.stream.Collectors.joining;
|
||||
* @since 2016-08-18
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public final class MPJStringUtils {
|
||||
public final class StrUtils {
|
||||
|
||||
/**
|
||||
* 判断是否是中文
|
||||
@ -237,7 +237,7 @@ public final class MPJStringUtils {
|
||||
* @param args 填充参数
|
||||
*/
|
||||
public static String sqlArgsFill(String content, Object... args) {
|
||||
if (MPJStringUtils.isNotBlank(content) && ArrayUtils.isNotEmpty(args)) {
|
||||
if (StrUtils.isNotBlank(content) && ArrayUtils.isNotEmpty(args)) {
|
||||
// 索引不能使用,因为 SQL 中的占位符数字与索引不相同
|
||||
BiIntFunction<Matcher, CharSequence> handler = (m, i) -> sqlParam(args[Integer.parseInt(m.group("idx"))]);
|
||||
return replace(content, MP_SQL_PLACE_HOLDER, handler).toString();
|
||||
@ -280,9 +280,9 @@ public final class MPJStringUtils {
|
||||
public static String sqlParam(Object obj) {
|
||||
String repStr;
|
||||
if (obj instanceof Collection) {
|
||||
repStr = MPJStringUtils.quotaMarkList((Collection<?>) obj);
|
||||
repStr = StrUtils.quotaMarkList((Collection<?>) obj);
|
||||
} else {
|
||||
repStr = MPJStringUtils.quotaMark(obj);
|
||||
repStr = StrUtils.quotaMark(obj);
|
||||
}
|
||||
return repStr;
|
||||
}
|
||||
@ -309,7 +309,7 @@ public final class MPJStringUtils {
|
||||
* @return 单引号包含的原字符串的集合形式
|
||||
*/
|
||||
public static String quotaMarkList(Collection<?> coll) {
|
||||
return coll.stream().map(MPJStringUtils::quotaMark)
|
||||
return coll.stream().map(StrUtils::quotaMark)
|
||||
.collect(joining(StringPool.COMMA, StringPool.LEFT_BRACKET, StringPool.RIGHT_BRACKET));
|
||||
}
|
||||
|
||||
@ -440,8 +440,8 @@ public final class MPJStringUtils {
|
||||
|
||||
/**
|
||||
* 删除字符前缀之后,首字母小写,之后字符大小写的不变
|
||||
* <p>StringUtils.removePrefixAfterPrefixToLower( "isUser", 2 ) = user</p>
|
||||
* <p>StringUtils.removePrefixAfterPrefixToLower( "isUserInfo", 2 ) = userInfo</p>
|
||||
* <p>StrUtils.removePrefixAfterPrefixToLower( "isUser", 2 ) = user</p>
|
||||
* <p>StrUtils.removePrefixAfterPrefixToLower( "isUserInfo", 2 ) = userInfo</p>
|
||||
*
|
||||
* @param rawString 需要处理的字符串
|
||||
* @param index 删除多少个字符(从左至右)
|
||||
@ -453,7 +453,7 @@ public final class MPJStringUtils {
|
||||
|
||||
/**
|
||||
* 驼峰转连字符
|
||||
* <p>StringUtils.camelToHyphen( "managerAdminUserService" ) = manager-admin-user-service</p>
|
||||
* <p>StrUtils.camelToHyphen( "managerAdminUserService" ) = manager-admin-user-service</p>
|
||||
*
|
||||
* @param input ignore
|
||||
* @return 以'-'分隔
|
||||
@ -525,11 +525,11 @@ public final class MPJStringUtils {
|
||||
* <p>对字符串大小写敏感</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtils.equals(null, null) = true
|
||||
* StringUtils.equals(null, "abc") = false
|
||||
* StringUtils.equals("abc", null) = false
|
||||
* StringUtils.equals("abc", "abc") = true
|
||||
* StringUtils.equals("abc", "ABC") = false
|
||||
* StrUtils.equals(null, null) = true
|
||||
* StrUtils.equals(null, "abc") = false
|
||||
* StrUtils.equals("abc", null) = false
|
||||
* StrUtils.equals("abc", "abc") = true
|
||||
* StrUtils.equals("abc", "ABC") = false
|
||||
* </pre>
|
||||
*
|
||||
* @param cs1 第一个字符串, 可为 {@code null}
|
@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.toolkit.sql.SqlScriptUtils;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
@ -28,18 +27,18 @@ public class WrapperUtils {
|
||||
String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
|
||||
boolean hasWhere = false;
|
||||
String entityWhere = getEntitySql(tableInfo, wrapper);
|
||||
if (StringUtils.isNotBlank(entityWhere)) {
|
||||
if (StrUtils.isNotBlank(entityWhere)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String mainLogic = mainLogic(hasWhere, clazz, wrapper);
|
||||
if (StringUtils.isNotBlank(mainLogic)) {
|
||||
if (StrUtils.isNotBlank(mainLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String subLogic = subLogic(hasWhere, wrapper);
|
||||
if (StringUtils.isNotBlank(subLogic)) {
|
||||
if (StrUtils.isNotBlank(subLogic)) {
|
||||
hasWhere = true;
|
||||
}
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StringUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
String sqlSegment = (wrapper.getSqlSegment() != null && StrUtils.isNotBlank(wrapper.getSqlSegment())) ?
|
||||
((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
|
||||
|
||||
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
|
||||
@ -97,7 +96,7 @@ public class WrapperUtils {
|
||||
return StringPool.EMPTY;
|
||||
}
|
||||
String info = LogicInfoUtils.getLogicInfo(null, clazz, true, wrapper.getAlias());
|
||||
if (StringUtils.isNotBlank(info)) {
|
||||
if (StrUtils.isNotBlank(info)) {
|
||||
if (hasWhere) {
|
||||
return " AND " + info;
|
||||
}
|
||||
@ -108,7 +107,7 @@ public class WrapperUtils {
|
||||
|
||||
private static String subLogic(boolean hasWhere, MPJLambdaWrapper<?> wrapper) {
|
||||
String sql = wrapper.getSubLogicSql();
|
||||
if (StringUtils.isNotBlank(sql)) {
|
||||
if (StrUtils.isNotBlank(sql)) {
|
||||
if (hasWhere) {
|
||||
return sql;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.github.yulichang.toolkit.sql;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.TypeHandler;
|
||||
|
||||
@ -42,16 +42,16 @@ public abstract class SqlScriptUtils implements Constants {
|
||||
public static String convertTrim(final String sqlScript, final String prefix, final String suffix,
|
||||
final String prefixOverrides, final String suffixOverrides) {
|
||||
StringBuilder sb = new StringBuilder("<trim");
|
||||
if (StringUtils.isNotBlank(prefix)) {
|
||||
if (StrUtils.isNotBlank(prefix)) {
|
||||
sb.append(" prefix=\"").append(prefix).append(QUOTE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(suffix)) {
|
||||
if (StrUtils.isNotBlank(suffix)) {
|
||||
sb.append(" suffix=\"").append(suffix).append(QUOTE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(prefixOverrides)) {
|
||||
if (StrUtils.isNotBlank(prefixOverrides)) {
|
||||
sb.append(" prefixOverrides=\"").append(prefixOverrides).append(QUOTE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(suffixOverrides)) {
|
||||
if (StrUtils.isNotBlank(suffixOverrides)) {
|
||||
sb.append(" suffixOverrides=\"").append(suffixOverrides).append(QUOTE);
|
||||
}
|
||||
return sb.append(RIGHT_CHEV).append(NEWLINE).append(sqlScript).append(NEWLINE).append("</trim>").toString();
|
||||
@ -89,16 +89,16 @@ public abstract class SqlScriptUtils implements Constants {
|
||||
public static String convertForeach(final String sqlScript, final String collection, final String index,
|
||||
final String item, final String separator) {
|
||||
StringBuilder sb = new StringBuilder("<foreach");
|
||||
if (StringUtils.isNotBlank(collection)) {
|
||||
if (StrUtils.isNotBlank(collection)) {
|
||||
sb.append(" collection=\"").append(collection).append(QUOTE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(index)) {
|
||||
if (StrUtils.isNotBlank(index)) {
|
||||
sb.append(" index=\"").append(index).append(QUOTE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(item)) {
|
||||
if (StrUtils.isNotBlank(item)) {
|
||||
sb.append(" item=\"").append(item).append(QUOTE);
|
||||
}
|
||||
if (StringUtils.isNotBlank(separator)) {
|
||||
if (StrUtils.isNotBlank(separator)) {
|
||||
sb.append(" separator=\"").append(separator).append(QUOTE);
|
||||
}
|
||||
return sb.append(RIGHT_CHEV).append(NEWLINE).append(sqlScript).append(NEWLINE).append("</foreach>").toString();
|
||||
@ -151,7 +151,7 @@ public abstract class SqlScriptUtils implements Constants {
|
||||
*/
|
||||
public static String safeParam(final String param, final String mapping) {
|
||||
String target = HASH_LEFT_BRACE + param;
|
||||
if (StringUtils.isBlank(mapping)) {
|
||||
if (StrUtils.isBlank(mapping)) {
|
||||
return target + RIGHT_BRACE;
|
||||
}
|
||||
return target + COMMA + mapping + RIGHT_BRACE;
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.*;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.toolkit.LogicInfoUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import com.github.yulichang.toolkit.TableList;
|
||||
import com.github.yulichang.wrapper.interfaces.DeleteChain;
|
||||
@ -71,7 +72,7 @@ public class DeleteJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, DeleteJoi
|
||||
@Override
|
||||
@SuppressWarnings({"UnusedReturnValue", "DuplicatedCode"})
|
||||
public String getDeleteSql() {
|
||||
if (StringUtils.isNotBlank(this.deleteSql.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(this.deleteSql.getStringValue())) {
|
||||
return this.deleteSql.getStringValue();
|
||||
}
|
||||
String delete = null;
|
||||
@ -89,7 +90,7 @@ public class DeleteJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, DeleteJoi
|
||||
if (CollectionUtils.isNotEmpty(deleteTableName)) {
|
||||
delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName);
|
||||
}
|
||||
if (StringUtils.isBlank(delete)) {
|
||||
if (StrUtils.isBlank(delete)) {
|
||||
delete = this.alias;
|
||||
}
|
||||
deleteSql.setStringValue(delete);
|
||||
@ -102,7 +103,7 @@ public class DeleteJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, DeleteJoi
|
||||
@Override
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
public String getDeleteLogicSql() {
|
||||
if (StringUtils.isNotBlank(this.deleteSql.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(this.deleteSql.getStringValue())) {
|
||||
return this.deleteSql.getStringValue();
|
||||
}
|
||||
String delete = null;
|
||||
@ -120,7 +121,7 @@ public class DeleteJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, DeleteJoi
|
||||
if (CollectionUtils.isNotEmpty(deleteTableName)) {
|
||||
delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(delete)) {
|
||||
if (StrUtils.isNotBlank(delete)) {
|
||||
delete = StringPool.COMMA + delete;
|
||||
} else {
|
||||
delete = StringPool.EMPTY;
|
||||
|
@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.config.ConfigProperties;
|
||||
@ -380,10 +379,10 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
|
||||
* 获取连表部分语句
|
||||
*/
|
||||
public String getFrom() {
|
||||
if (StringUtils.isBlank(from.getStringValue())) {
|
||||
if (StrUtils.isBlank(from.getStringValue())) {
|
||||
StringBuilder value = new StringBuilder();
|
||||
for (Children wrapper : onWrappers) {
|
||||
if (StringUtils.isBlank(wrapper.from.getStringValue())) {
|
||||
if (StrUtils.isBlank(wrapper.from.getStringValue())) {
|
||||
if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) {
|
||||
TableInfo tableInfo = TableHelper.getAssert(wrapper.getJoinClass());
|
||||
if (AdapterHelper.getAdapter().mpjHasLogic(tableInfo)) {
|
||||
@ -453,7 +452,7 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
|
||||
tableWrapper.tableList.setRootClass(clazz);
|
||||
|
||||
table.accept(tableWrapper);
|
||||
if (MPJStringUtils.isBlank(tableWrapper.getSqlSelect())) {
|
||||
if (StrUtils.isBlank(tableWrapper.getSqlSelect())) {
|
||||
tableWrapper.selectAll();
|
||||
}
|
||||
tabName = WrapperUtils.buildUnionSqlByWrapper(clazz, tableWrapper);
|
||||
@ -467,7 +466,7 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
|
||||
instance.isOn = true;
|
||||
instance.isMain = false;
|
||||
onWrappers.add(instance);
|
||||
if (StringUtils.isBlank(tableAlias)) {
|
||||
if (StrUtils.isBlank(tableAlias)) {
|
||||
tableList.put(oldIndex, clazz, false, subTableAlias, newIndex);
|
||||
instance.alias = subTableAlias;
|
||||
instance.hasAlias = false;
|
||||
@ -512,7 +511,7 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
|
||||
*/
|
||||
public boolean isUseAnnotationOrderBy() {
|
||||
final String _sqlSegment = this.getSqlSegment();
|
||||
if (StringUtils.isBlank(_sqlSegment)) {
|
||||
if (StrUtils.isBlank(_sqlSegment)) {
|
||||
return true;
|
||||
}
|
||||
final String _sqlSegmentToUpperCase = _sqlSegment.toUpperCase();
|
||||
|
@ -223,7 +223,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
|
||||
/**
|
||||
* 设置 IfExists
|
||||
* .IfExists(val -> val != null && StringUtils.isNotBlank(val))
|
||||
* .IfExists(val -> val != null && StrUtils.isNotBlank(val))
|
||||
*
|
||||
* @param IfExists 判断
|
||||
* @return Children
|
||||
@ -237,7 +237,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
public <X, V> Children allEq(boolean condition, Map<SFunction<X, ?>, V> params, boolean null2IsNull) {
|
||||
if (condition && CollectionUtils.isNotEmpty(params)) {
|
||||
params.forEach((k, v) -> {
|
||||
if (StringUtils.checkValNotNull(v)) {
|
||||
if (StrUtils.checkValNotNull(v)) {
|
||||
eq(k, v);
|
||||
} else {
|
||||
if (null2IsNull) {
|
||||
@ -254,7 +254,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
if (condition && CollectionUtils.isNotEmpty(params)) {
|
||||
params.forEach((k, v) -> {
|
||||
if (filter.test(k, v)) {
|
||||
if (StringUtils.checkValNotNull(v)) {
|
||||
if (StrUtils.checkValNotNull(v)) {
|
||||
eq(k, v);
|
||||
} else {
|
||||
if (null2IsNull) {
|
||||
@ -839,7 +839,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
*/
|
||||
@SuppressWarnings("SameParameterValue")
|
||||
protected final String formatSqlMaybeWithParam(String sqlStr, String mapping, Object... params) {
|
||||
if (StringUtils.isBlank(sqlStr)) {
|
||||
if (StrUtils.isBlank(sqlStr)) {
|
||||
// todo 何时会这样?
|
||||
return null;
|
||||
}
|
||||
@ -941,7 +941,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
|
||||
@Override
|
||||
public String getSqlComment() {
|
||||
if (StringUtils.isNotBlank(sqlComment.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(sqlComment.getStringValue())) {
|
||||
return "/*" + StringEscape.escapeRawString(sqlComment.getStringValue()) + "*/";
|
||||
}
|
||||
return null;
|
||||
@ -949,7 +949,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
|
||||
@Override
|
||||
public String getSqlFirst() {
|
||||
if (StringUtils.isNotBlank(sqlFirst.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(sqlFirst.getStringValue())) {
|
||||
return StringEscape.escapeRawString(sqlFirst.getStringValue());
|
||||
}
|
||||
return null;
|
||||
@ -1076,7 +1076,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
public <V> Children allEqStr(boolean condition, Map<String, V> params, boolean null2IsNull) {
|
||||
if (condition && CollectionUtils.isNotEmpty(params)) {
|
||||
params.forEach((k, v) -> {
|
||||
if (StringUtils.checkValNotNull(v)) {
|
||||
if (StrUtils.checkValNotNull(v)) {
|
||||
eq(k, v);
|
||||
} else {
|
||||
if (null2IsNull) {
|
||||
@ -1093,7 +1093,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
|
||||
if (condition && CollectionUtils.isNotEmpty(params)) {
|
||||
params.forEach((k, v) -> {
|
||||
if (filter.test(k, v)) {
|
||||
if (StringUtils.checkValNotNull(v)) {
|
||||
if (StrUtils.checkValNotNull(v)) {
|
||||
eq(k, v);
|
||||
} else {
|
||||
if (null2IsNull) {
|
||||
|
@ -5,10 +5,8 @@ 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.config.ConfigProperties;
|
||||
import com.github.yulichang.toolkit.Constant;
|
||||
import com.github.yulichang.toolkit.*;
|
||||
import com.github.yulichang.toolkit.LambdaUtils;
|
||||
import com.github.yulichang.toolkit.TableList;
|
||||
import com.github.yulichang.toolkit.WrapperUtils;
|
||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
|
||||
import com.github.yulichang.wrapper.interfaces.*;
|
||||
@ -322,7 +320,7 @@ public class MPJLambdaWrapper<T> extends JoinAbstractLambdaWrapper<T, MPJLambdaW
|
||||
*/
|
||||
@Override
|
||||
public String getSqlSelect() {
|
||||
if (StringUtils.isBlank(sqlSelect.getStringValue()) && CollectionUtils.isNotEmpty(selectColumns)) {
|
||||
if (StrUtils.isBlank(sqlSelect.getStringValue()) && CollectionUtils.isNotEmpty(selectColumns)) {
|
||||
String s = selectColumns.stream().map(i -> {
|
||||
if (i.isStr()) {
|
||||
return i.getColumn();
|
||||
|
@ -129,7 +129,7 @@ public class UpdateJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, UpdateJoi
|
||||
|
||||
@Override
|
||||
public UpdateJoinWrapper<T> setApply(boolean condition, String applySql, MFunction<FuncConsumer> consumerFunction, Object... values) {
|
||||
if (condition && StringUtils.isNotBlank(applySql)) {
|
||||
if (condition && StrUtils.isNotBlank(applySql)) {
|
||||
FuncConsumer funcConsumer = consumerFunction.apply(new FuncConsumer());
|
||||
UpdateSet set = new UpdateSet();
|
||||
set.setApply(true);
|
||||
@ -143,7 +143,7 @@ public class UpdateJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, UpdateJoi
|
||||
|
||||
@Override
|
||||
public UpdateJoinWrapper<T> setSql(boolean condition, String sql) {
|
||||
if (condition && StringUtils.isNotBlank(sql)) {
|
||||
if (condition && StrUtils.isNotBlank(sql)) {
|
||||
if (Objects.isNull(sqlSet)) {
|
||||
sqlSet = new ArrayList<>();
|
||||
}
|
||||
@ -155,7 +155,7 @@ public class UpdateJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, UpdateJoi
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
@Override
|
||||
public String getSqlSet() {
|
||||
if (StringUtils.isNotBlank(sqlSetStr.getStringValue())) {
|
||||
if (StrUtils.isNotBlank(sqlSetStr.getStringValue())) {
|
||||
return sqlSetStr.getStringValue();
|
||||
}
|
||||
StringBuilder set = new StringBuilder(StringPool.EMPTY);
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.github.yulichang.wrapper.interfaces;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.github.yulichang.toolkit.LambdaUtils;
|
||||
import com.github.yulichang.toolkit.MPJReflectionKit;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.support.FieldCache;
|
||||
import com.github.yulichang.wrapper.resultmap.Label;
|
||||
import com.github.yulichang.wrapper.resultmap.MybatisLabel;
|
||||
@ -152,7 +152,7 @@ public interface QueryLabel<Children> {
|
||||
FieldCache field = fieldMap.get(dtoFieldName);
|
||||
Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类");
|
||||
MybatisLabel.Builder<C, F> builder;
|
||||
builder = new MybatisLabel.Builder<>(StringUtils.isBlank(prefix) ? null : prefix,
|
||||
builder = new MybatisLabel.Builder<>(StrUtils.isBlank(prefix) ? null : prefix,
|
||||
dtoFieldName, child, field.getType(), (Class<F>) field.getType(), true);
|
||||
addLabel(builder.build(), false);
|
||||
return getChildren();
|
||||
@ -186,7 +186,7 @@ public interface QueryLabel<Children> {
|
||||
Class<S> dtoClass = LambdaUtils.getEntityClass(dtoField);
|
||||
FieldCache field = MPJReflectionKit.getFieldMap(dtoClass).get(dtoFieldName);
|
||||
Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类");
|
||||
MybatisLabel.Builder<C, F> builder = new MybatisLabel.Builder<>(StringUtils.isBlank(prefix) ? null : prefix,
|
||||
MybatisLabel.Builder<C, F> builder = new MybatisLabel.Builder<>(StrUtils.isBlank(prefix) ? null : prefix,
|
||||
dtoFieldName, child, field.getType(), (Class<F>) field.getType(), false);
|
||||
MybatisLabel.Builder<C, F> cfBuilder = collection.apply(builder);
|
||||
addLabel(cfBuilder.build(), false);
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.github.yulichang.wrapper.resultmap;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
import com.github.yulichang.toolkit.LambdaUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||
import com.github.yulichang.wrapper.segments.SelectCache;
|
||||
import lombok.AccessLevel;
|
||||
@ -71,7 +71,7 @@ public class Result implements IResult {
|
||||
String name = LambdaUtils.getName(column);
|
||||
SelectCache normal = normalMap.get(name);
|
||||
result.selectNormal = normal;
|
||||
if (StringUtils.isBlank(result.property)) {
|
||||
if (StrUtils.isBlank(result.property)) {
|
||||
result.property = normal.getColumProperty();
|
||||
}
|
||||
if (Objects.isNull(result.javaType)) {
|
||||
|
@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.toolkit.MPJStringUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.ReflectionKit;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import lombok.Getter;
|
||||
@ -82,7 +82,7 @@ public class SelectCache implements Serializable {
|
||||
this.column = column;
|
||||
this.columnType = columnType;
|
||||
this.columProperty = columProperty;
|
||||
this.tagColumn = MPJStringUtils.getTargetColumn(column);
|
||||
this.tagColumn = StrUtils.getTargetColumn(column);
|
||||
this.isSelect = isSelect;
|
||||
if (Objects.isNull(tableFieldInfo)) {
|
||||
this.hasTypeHandle = false;
|
||||
|
@ -3,7 +3,7 @@ package com.github.yulichang.extension.mapping.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.enums.SqlKeyword;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||
import com.github.yulichang.wrapper.segments.SelectCache;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -44,12 +44,12 @@ public class MPJMappingWrapper {
|
||||
|
||||
public MPJMappingWrapper(Class<?> joinClass, String first, String select, com.github.yulichang.annotation.Apply[] applyArr,
|
||||
com.github.yulichang.annotation.Condition[] conditions, String last, String[] orderByAsc, String[] orderByDesc) {
|
||||
this.hasFirst = StringUtils.isNotBlank(first);
|
||||
this.hasFirst = StrUtils.isNotBlank(first);
|
||||
if (this.hasFirst) {
|
||||
this.first = first;
|
||||
}
|
||||
|
||||
this.hasSelect = StringUtils.isNotBlank(select);
|
||||
this.hasSelect = StrUtils.isNotBlank(select);
|
||||
if (this.hasSelect) {
|
||||
this.select = select;
|
||||
}
|
||||
@ -78,7 +78,7 @@ public class MPJMappingWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
this.hasLast = StringUtils.isNotBlank(last);
|
||||
this.hasLast = StrUtils.isNotBlank(last);
|
||||
if (this.hasLast) {
|
||||
this.last = last;
|
||||
}
|
||||
@ -91,7 +91,7 @@ public class MPJMappingWrapper {
|
||||
for (String orderBy : orderByAsc) {
|
||||
allColumns.addAll(Arrays.asList(orderBy.split(StringPool.COMMA)));
|
||||
}
|
||||
this.orderByAsc = allColumns.stream().filter(StringUtils::isNotBlank).map(String::trim).map(f ->
|
||||
this.orderByAsc = allColumns.stream().filter(StrUtils::isNotBlank).map(String::trim).map(f ->
|
||||
colSet.contains(f) ? f : listField.stream().filter(s -> s.getColumProperty().equals(f))
|
||||
.findFirst().map(SelectCache::getColumn).orElse(f)).collect(Collectors.toList());
|
||||
}
|
||||
@ -104,7 +104,7 @@ public class MPJMappingWrapper {
|
||||
for (String orderBy : orderByDesc) {
|
||||
allColumns.addAll(Arrays.asList(orderBy.split(StringPool.COMMA)));
|
||||
}
|
||||
this.orderByDesc = allColumns.stream().filter(StringUtils::isNotBlank).map(String::trim).map(f ->
|
||||
this.orderByDesc = allColumns.stream().filter(StrUtils::isNotBlank).map(String::trim).map(f ->
|
||||
colSet.contains(f) ? f : listField.stream().filter(s -> s.getColumProperty().equals(f))
|
||||
.findFirst().map(SelectCache::getColumn).orElse(f)).collect(Collectors.toList());
|
||||
}
|
||||
|
@ -3,12 +3,16 @@ package com.github.yulichang.extension.mapping.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.*;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ClassUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.github.yulichang.adapter.AdapterHelper;
|
||||
import com.github.yulichang.annotation.EntityMapping;
|
||||
import com.github.yulichang.annotation.FieldMapping;
|
||||
import com.github.yulichang.toolkit.ReflectionKit;
|
||||
import com.github.yulichang.toolkit.SpringContentUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.toolkit.TableHelper;
|
||||
import com.github.yulichang.toolkit.support.ColumnCache;
|
||||
import com.github.yulichang.wrapper.segments.SelectCache;
|
||||
@ -178,7 +182,7 @@ public class MPJTableFieldInfo {
|
||||
}
|
||||
|
||||
private void initJoinField(String joinField) {
|
||||
if (StringUtils.isNotBlank(joinField)) {
|
||||
if (StrUtils.isNotBlank(joinField)) {
|
||||
this.joinProperty = joinField;
|
||||
} else {
|
||||
TableInfo info = getTableInfo(this.joinClass);
|
||||
@ -200,14 +204,14 @@ public class MPJTableFieldInfo {
|
||||
this.joinField = getField(this.joinClass, joinFieldInfo);
|
||||
}
|
||||
Assert.notNull(this.joinField, "注解属性joinField不存在 %s , %s", this.joinClass.getName(),
|
||||
StringUtils.isBlank(this.joinProperty) ? "主键" : this.joinProperty);
|
||||
StrUtils.isBlank(this.joinProperty) ? "主键" : this.joinProperty);
|
||||
Assert.notNull(this.joinColumn, "注解属性joinField不存在 %s , %s", this.joinClass.getName(),
|
||||
StringUtils.isBlank(this.joinProperty) ? "主键" : this.joinProperty);
|
||||
StrUtils.isBlank(this.joinProperty) ? "主键" : this.joinProperty);
|
||||
this.joinField.setAccessible(true);
|
||||
}
|
||||
|
||||
private void initThisField(String thisField) {
|
||||
if (StringUtils.isNotBlank(thisField)) {
|
||||
if (StrUtils.isNotBlank(thisField)) {
|
||||
this.thisProperty = thisField;
|
||||
} else {
|
||||
TableInfo info = getTableInfo(this.entityType);
|
||||
@ -220,13 +224,13 @@ public class MPJTableFieldInfo {
|
||||
this.thisField = ReflectionKit.getFieldList(ClassUtils.getUserClass(entityType)).stream().filter(f ->
|
||||
f.getName().equals(tableInfo.getKeyProperty())).findFirst().orElse(null);
|
||||
Assert.notNull(this.thisField, "注解属性thisField不存在 %s , %s", entityType.getName(),
|
||||
StringUtils.isBlank(this.thisProperty) ? "主键" : this.thisProperty);
|
||||
StrUtils.isBlank(this.thisProperty) ? "主键" : this.thisProperty);
|
||||
this.thisColumn = tableInfo.getKeyColumn();
|
||||
} else {
|
||||
TableFieldInfo fieldInfo = tableInfo.getFieldList().stream().filter(f ->
|
||||
f.getProperty().equals(this.thisProperty)).findFirst().orElse(null);
|
||||
Assert.notNull(fieldInfo, "注解属性thisField不存在 %s , %s", entityType.getName(),
|
||||
StringUtils.isBlank(this.thisProperty) ? "主键" : this.thisProperty);
|
||||
StrUtils.isBlank(this.thisProperty) ? "主键" : this.thisProperty);
|
||||
this.thisField = getField(this.entityType, fieldInfo);
|
||||
this.thisColumn = fieldInfo.getColumn();
|
||||
}
|
||||
@ -269,20 +273,20 @@ public class MPJTableFieldInfo {
|
||||
if (Objects.isNull(arr) || arr.length == 0) {
|
||||
return false;
|
||||
}
|
||||
return Arrays.stream(arr).anyMatch(StringUtils::isNotBlank);
|
||||
return Arrays.stream(arr).anyMatch(StrUtils::isNotBlank);
|
||||
}
|
||||
|
||||
private String propToColumn(Class<?> tag, String[] arr, String joinC) {
|
||||
Map<String, SelectCache> mapField = ColumnCache.getMapField(tag);
|
||||
List<String> args = null;
|
||||
if (checkArr(arr)) {
|
||||
args = Arrays.stream(arr).filter(StringUtils::isNotBlank).map(c -> {
|
||||
args = Arrays.stream(arr).filter(StrUtils::isNotBlank).map(c -> {
|
||||
if (mapField.containsKey(c)) {
|
||||
return mapField.get(c).getColumn();
|
||||
}
|
||||
return c;
|
||||
}).collect(Collectors.toList());
|
||||
if (StringUtils.isNotBlank(joinC)) {
|
||||
if (StrUtils.isNotBlank(joinC)) {
|
||||
if (mapField.containsKey(joinC)) {
|
||||
args.add(mapField.get(joinC).getColumn());
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.injector.ISqlInjector;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||
@ -16,6 +15,7 @@ import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerIntercept
|
||||
import com.baomidou.mybatisplus.extension.toolkit.JdbcUtils;
|
||||
import com.github.yulichang.injector.MPJSqlInjector;
|
||||
import com.github.yulichang.test.util.ThreadLocalUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import lombok.SneakyThrows;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.LongValue;
|
||||
@ -149,7 +149,7 @@ public class MybatisPlusConfig {
|
||||
@SneakyThrows
|
||||
public void beforePrepare(StatementHandler sh, Connection connection, Integer transactionTimeout) {
|
||||
BoundSql boundSql = sh.getBoundSql();
|
||||
if (boundSql != null && StringUtils.isNotBlank(boundSql.getSql())) {
|
||||
if (boundSql != null && StrUtils.isNotBlank(boundSql.getSql())) {
|
||||
String sql = boundSql.getSql();
|
||||
this.dbType = Optional.ofNullable(this.dbType).orElse(JdbcUtils.getDbType(connection.getMetaData().getURL()));
|
||||
if (P.test(this.dbType)) {
|
||||
@ -166,7 +166,7 @@ public class MybatisPlusConfig {
|
||||
}
|
||||
|
||||
private String formatSql(String sql) {
|
||||
if (StringUtils.isBlank(sql)) {
|
||||
if (StrUtils.isBlank(sql)) {
|
||||
return sql;
|
||||
}
|
||||
sql = sql.replaceAll("\n", "");
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.github.yulichang.test.util;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -31,13 +31,13 @@ public class ThreadLocalUtils {
|
||||
@SneakyThrows
|
||||
public static List<String> get() {
|
||||
String s = userThreadLocal.get();
|
||||
if (StringUtils.isBlank(s)) {
|
||||
if (StrUtils.isBlank(s)) {
|
||||
return null;
|
||||
}
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
List<String> sqlList = mapper.readValue(s, new TypeReference<List<String>>() {
|
||||
List<String> sqlList = mapper.readValue(s, new TypeReference<>() {
|
||||
});
|
||||
sqlList.removeIf(StringUtils::isBlank);
|
||||
sqlList.removeIf(StrUtils::isBlank);
|
||||
set("");
|
||||
return sqlList;
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.github.yulichang.test.join;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.adapter.base.tookit.VersionUtils;
|
||||
import com.github.yulichang.test.join.dto.AddressDTO;
|
||||
@ -14,6 +13,7 @@ import com.github.yulichang.test.join.mapper.*;
|
||||
import com.github.yulichang.test.util.Reset;
|
||||
import com.github.yulichang.test.util.ThreadLocalUtils;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@ -329,9 +329,9 @@ class LambdaWrapperTest {
|
||||
.leftJoin(UserDO.class, "uc", UserDO::getId, UserDto::getUpdateBy, ext -> ext
|
||||
.selectAs(UserDO::getName, UserDto::getUpdateName));
|
||||
List<UserDto> userDtos = userDTOMapper.selectJoinList(UserDto.class, wrapper.clone());
|
||||
assert StringUtils.isNotBlank(userDtos.get(0).getUserName());
|
||||
assert StringUtils.isNotBlank(userDtos.get(0).getCreateName());
|
||||
assert StringUtils.isNotBlank(userDtos.get(0).getUpdateName());
|
||||
assert StrUtils.isNotBlank(userDtos.get(0).getUserName());
|
||||
assert StrUtils.isNotBlank(userDtos.get(0).getCreateName());
|
||||
assert StrUtils.isNotBlank(userDtos.get(0).getUpdateName());
|
||||
|
||||
|
||||
ThreadLocalUtils.set("""
|
||||
|
@ -2,7 +2,6 @@ package com.github.yulichang.test.join.apt;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.adapter.base.tookit.VersionUtils;
|
||||
import com.github.yulichang.extension.apt.AptQueryWrapper;
|
||||
@ -16,6 +15,7 @@ import com.github.yulichang.test.join.entity.apt.*;
|
||||
import com.github.yulichang.test.join.mapper.*;
|
||||
import com.github.yulichang.test.util.Reset;
|
||||
import com.github.yulichang.test.util.ThreadLocalUtils;
|
||||
import com.github.yulichang.toolkit.StrUtils;
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -364,9 +364,9 @@ class AptWrapperTest {
|
||||
.ge(ub.id, 0);
|
||||
|
||||
List<UserDto> userDtos = userDTOMapper.selectJoinList(UserDto.class, wrapper);
|
||||
assert StringUtils.isNotBlank(userDtos.get(0).getUserName());
|
||||
assert StringUtils.isNotBlank(userDtos.get(0).getCreateName());
|
||||
assert StringUtils.isNotBlank(userDtos.get(0).getUpdateName());
|
||||
assert StrUtils.isNotBlank(userDtos.get(0).getUserName());
|
||||
assert StrUtils.isNotBlank(userDtos.get(0).getCreateName());
|
||||
assert StrUtils.isNotBlank(userDtos.get(0).getUpdateName());
|
||||
|
||||
|
||||
ThreadLocalUtils.set("""
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.github.yulichang.test.kt
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page
|
||||
import com.github.yulichang.extension.kt.KtDeleteJoinWrapper
|
||||
import com.github.yulichang.extension.kt.KtLambdaWrapper
|
||||
@ -16,6 +15,7 @@ import com.github.yulichang.test.kt.mapper.UserDTOMapper
|
||||
import com.github.yulichang.test.kt.mapper.UserMapper
|
||||
import com.github.yulichang.test.util.Reset
|
||||
import com.github.yulichang.test.util.ThreadLocalUtils
|
||||
import com.github.yulichang.toolkit.StrUtils
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
@ -295,9 +295,9 @@ class LambdaWrapperTest {
|
||||
ext.selectAs(UserDO::name, UserDto::updateName)
|
||||
}
|
||||
val userDtos: List<UserDto> = userDTOMapper!!.selectJoinList(UserDto::class.java, wrapper)
|
||||
assert(StringUtils.isNotBlank(userDtos[0].userName))
|
||||
assert(StringUtils.isNotBlank(userDtos[0].createName))
|
||||
assert(StringUtils.isNotBlank(userDtos[0].updateName))
|
||||
assert(StrUtils.isNotBlank(userDtos[0].userName))
|
||||
assert(StrUtils.isNotBlank(userDtos[0].createName))
|
||||
assert(StrUtils.isNotBlank(userDtos[0].updateName))
|
||||
|
||||
|
||||
ThreadLocalUtils.set(
|
||||
|
Loading…
x
Reference in New Issue
Block a user