调整名称

This commit is contained in:
yulichang 2024-10-27 21:45:32 +08:00
parent 9e65e33301
commit 14ea2c45b0
55 changed files with 390 additions and 219 deletions

View File

@ -2,7 +2,6 @@ package com.github.yulichang.adapter.jsqlparser.v46;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils; import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import net.sf.jsqlparser.parser.CCJSqlParserUtil; import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.schema.Column; import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.statement.Statement; import net.sf.jsqlparser.statement.Statement;
@ -41,7 +40,7 @@ public class JSqlParserHelperV46 {
} else { } else {
col = selectExpressionItem.getAlias().getName(); col = selectExpressionItem.getAlias().getName();
} }
if (StringUtils.isNotBlank(col)) { if (isNotBlank(col)) {
columConsumer.accept(col); columConsumer.accept(col);
} }
} }
@ -56,4 +55,9 @@ public class JSqlParserHelperV46 {
throw new RuntimeException(throwable); throw new RuntimeException(throwable);
} }
} }
public static boolean isNotBlank(String str) {
return str != null && !str.trim().isEmpty();
}
} }

View File

@ -2,7 +2,6 @@ package com.github.yulichang.adapter.jsqlparser;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils; import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import net.sf.jsqlparser.parser.CCJSqlParserUtil; import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.schema.Column; import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.statement.Statement; import net.sf.jsqlparser.statement.Statement;
@ -38,7 +37,7 @@ public class JSqlParserHelper {
} else { } else {
col = item.getAlias().getName(); col = item.getAlias().getName();
} }
if (StringUtils.isNotBlank(col)) { if (isNotBlank(col)) {
columConsumer.accept(col); columConsumer.accept(col);
} }
} }
@ -51,4 +50,8 @@ public class JSqlParserHelper {
throw new RuntimeException(throwable); throw new RuntimeException(throwable);
} }
} }
public static boolean isNotBlank(String str) {
return str != null && !str.trim().isEmpty();
}
} }

View File

@ -38,6 +38,10 @@ public interface IAdapter {
return tableFieldInfo.isPrimitive(); return tableFieldInfo.isPrimitive();
} }
default boolean isWithUpdateFill(TableFieldInfo tableFieldInfo) {
return tableFieldInfo.isWithUpdateFill();
}
default String mpjMapping(TableFieldInfo tableFieldInfo) { default String mpjMapping(TableFieldInfo tableFieldInfo) {
return tableFieldInfo.getMapping(); return tableFieldInfo.getMapping();
} }

View File

@ -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);
}
}

View File

@ -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>

View File

@ -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) {
}
}

View File

@ -3,9 +3,9 @@ package com.github.yulichang.adapter.v33x;
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.StringPool; 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.IAdapter;
import com.github.yulichang.adapter.base.metadata.OrderFieldInfo; 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.base.tookit.VersionUtils;
import com.github.yulichang.adapter.jsqlparser.v46.JSqlParserHelperV46; import com.github.yulichang.adapter.jsqlparser.v46.JSqlParserHelperV46;
import org.apache.ibatis.plugin.Interceptor; import org.apache.ibatis.plugin.Interceptor;
@ -42,7 +42,7 @@ public class Adapter33x implements IAdapter {
@Override @Override
public String mpjMapping(TableFieldInfo tableFieldInfo) { public String mpjMapping(TableFieldInfo tableFieldInfo) {
String el = tableFieldInfo.getEl(); 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 el.substring(el.indexOf(StringPool.COMMA) + 1);
} }
return null; return null;
@ -56,8 +56,8 @@ public class Adapter33x implements IAdapter {
@Override @Override
public boolean mpjHasPK(TableInfo tableInfo) { public boolean mpjHasPK(TableInfo tableInfo) {
return StringUtils.isNotBlank(tableInfo.getKeyProperty()) || return CharSequenceUtils.isNotBlank(tableInfo.getKeyProperty()) ||
StringUtils.isNotBlank(tableInfo.getKeyColumn()); CharSequenceUtils.isNotBlank(tableInfo.getKeyColumn());
} }
@Override @Override

View File

@ -3,7 +3,6 @@ package com.github.yulichang.adapter.v3431;
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.StringPool; 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.IAdapter;
import com.github.yulichang.adapter.base.metadata.OrderFieldInfo; import com.github.yulichang.adapter.base.metadata.OrderFieldInfo;
import com.github.yulichang.adapter.base.tookit.VersionUtils; import com.github.yulichang.adapter.base.tookit.VersionUtils;
@ -34,7 +33,7 @@ public class Adapter3431 implements IAdapter {
public String mpjMapping(TableFieldInfo tableFieldInfo) { public String mpjMapping(TableFieldInfo tableFieldInfo) {
if (v) { if (v) {
String el = tableFieldInfo.getEl(); 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 el.substring(el.indexOf(StringPool.COMMA) + 1);
} }
return null; return null;

View File

@ -14,6 +14,7 @@
<modules> <modules>
<module>mybatis-plus-join-adapter-base</module> <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-v33x</module>
<module>mybatis-plus-join-adapter-v3431</module> <module>mybatis-plus-join-adapter-v3431</module>
<module>mybatis-plus-join-adapter-v352</module> <module>mybatis-plus-join-adapter-v352</module>

View File

@ -1,6 +1,5 @@
package com.github.yulichang.autoconfigure; package com.github.yulichang.autoconfigure;
import com.baomidou.mybatisplus.autoconfigure.MybatisPlusLanguageDriverAutoConfiguration;
import com.baomidou.mybatisplus.core.injector.ISqlInjector; import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.github.yulichang.autoconfigure.conditional.JoinSqlInjectorCondition; import com.github.yulichang.autoconfigure.conditional.JoinSqlInjectorCondition;
import com.github.yulichang.autoconfigure.consumer.MybatisPlusJoinIfExistsConsumer; import com.github.yulichang.autoconfigure.consumer.MybatisPlusJoinIfExistsConsumer;
@ -54,7 +53,7 @@ import java.util.Optional;
@ConditionalOnClass({SqlSessionFactory.class, SqlSessionFactoryBean.class}) @ConditionalOnClass({SqlSessionFactory.class, SqlSessionFactoryBean.class})
@ConditionalOnSingleCandidate(DataSource.class) @ConditionalOnSingleCandidate(DataSource.class)
@EnableConfigurationProperties(MybatisPlusJoinProperties.class) @EnableConfigurationProperties(MybatisPlusJoinProperties.class)
@AutoConfigureAfter({DataSourceAutoConfiguration.class, MybatisPlusLanguageDriverAutoConfiguration.class}) @AutoConfigureAfter(DataSourceAutoConfiguration.class)
public class MybatisPlusJoinAutoConfiguration { public class MybatisPlusJoinAutoConfiguration {
private static final Logger logger = LoggerFactory.getLogger(MybatisPlusJoinAutoConfiguration.class); private static final Logger logger = LoggerFactory.getLogger(MybatisPlusJoinAutoConfiguration.class);

View File

@ -39,6 +39,11 @@
<artifactId>mybatis-plus-join-annotation</artifactId> <artifactId>mybatis-plus-join-annotation</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-adapter-v320</artifactId>
<version>${revision}</version>
</dependency>
<dependency> <dependency>
<groupId>com.github.yulichang</groupId> <groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-adapter-v33x</artifactId> <artifactId>mybatis-plus-join-adapter-v33x</artifactId>

View File

@ -3,6 +3,7 @@ package com.github.yulichang.adapter;
import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils; import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
import com.github.yulichang.adapter.base.IAdapter; import com.github.yulichang.adapter.base.IAdapter;
import com.github.yulichang.adapter.base.tookit.VersionUtils; 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.v33x.Adapter33x;
import com.github.yulichang.adapter.v3431.Adapter3431; import com.github.yulichang.adapter.v3431.Adapter3431;
import com.github.yulichang.adapter.v355.Adapter355; import com.github.yulichang.adapter.v355.Adapter355;
@ -21,7 +22,7 @@ public class AdapterHelper {
static { static {
String lastAdapter = "3.5.8"; String lastAdapter = "3.5.9";
String version = Optional.ofNullable(VersionUtils.getVersion()).orElse(lastAdapter); String version = Optional.ofNullable(VersionUtils.getVersion()).orElse(lastAdapter);
if (VersionUtils.compare(version, "3.5.6") >= 0) { if (VersionUtils.compare(version, "3.5.6") >= 0) {
@ -32,8 +33,10 @@ public class AdapterHelper {
adapter = new Adapter3431(); adapter = new Adapter3431();
} else if (VersionUtils.compare(version, "3.3.0") >= 0) { } else if (VersionUtils.compare(version, "3.3.0") >= 0) {
adapter = new Adapter33x(); adapter = new Adapter33x();
} else if (VersionUtils.compare(version, "3.2.0") >= 0) {
adapter = new Adapter320();
} else { } else {
throw ExceptionUtils.mpe("MPJ需要MP版本3.3.0+当前MP版本%s", version); throw ExceptionUtils.mpe("MPJ需要MP版本3.2.0+当前MP版本%s", version);
} }
} }

View File

@ -1,6 +1,6 @@
package com.github.yulichang.config.enums; 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 com.github.yulichang.wrapper.interfaces.MPredicate;
import java.io.Serializable; import java.io.Serializable;
@ -21,11 +21,11 @@ public enum IfExistsEnum implements MPredicate<Object>, Serializable {
/** /**
* 非空字符串 "" -> false, " " -> true ... * 非空字符串 "" -> 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 非空白字符串 "" -> 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; private final MPredicate<Object> predicate;

View File

@ -6,18 +6,14 @@ import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.adapter.AdapterHelper; 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.ConfigProperties;
import com.github.yulichang.config.enums.LogicDelTypeEnum; import com.github.yulichang.config.enums.LogicDelTypeEnum;
import com.github.yulichang.extension.apt.interfaces.QueryJoin; import com.github.yulichang.extension.apt.interfaces.QueryJoin;
import com.github.yulichang.toolkit.Constant; import com.github.yulichang.extension.apt.matedata.BaseColumn;
import com.github.yulichang.toolkit.LogicInfoUtils; import com.github.yulichang.extension.apt.matedata.Column;
import com.github.yulichang.toolkit.TableHelper; import com.github.yulichang.toolkit.*;
import com.github.yulichang.toolkit.TableMap;
import com.github.yulichang.toolkit.support.ColumnCache; import com.github.yulichang.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.interfaces.MFunction; import com.github.yulichang.wrapper.interfaces.MFunction;
import com.github.yulichang.wrapper.segments.PageInfo; import com.github.yulichang.wrapper.segments.PageInfo;
@ -124,7 +120,7 @@ public abstract class AptAbstractWrapper<T, Children extends AptAbstractWrapper<
* 构造方法 * 构造方法
*/ */
protected AptAbstractWrapper(BaseColumn<T> baseColumn) { 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()); setEntityClass(baseColumn.getColumnClass());
this.baseColumn = baseColumn; this.baseColumn = baseColumn;
initNeed(); initNeed();
@ -136,7 +132,7 @@ public abstract class AptAbstractWrapper<T, Children extends AptAbstractWrapper<
* @param entity 主表实体类 * @param entity 主表实体类
*/ */
protected AptAbstractWrapper(BaseColumn<T> baseColumn, T 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); setEntity(entity);
this.baseColumn = baseColumn; this.baseColumn = baseColumn;
initNeed(); initNeed();
@ -310,10 +306,10 @@ public abstract class AptAbstractWrapper<T, Children extends AptAbstractWrapper<
* 获取连表部分语句 * 获取连表部分语句
*/ */
public String getFrom() { public String getFrom() {
if (StringUtils.isBlank(from.getStringValue())) { if (StrUtils.isBlank(from.getStringValue())) {
StringBuilder value = new StringBuilder(); StringBuilder value = new StringBuilder();
for (Children wrapper : onWrappers) { for (Children wrapper : onWrappers) {
if (StringUtils.isBlank(wrapper.from.getStringValue())) { if (StrUtils.isBlank(wrapper.from.getStringValue())) {
if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) { if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) {
TableInfo tableInfo = TableHelper.getAssert(wrapper.getJoinClass()); TableInfo tableInfo = TableHelper.getAssert(wrapper.getJoinClass());
if (AdapterHelper.getAdapter().mpjHasLogic(tableInfo)) { 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()); Children instance = instance(newIndex, keyWord, baseColumn.getColumnClass(), info.getTableName());
instance.isMain = false; instance.isMain = false;
onWrappers.add(instance); onWrappers.add(instance);
if (StringUtils.isBlank(baseColumn.getAlias())) { if (StrUtils.isBlank(baseColumn.getAlias())) {
aptIndex.put(baseColumn, subTableAlias + newIndex); aptIndex.put(baseColumn, subTableAlias + newIndex);
instance.alias = subTableAlias; instance.alias = subTableAlias;
instance.hasAlias = false; instance.hasAlias = false;
@ -410,7 +406,7 @@ public abstract class AptAbstractWrapper<T, Children extends AptAbstractWrapper<
*/ */
public boolean isUseAnnotationOrderBy() { public boolean isUseAnnotationOrderBy() {
final String _sqlSegment = this.getSqlSegment(); final String _sqlSegment = this.getSqlSegment();
if (StringUtils.isBlank(_sqlSegment)) { if (StrUtils.isBlank(_sqlSegment)) {
return true; return true;
} }
final String _sqlSegmentToUpperCase = _sqlSegment.toUpperCase(); final String _sqlSegmentToUpperCase = _sqlSegment.toUpperCase();

View File

@ -14,6 +14,7 @@ import com.github.yulichang.extension.apt.toolkit.AptWrapperUtils;
import com.github.yulichang.extension.apt.toolkit.AptWrappers; import com.github.yulichang.extension.apt.toolkit.AptWrappers;
import com.github.yulichang.toolkit.Constant; import com.github.yulichang.toolkit.Constant;
import com.github.yulichang.toolkit.LambdaUtils; import com.github.yulichang.toolkit.LambdaUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.TableMap; import com.github.yulichang.toolkit.TableMap;
import com.github.yulichang.toolkit.support.ColumnCache; import com.github.yulichang.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum; import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
@ -291,7 +292,7 @@ public class AptQueryWrapper<T> extends AptAbstractWrapper<T, AptQueryWrapper<T>
*/ */
@Override @Override
public String getSqlSelect() { 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 -> { String s = selectColumns.stream().map(i -> {
if (i.isStr()) { if (i.isStr()) {
return i.getColumn(); return i.getColumn();

View File

@ -19,6 +19,7 @@ import com.github.yulichang.extension.apt.interfaces.OnCompare;
import com.github.yulichang.extension.apt.matedata.Column; import com.github.yulichang.extension.apt.matedata.Column;
import com.github.yulichang.toolkit.LambdaUtils; import com.github.yulichang.toolkit.LambdaUtils;
import com.github.yulichang.toolkit.MPJSqlInjectionUtils; import com.github.yulichang.toolkit.MPJSqlInjectionUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.Ref; import com.github.yulichang.toolkit.Ref;
import com.github.yulichang.toolkit.sql.SqlScriptUtils; import com.github.yulichang.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum; import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
@ -170,7 +171,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
/** /**
* 设置 IfExists * 设置 IfExists
* .IfExists(val -> val != null && StringUtils.isNotBlank(val)) * .IfExists(val -> val != null && StrUtils.isNotBlank(val))
* *
* @param IfExists 判断 * @param IfExists 判断
* @return Children * @return Children
@ -579,7 +580,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
*/ */
@SuppressWarnings("SameParameterValue") @SuppressWarnings("SameParameterValue")
protected final String formatSqlMaybeWithParam(String sqlStr, String mapping, Object... params) { protected final String formatSqlMaybeWithParam(String sqlStr, String mapping, Object... params) {
if (StringUtils.isBlank(sqlStr)) { if (StrUtils.isBlank(sqlStr)) {
// todo 何时会这样? // todo 何时会这样?
return null; return null;
} }
@ -678,7 +679,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
@Override @Override
public String getSqlComment() { public String getSqlComment() {
if (StringUtils.isNotBlank(sqlComment.getStringValue())) { if (StrUtils.isNotBlank(sqlComment.getStringValue())) {
return "/*" + StringEscape.escapeRawString(sqlComment.getStringValue()) + "*/"; return "/*" + StringEscape.escapeRawString(sqlComment.getStringValue()) + "*/";
} }
return null; return null;
@ -686,7 +687,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
@Override @Override
public String getSqlFirst() { public String getSqlFirst() {
if (StringUtils.isNotBlank(sqlFirst.getStringValue())) { if (StrUtils.isNotBlank(sqlFirst.getStringValue())) {
return StringEscape.escapeRawString(sqlFirst.getStringValue()); return StringEscape.escapeRawString(sqlFirst.getStringValue());
} }
return null; 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) { public <V> Children allEqStr(boolean condition, Map<String, V> params, boolean null2IsNull) {
if (condition && CollectionUtils.isNotEmpty(params)) { if (condition && CollectionUtils.isNotEmpty(params)) {
params.forEach((k, v) -> { params.forEach((k, v) -> {
if (StringUtils.checkValNotNull(v)) { if (StrUtils.checkValNotNull(v)) {
eq(k, v); eq(k, v);
} else { } else {
if (null2IsNull) { if (null2IsNull) {
@ -880,7 +881,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
if (condition && CollectionUtils.isNotEmpty(params)) { if (condition && CollectionUtils.isNotEmpty(params)) {
params.forEach((k, v) -> { params.forEach((k, v) -> {
if (filter.test(k, v)) { if (filter.test(k, v)) {
if (StringUtils.checkValNotNull(v)) { if (StrUtils.checkValNotNull(v)) {
eq(k, v); eq(k, v);
} else { } else {
if (null2IsNull) { if (null2IsNull) {

View File

@ -1,10 +1,10 @@
package com.github.yulichang.extension.apt.resultmap; package com.github.yulichang.extension.apt.resultmap;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.extension.apt.matedata.BaseColumn; import com.github.yulichang.extension.apt.matedata.BaseColumn;
import com.github.yulichang.extension.apt.matedata.Column; import com.github.yulichang.extension.apt.matedata.Column;
import com.github.yulichang.toolkit.LambdaUtils; import com.github.yulichang.toolkit.LambdaUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.support.ColumnCache; import com.github.yulichang.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.resultmap.IResult; import com.github.yulichang.wrapper.resultmap.IResult;
import com.github.yulichang.wrapper.segments.SelectCache; import com.github.yulichang.wrapper.segments.SelectCache;
@ -93,7 +93,7 @@ public class Result implements IResult {
SelectCache normal = normalMap.get(column.getProperty()); SelectCache normal = normalMap.get(column.getProperty());
result.selectNormal = normal; result.selectNormal = normal;
result.column = column; result.column = column;
if (StringUtils.isBlank(result.property)) { if (StrUtils.isBlank(result.property)) {
result.property = normal.getColumProperty(); result.property = normal.getColumProperty();
} }
if (Objects.isNull(result.javaType)) { if (Objects.isNull(result.javaType)) {

View File

@ -4,12 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; 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.AdapterHelper;
import com.github.yulichang.extension.apt.AptQueryWrapper;
import com.github.yulichang.toolkit.LogicInfoUtils; import com.github.yulichang.toolkit.LogicInfoUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.TableHelper; import com.github.yulichang.toolkit.TableHelper;
import com.github.yulichang.toolkit.sql.SqlScriptUtils; import com.github.yulichang.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.extension.apt.AptQueryWrapper;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
@ -26,18 +26,18 @@ public class AptWrapperUtils {
String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY); String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
boolean hasWhere = false; boolean hasWhere = false;
String entityWhere = getEntitySql(tableInfo, wrapper); String entityWhere = getEntitySql(tableInfo, wrapper);
if (StringUtils.isNotBlank(entityWhere)) { if (StrUtils.isNotBlank(entityWhere)) {
hasWhere = true; hasWhere = true;
} }
String mainLogic = mainLogic(hasWhere, clazz, wrapper); String mainLogic = mainLogic(hasWhere, clazz, wrapper);
if (StringUtils.isNotBlank(mainLogic)) { if (StrUtils.isNotBlank(mainLogic)) {
hasWhere = true; hasWhere = true;
} }
String subLogic = subLogic(hasWhere, wrapper); String subLogic = subLogic(hasWhere, wrapper);
if (StringUtils.isNotBlank(subLogic)) { if (StrUtils.isNotBlank(subLogic)) {
hasWhere = true; 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; ((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(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); String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
boolean hasWhere = false; boolean hasWhere = false;
String entityWhere = getEntitySql(tableInfo, wrapper); String entityWhere = getEntitySql(tableInfo, wrapper);
if (StringUtils.isNotBlank(entityWhere)) { if (StrUtils.isNotBlank(entityWhere)) {
hasWhere = true; hasWhere = true;
} }
String mainLogic = mainLogic(hasWhere, clazz, wrapper); String mainLogic = mainLogic(hasWhere, clazz, wrapper);
if (StringUtils.isNotBlank(mainLogic)) { if (StrUtils.isNotBlank(mainLogic)) {
hasWhere = true; hasWhere = true;
} }
String subLogic = subLogic(hasWhere, wrapper); String subLogic = subLogic(hasWhere, wrapper);
if (StringUtils.isNotBlank(subLogic)) { if (StrUtils.isNotBlank(subLogic)) {
hasWhere = true; 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; ((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY); String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
@ -129,7 +129,7 @@ public class AptWrapperUtils {
return StringPool.EMPTY; return StringPool.EMPTY;
} }
String info = LogicInfoUtils.getLogicInfo(null, clazz, true, wrapper.getAlias()); String info = LogicInfoUtils.getLogicInfo(null, clazz, true, wrapper.getAlias());
if (StringUtils.isNotBlank(info)) { if (StrUtils.isNotBlank(info)) {
if (hasWhere) { if (hasWhere) {
return " AND " + info; return " AND " + info;
} }
@ -140,7 +140,7 @@ public class AptWrapperUtils {
private static String subLogic(boolean hasWhere, AptQueryWrapper<?> wrapper) { private static String subLogic(boolean hasWhere, AptQueryWrapper<?> wrapper) {
String sql = wrapper.getSubLogicSql(); String sql = wrapper.getSubLogicSql();
if (StringUtils.isNotBlank(sql)) { if (StrUtils.isNotBlank(sql)) {
if (hasWhere) { if (hasWhere) {
return sql; return sql;
} }

View File

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; 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.AdapterHelper;
import com.github.yulichang.config.ConfigProperties; import com.github.yulichang.config.ConfigProperties;
import com.github.yulichang.config.enums.LogicDelTypeEnum; import com.github.yulichang.config.enums.LogicDelTypeEnum;
@ -363,10 +362,10 @@ public abstract class KtAbstractLambdaWrapper<T, Children extends KtAbstractLamb
* 获取连表部分语句 * 获取连表部分语句
*/ */
public String getFrom() { public String getFrom() {
if (StringUtils.isBlank(from.getStringValue())) { if (StrUtils.isBlank(from.getStringValue())) {
StringBuilder value = new StringBuilder(); StringBuilder value = new StringBuilder();
for (Children wrapper : onWrappers) { for (Children wrapper : onWrappers) {
if (StringUtils.isBlank(wrapper.from.getStringValue())) { if (StrUtils.isBlank(wrapper.from.getStringValue())) {
if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) { if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) {
TableInfo tableInfo = TableHelper.getAssert(wrapper.getJoinClass()); TableInfo tableInfo = TableHelper.getAssert(wrapper.getJoinClass());
if (AdapterHelper.getAdapter().mpjHasLogic(tableInfo)) { if (AdapterHelper.getAdapter().mpjHasLogic(tableInfo)) {
@ -408,7 +407,7 @@ public abstract class KtAbstractLambdaWrapper<T, Children extends KtAbstractLamb
instance.isNo = true; instance.isNo = true;
instance.isMain = false; instance.isMain = false;
onWrappers.add(instance); onWrappers.add(instance);
if (StringUtils.isBlank(tableAlias)) { if (StrUtils.isBlank(tableAlias)) {
tableList.put(oldIndex, clazz, false, subTableAlias, newIndex); tableList.put(oldIndex, clazz, false, subTableAlias, newIndex);
instance.alias = subTableAlias; instance.alias = subTableAlias;
instance.hasAlias = false; instance.hasAlias = false;
@ -453,7 +452,7 @@ public abstract class KtAbstractLambdaWrapper<T, Children extends KtAbstractLamb
*/ */
public boolean isUseAnnotationOrderBy() { public boolean isUseAnnotationOrderBy() {
final String _sqlSegment = this.getSqlSegment(); final String _sqlSegment = this.getSqlSegment();
if (StringUtils.isBlank(_sqlSegment)) { if (StrUtils.isBlank(_sqlSegment)) {
return true; return true;
} }
final String _sqlSegmentToUpperCase = _sqlSegment.toUpperCase(); final String _sqlSegmentToUpperCase = _sqlSegment.toUpperCase();

View File

@ -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.Func;
import com.github.yulichang.extension.kt.interfaces.OnCompare; import com.github.yulichang.extension.kt.interfaces.OnCompare;
import com.github.yulichang.extension.kt.segments.FuncArgs; import com.github.yulichang.extension.kt.segments.FuncArgs;
import com.github.yulichang.toolkit.KtUtils; import com.github.yulichang.toolkit.*;
import com.github.yulichang.toolkit.MPJSqlInjectionUtils;
import com.github.yulichang.toolkit.Ref;
import com.github.yulichang.toolkit.TableList;
import com.github.yulichang.toolkit.sql.SqlScriptUtils; import com.github.yulichang.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum; import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
import com.github.yulichang.wrapper.enums.PrefixEnum; 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) { public Children allEq(boolean condition, Map<KProperty<?>, ?> params, boolean null2IsNull) {
if (condition && CollectionUtils.isNotEmpty(params)) { if (condition && CollectionUtils.isNotEmpty(params)) {
params.forEach((k, v) -> { params.forEach((k, v) -> {
if (StringUtils.checkValNotNull(v)) { if (StrUtils.checkValNotNull(v)) {
eq(k, v); eq(k, v);
} else { } else {
if (null2IsNull) { if (null2IsNull) {
@ -601,7 +598,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
*/ */
@SuppressWarnings("SameParameterValue") @SuppressWarnings("SameParameterValue")
protected final String formatSqlMaybeWithParam(String sqlStr, String mapping, Object... params) { protected final String formatSqlMaybeWithParam(String sqlStr, String mapping, Object... params) {
if (StringUtils.isBlank(sqlStr)) { if (StrUtils.isBlank(sqlStr)) {
// todo 何时会这样? // todo 何时会这样?
return null; return null;
} }
@ -703,7 +700,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
@Override @Override
public String getSqlComment() { public String getSqlComment() {
if (StringUtils.isNotBlank(sqlComment.getStringValue())) { if (StrUtils.isNotBlank(sqlComment.getStringValue())) {
return "/*" + StringEscape.escapeRawString(sqlComment.getStringValue()) + "*/"; return "/*" + StringEscape.escapeRawString(sqlComment.getStringValue()) + "*/";
} }
return null; return null;
@ -711,7 +708,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
@Override @Override
public String getSqlFirst() { public String getSqlFirst() {
if (StringUtils.isNotBlank(sqlFirst.getStringValue())) { if (StrUtils.isNotBlank(sqlFirst.getStringValue())) {
return StringEscape.escapeRawString(sqlFirst.getStringValue()); return StringEscape.escapeRawString(sqlFirst.getStringValue());
} }
return null; 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) { public <V> Children allEqStr(boolean condition, Map<String, V> params, boolean null2IsNull) {
if (condition && CollectionUtils.isNotEmpty(params)) { if (condition && CollectionUtils.isNotEmpty(params)) {
params.forEach((k, v) -> { params.forEach((k, v) -> {
if (StringUtils.checkValNotNull(v)) { if (StrUtils.checkValNotNull(v)) {
eq(k, v); eq(k, v);
} else { } else {
if (null2IsNull) { if (null2IsNull) {
@ -856,7 +853,7 @@ public abstract class KtAbstractWrapper<T, Children extends KtAbstractWrapper<T,
if (condition && CollectionUtils.isNotEmpty(params)) { if (condition && CollectionUtils.isNotEmpty(params)) {
params.forEach((k, v) -> { params.forEach((k, v) -> {
if (filter.test(k, v)) { if (filter.test(k, v)) {
if (StringUtils.checkValNotNull(v)) { if (StrUtils.checkValNotNull(v)) {
eq(k, v); eq(k, v);
} else { } else {
if (null2IsNull) { if (null2IsNull) {

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.*; import com.baomidou.mybatisplus.core.toolkit.*;
import com.github.yulichang.adapter.AdapterHelper; import com.github.yulichang.adapter.AdapterHelper;
import com.github.yulichang.toolkit.LogicInfoUtils; import com.github.yulichang.toolkit.LogicInfoUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.TableHelper; import com.github.yulichang.toolkit.TableHelper;
import com.github.yulichang.toolkit.TableList; import com.github.yulichang.toolkit.TableList;
import com.github.yulichang.wrapper.interfaces.DeleteChain; import com.github.yulichang.wrapper.interfaces.DeleteChain;
@ -71,7 +72,7 @@ public class KtDeleteJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtDeleteJ
*/ */
@Override @Override
public String getDeleteSql() { public String getDeleteSql() {
if (StringUtils.isNotBlank(this.deleteSql.getStringValue())) { if (StrUtils.isNotBlank(this.deleteSql.getStringValue())) {
return this.deleteSql.getStringValue(); return this.deleteSql.getStringValue();
} }
String delete = null; String delete = null;
@ -89,7 +90,7 @@ public class KtDeleteJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtDeleteJ
if (CollectionUtils.isNotEmpty(deleteTableName)) { if (CollectionUtils.isNotEmpty(deleteTableName)) {
delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName); delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName);
} }
if (StringUtils.isBlank(delete)) { if (StrUtils.isBlank(delete)) {
delete = this.alias; delete = this.alias;
} }
deleteSql.setStringValue(delete); deleteSql.setStringValue(delete);
@ -101,7 +102,7 @@ public class KtDeleteJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtDeleteJ
*/ */
@Override @Override
public String getDeleteLogicSql() { public String getDeleteLogicSql() {
if (StringUtils.isNotBlank(this.deleteSql.getStringValue())) { if (StrUtils.isNotBlank(this.deleteSql.getStringValue())) {
return this.deleteSql.getStringValue(); return this.deleteSql.getStringValue();
} }
String delete = null; String delete = null;
@ -119,7 +120,7 @@ public class KtDeleteJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtDeleteJ
if (CollectionUtils.isNotEmpty(deleteTableName)) { if (CollectionUtils.isNotEmpty(deleteTableName)) {
delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName); delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName);
} }
if (StringUtils.isNotBlank(delete)) { if (StrUtils.isNotBlank(delete)) {
delete = StringPool.COMMA + delete; delete = StringPool.COMMA + delete;
} else { } else {
delete = StringPool.EMPTY; delete = StringPool.EMPTY;

View File

@ -12,6 +12,7 @@ import com.github.yulichang.extension.kt.toolkit.KtWrapperUtils;
import com.github.yulichang.extension.kt.toolkit.KtWrappers; import com.github.yulichang.extension.kt.toolkit.KtWrappers;
import com.github.yulichang.toolkit.Constant; import com.github.yulichang.toolkit.Constant;
import com.github.yulichang.toolkit.KtUtils; import com.github.yulichang.toolkit.KtUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.TableList; import com.github.yulichang.toolkit.TableList;
import com.github.yulichang.toolkit.support.ColumnCache; import com.github.yulichang.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.interfaces.Chain; import com.github.yulichang.wrapper.interfaces.Chain;
@ -363,7 +364,7 @@ public class KtLambdaWrapper<T> extends KtAbstractLambdaWrapper<T, KtLambdaWrapp
*/ */
@Override @Override
public String getSqlSelect() { 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 -> { String s = selectColumns.stream().map(i -> {
if (i.isStr()) { if (i.isStr()) {
return i.getColumn(); return i.getColumn();

View File

@ -7,11 +7,8 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.*; import com.baomidou.mybatisplus.core.toolkit.*;
import com.github.yulichang.adapter.AdapterHelper; import com.github.yulichang.adapter.AdapterHelper;
import com.github.yulichang.extension.kt.interfaces.Update; import com.github.yulichang.extension.kt.interfaces.Update;
import com.github.yulichang.toolkit.Constant; import com.github.yulichang.toolkit.*;
import com.github.yulichang.toolkit.KtUtils;
import com.github.yulichang.toolkit.ReflectionKit; 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 com.github.yulichang.wrapper.interfaces.UpdateChain;
import kotlin.reflect.KProperty; import kotlin.reflect.KProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -142,7 +139,7 @@ public class KtUpdateJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtUpdateJ
@Override @Override
public KtUpdateJoinWrapper<T> setSql(boolean condition, String sql) { public KtUpdateJoinWrapper<T> setSql(boolean condition, String sql) {
if (condition && StringUtils.isNotBlank(sql)) { if (condition && StrUtils.isNotBlank(sql)) {
if (Objects.isNull(sqlSet)) { if (Objects.isNull(sqlSet)) {
sqlSet = new ArrayList<>(); sqlSet = new ArrayList<>();
} }
@ -153,7 +150,7 @@ public class KtUpdateJoinWrapper<T> extends KtAbstractLambdaWrapper<T, KtUpdateJ
@Override @Override
public String getSqlSet() { public String getSqlSet() {
if (StringUtils.isNotBlank(sqlSetStr.getStringValue())) { if (StrUtils.isNotBlank(sqlSetStr.getStringValue())) {
return sqlSetStr.getStringValue(); return sqlSetStr.getStringValue();
} }
StringBuilder set = new StringBuilder(StringPool.EMPTY); StringBuilder set = new StringBuilder(StringPool.EMPTY);

View File

@ -1,11 +1,11 @@
package com.github.yulichang.extension.kt.interfaces; package com.github.yulichang.extension.kt.interfaces;
import com.baomidou.mybatisplus.core.toolkit.Assert; 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.MybatisLabel;
import com.github.yulichang.extension.kt.resultmap.MybatisLabelFree; import com.github.yulichang.extension.kt.resultmap.MybatisLabelFree;
import com.github.yulichang.toolkit.KtUtils; import com.github.yulichang.toolkit.KtUtils;
import com.github.yulichang.toolkit.MPJReflectionKit; import com.github.yulichang.toolkit.MPJReflectionKit;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.support.FieldCache; import com.github.yulichang.toolkit.support.FieldCache;
import com.github.yulichang.wrapper.interfaces.MFunction; import com.github.yulichang.wrapper.interfaces.MFunction;
import com.github.yulichang.wrapper.resultmap.Label; import com.github.yulichang.wrapper.resultmap.Label;
@ -137,7 +137,7 @@ public interface QueryLabel<Children> {
FieldCache field = fieldMap.get(dtoFieldName); FieldCache field = fieldMap.get(dtoFieldName);
Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类"); Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类");
MybatisLabel.Builder<?, ?> builder; 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); dtoFieldName, child, field.getType(), (Class<?>) field.getType(), true);
addLabel(builder.build(), false); addLabel(builder.build(), false);
return getChildren(); return getChildren();
@ -169,7 +169,7 @@ public interface QueryLabel<Children> {
String dtoFieldName = dtoField.getName(); String dtoFieldName = dtoField.getName();
FieldCache field = MPJReflectionKit.getFieldMap(KtUtils.ref(dtoField)).get(dtoFieldName); FieldCache field = MPJReflectionKit.getFieldMap(KtUtils.ref(dtoField)).get(dtoFieldName);
Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类"); 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); dtoFieldName, child, field.getType(), (Class<?>) field.getType(), false);
MybatisLabel.Builder<?, ?> cfBuilder = collection.apply(builder); MybatisLabel.Builder<?, ?> cfBuilder = collection.apply(builder);
addLabel(cfBuilder.build(), false); addLabel(cfBuilder.build(), false);

View File

@ -1,7 +1,7 @@
package com.github.yulichang.extension.kt.resultmap; 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.KtUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.support.ColumnCache; import com.github.yulichang.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.resultmap.IResult; import com.github.yulichang.wrapper.resultmap.IResult;
import com.github.yulichang.wrapper.segments.SelectCache; import com.github.yulichang.wrapper.segments.SelectCache;
@ -71,7 +71,7 @@ public class Result implements IResult {
String name = column.getName(); String name = column.getName();
SelectCache normal = normalMap.get(name); SelectCache normal = normalMap.get(name);
result.selectNormal = normal; result.selectNormal = normal;
if (StringUtils.isBlank(result.property)) { if (StrUtils.isBlank(result.property)) {
result.property = normal.getColumProperty(); result.property = normal.getColumProperty();
} }
if (Objects.isNull(result.javaType)) { if (Objects.isNull(result.javaType)) {

View File

@ -4,10 +4,10 @@ import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; 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.AdapterHelper;
import com.github.yulichang.extension.kt.KtLambdaWrapper; import com.github.yulichang.extension.kt.KtLambdaWrapper;
import com.github.yulichang.toolkit.LogicInfoUtils; import com.github.yulichang.toolkit.LogicInfoUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.TableHelper; import com.github.yulichang.toolkit.TableHelper;
import com.github.yulichang.toolkit.sql.SqlScriptUtils; import com.github.yulichang.toolkit.sql.SqlScriptUtils;
@ -26,18 +26,18 @@ public class KtWrapperUtils {
String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY); String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
boolean hasWhere = false; boolean hasWhere = false;
String entityWhere = getEntitySql(tableInfo, wrapper); String entityWhere = getEntitySql(tableInfo, wrapper);
if (StringUtils.isNotBlank(entityWhere)) { if (StrUtils.isNotBlank(entityWhere)) {
hasWhere = true; hasWhere = true;
} }
String mainLogic = mainLogic(hasWhere, clazz, wrapper); String mainLogic = mainLogic(hasWhere, clazz, wrapper);
if (StringUtils.isNotBlank(mainLogic)) { if (StrUtils.isNotBlank(mainLogic)) {
hasWhere = true; hasWhere = true;
} }
String subLogic = subLogic(hasWhere, wrapper); String subLogic = subLogic(hasWhere, wrapper);
if (StringUtils.isNotBlank(subLogic)) { if (StrUtils.isNotBlank(subLogic)) {
hasWhere = true; 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; ((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(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); String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
boolean hasWhere = false; boolean hasWhere = false;
String entityWhere = getEntitySql(tableInfo, wrapper); String entityWhere = getEntitySql(tableInfo, wrapper);
if (StringUtils.isNotBlank(entityWhere)) { if (StrUtils.isNotBlank(entityWhere)) {
hasWhere = true; hasWhere = true;
} }
String mainLogic = mainLogic(hasWhere, clazz, wrapper); String mainLogic = mainLogic(hasWhere, clazz, wrapper);
if (StringUtils.isNotBlank(mainLogic)) { if (StrUtils.isNotBlank(mainLogic)) {
hasWhere = true; hasWhere = true;
} }
String subLogic = subLogic(hasWhere, wrapper); String subLogic = subLogic(hasWhere, wrapper);
if (StringUtils.isNotBlank(subLogic)) { if (StrUtils.isNotBlank(subLogic)) {
hasWhere = true; 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; ((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY); String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
@ -128,7 +128,7 @@ public class KtWrapperUtils {
return StringPool.EMPTY; return StringPool.EMPTY;
} }
String info = LogicInfoUtils.getLogicInfo(null, clazz, true, wrapper.getAlias()); String info = LogicInfoUtils.getLogicInfo(null, clazz, true, wrapper.getAlias());
if (StringUtils.isNotBlank(info)) { if (StrUtils.isNotBlank(info)) {
if (hasWhere) { if (hasWhere) {
return " AND " + info; return " AND " + info;
} }
@ -139,7 +139,7 @@ public class KtWrapperUtils {
private static String subLogic(boolean hasWhere, KtLambdaWrapper<?> wrapper) { private static String subLogic(boolean hasWhere, KtLambdaWrapper<?> wrapper) {
String sql = wrapper.getSubLogicSql(); String sql = wrapper.getSubLogicSql();
if (StringUtils.isNotBlank(sql)) { if (StrUtils.isNotBlank(sql)) {
if (hasWhere) { if (hasWhere) {
return sql; return sql;
} }

View File

@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; 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.AdapterHelper;
import com.github.yulichang.adapter.base.tookit.VersionUtils; import com.github.yulichang.adapter.base.tookit.VersionUtils;
import com.github.yulichang.config.ConfigProperties; import com.github.yulichang.config.ConfigProperties;
@ -167,7 +166,7 @@ public class MPJInterceptor implements Interceptor {
} }
} else { } else {
FieldCache field = fieldMap.get(i.getColumProperty()); FieldCache field = fieldMap.get(i.getColumProperty());
if (StringUtils.isNotBlank(i.getTagColumn())) { if (StrUtils.isNotBlank(i.getTagColumn())) {
columnSet.add(i.getTagColumn()); columnSet.add(i.getTagColumn());
if (Objects.nonNull(field)) { if (Objects.nonNull(field)) {
ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), i.getColumProperty(), ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), i.getColumProperty(),
@ -176,7 +175,7 @@ public class MPJInterceptor implements Interceptor {
} }
} else if (wrapper.isResultMap()) { } else if (wrapper.isResultMap()) {
AdapterHelper.getAdapter().parserColum(wrapper.getAlias(), wrapper.getFrom(), i.getColumn(), col -> { 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); FieldCache strField = fieldMap.get(tagCol);
columnSet.add(tagCol); columnSet.add(tagCol);
if (Objects.nonNull(strField)) { if (Objects.nonNull(strField)) {
@ -240,10 +239,10 @@ public class MPJInterceptor implements Interceptor {
String index = r.getIndex(); String index = r.getIndex();
if (columnSet.contains(columnName)) { if (columnSet.contains(columnName)) {
columnName = getColumn(columnSet, columnName, 0); 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 { } else {
columnSet.add(columnName); 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); columnList.add(label);
ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), r.getProperty(), columnName, r.getJavaType()); ResultMapping.Builder builder = new ResultMapping.Builder(ms.getConfiguration(), r.getProperty(), columnName, r.getJavaType());

View File

@ -6,11 +6,11 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.adapter.AdapterHelper; import com.github.yulichang.adapter.AdapterHelper;
import com.github.yulichang.adapter.base.metadata.OrderFieldInfo; import com.github.yulichang.adapter.base.metadata.OrderFieldInfo;
import com.github.yulichang.config.ConfigProperties; import com.github.yulichang.config.ConfigProperties;
import com.github.yulichang.toolkit.StrUtils;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -102,7 +102,7 @@ public interface MPJBaseMethod extends Constants {
return true; return true;
}) })
.map(i -> getSqlWhere(i, newPrefix)).filter(Objects::nonNull).collect(joining(NEWLINE)); .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; return filedSqlScript;
} }
String newKeyProperty = newPrefix + tableInfo.getKeyProperty(); String newKeyProperty = newPrefix + tableInfo.getKeyProperty();
@ -138,7 +138,7 @@ public interface MPJBaseMethod extends Constants {
} }
default String convertIfProperty(String prefix, String property) { 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; final String newPrefix = prefix == null ? EMPTY : prefix;
// 默认: column= // 默认: column=
String sqlSet = "${ew.alias}." + tableFieldInfo.getColumn() + EQUALS; String sqlSet = "${ew.alias}." + tableFieldInfo.getColumn() + EQUALS;
if (StringUtils.isNotBlank(tableFieldInfo.getUpdate())) { if (StrUtils.isNotBlank(tableFieldInfo.getUpdate())) {
sqlSet += String.format(tableFieldInfo.getUpdate(), tableFieldInfo.getColumn()); sqlSet += String.format(tableFieldInfo.getUpdate(), tableFieldInfo.getColumn());
} else { } else {
sqlSet += SqlScriptUtils.safeParam(newPrefix + tableFieldInfo.getEl()); sqlSet += SqlScriptUtils.safeParam(newPrefix + tableFieldInfo.getEl());
@ -258,7 +258,7 @@ public interface MPJBaseMethod extends Constants {
if (ignoreIf) { if (ignoreIf) {
return sqlSet; return sqlSet;
} }
if (tableFieldInfo.isWithUpdateFill()) { if (AdapterHelper.getAdapter().isWithUpdateFill(tableFieldInfo)) {
// 不进行 if 包裹 // 不进行 if 包裹
return sqlSet; return sqlSet;
} }
@ -266,7 +266,7 @@ public interface MPJBaseMethod extends Constants {
} }
default String mpjConvertIfProperty(String prefix, String property) { 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) { default String mpjConvertIf(TableFieldInfo tableFieldInfo, final String sqlScript, final String property, final FieldStrategy fieldStrategy) {

View File

@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.interfaces.MPJBaseJoin; import com.github.yulichang.interfaces.MPJBaseJoin;
import com.github.yulichang.toolkit.StrUtils;
import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.MappedStatement;
/** /**
@ -37,7 +37,7 @@ public class SelectList extends com.baomidou.mybatisplus.core.injector.methods.S
@Override @Override
protected String sqlOrderBy(TableInfo table) { protected String sqlOrderBy(TableInfo table) {
String orderBy = super.sqlOrderBy(table); String orderBy = super.sqlOrderBy(table);
if (StringUtils.isBlank(orderBy)) { if (StrUtils.isBlank(orderBy)) {
return orderBy; return orderBy;
} }
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()), return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),

View File

@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.interfaces.MPJBaseJoin; import com.github.yulichang.interfaces.MPJBaseJoin;
import com.github.yulichang.toolkit.StrUtils;
import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.MappedStatement;
/** /**
@ -37,7 +37,7 @@ public class SelectMaps extends com.baomidou.mybatisplus.core.injector.methods.S
@Override @Override
protected String sqlOrderBy(TableInfo table) { protected String sqlOrderBy(TableInfo table) {
String orderBy = super.sqlOrderBy(table); String orderBy = super.sqlOrderBy(table);
if (StringUtils.isBlank(orderBy)) { if (StrUtils.isBlank(orderBy)) {
return orderBy; return orderBy;
} }
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()), return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),

View File

@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.interfaces.MPJBaseJoin; import com.github.yulichang.interfaces.MPJBaseJoin;
import com.github.yulichang.toolkit.StrUtils;
import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.MappedStatement;
/** /**
@ -37,7 +37,7 @@ public class SelectMapsPage extends com.baomidou.mybatisplus.core.injector.metho
@Override @Override
protected String sqlOrderBy(TableInfo table) { protected String sqlOrderBy(TableInfo table) {
String orderBy = super.sqlOrderBy(table); String orderBy = super.sqlOrderBy(table);
if (StringUtils.isBlank(orderBy)) { if (StrUtils.isBlank(orderBy)) {
return orderBy; return orderBy;
} }
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()), return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),

View File

@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.interfaces.MPJBaseJoin; import com.github.yulichang.interfaces.MPJBaseJoin;
import com.github.yulichang.toolkit.StrUtils;
import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.MappedStatement;
/** /**
@ -52,7 +52,7 @@ public class SelectObjs extends com.baomidou.mybatisplus.core.injector.methods.S
@Override @Override
protected String sqlOrderBy(TableInfo table) { protected String sqlOrderBy(TableInfo table) {
String orderBy = super.sqlOrderBy(table); String orderBy = super.sqlOrderBy(table);
if (StringUtils.isBlank(orderBy)) { if (StrUtils.isBlank(orderBy)) {
return orderBy; return orderBy;
} }
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()), return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),

View File

@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.interfaces.MPJBaseJoin; import com.github.yulichang.interfaces.MPJBaseJoin;
import com.github.yulichang.toolkit.StrUtils;
import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.MappedStatement;
/** /**
@ -49,7 +49,7 @@ public class SelectOne extends com.baomidou.mybatisplus.core.injector.methods.Se
@Override @Override
protected String sqlOrderBy(TableInfo table) { protected String sqlOrderBy(TableInfo table) {
String orderBy = super.sqlOrderBy(table); String orderBy = super.sqlOrderBy(table);
if (StringUtils.isBlank(orderBy)) { if (StrUtils.isBlank(orderBy)) {
return orderBy; return orderBy;
} }
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()), return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),

View File

@ -3,9 +3,9 @@ package com.github.yulichang.method.mp;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils; import com.baomidou.mybatisplus.core.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.interfaces.MPJBaseJoin; import com.github.yulichang.interfaces.MPJBaseJoin;
import com.github.yulichang.toolkit.StrUtils;
import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.MappedStatement;
/** /**
@ -37,7 +37,7 @@ public class SelectPage extends com.baomidou.mybatisplus.core.injector.methods.S
@Override @Override
protected String sqlOrderBy(TableInfo table) { protected String sqlOrderBy(TableInfo table) {
String orderBy = super.sqlOrderBy(table); String orderBy = super.sqlOrderBy(table);
if (StringUtils.isBlank(orderBy)) { if (StrUtils.isBlank(orderBy)) {
return orderBy; return orderBy;
} }
return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()), return SqlScriptUtils.convertChoose(String.format("%s == null or !(%s instanceof %s)", Constants.WRAPPER, Constants.WRAPPER, MPJBaseJoin.class.getName()),

View File

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.config.ConfigProperties; import com.github.yulichang.config.ConfigProperties;
import com.github.yulichang.query.interfaces.CompareIfExists; import com.github.yulichang.query.interfaces.CompareIfExists;
import com.github.yulichang.query.interfaces.StringJoin; import com.github.yulichang.query.interfaces.StringJoin;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.TableHelper; import com.github.yulichang.toolkit.TableHelper;
import com.github.yulichang.toolkit.ThrowOptional; import com.github.yulichang.toolkit.ThrowOptional;
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum; import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
@ -237,7 +238,7 @@ public class MPJLambdaQueryWrapper<T> extends AbstractLambdaWrapper<T, MPJLambda
@Override @Override
public String getSqlSelect() { public String getSqlSelect() {
if (StringUtils.isBlank(sqlSelect.getStringValue())) { if (StrUtils.isBlank(sqlSelect.getStringValue())) {
if (CollectionUtils.isNotEmpty(ignoreColumns)) { if (CollectionUtils.isNotEmpty(ignoreColumns)) {
selectColumns.removeIf(ignoreColumns::contains); selectColumns.removeIf(ignoreColumns::contains);
} }
@ -260,7 +261,7 @@ public class MPJLambdaQueryWrapper<T> extends AbstractLambdaWrapper<T, MPJLambda
} }
public MPJLambdaQueryWrapper<T> setAlias(String alias) { public MPJLambdaQueryWrapper<T> setAlias(String alias) {
Assert.isTrue(StringUtils.isNotBlank(alias), "别名不能为空"); Assert.isTrue(StrUtils.isNotBlank(alias), "别名不能为空");
this.alias = alias; this.alias = alias;
return typedThis; return typedThis;
} }

View File

@ -14,6 +14,7 @@ import com.github.yulichang.config.ConfigProperties;
import com.github.yulichang.query.interfaces.CompareIfExists; import com.github.yulichang.query.interfaces.CompareIfExists;
import com.github.yulichang.query.interfaces.StringJoin; import com.github.yulichang.query.interfaces.StringJoin;
import com.github.yulichang.toolkit.MPJSqlInjectionUtils; import com.github.yulichang.toolkit.MPJSqlInjectionUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.TableHelper; import com.github.yulichang.toolkit.TableHelper;
import com.github.yulichang.toolkit.ThrowOptional; import com.github.yulichang.toolkit.ThrowOptional;
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum; import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
@ -249,7 +250,7 @@ public class MPJQueryWrapper<T> extends AbstractWrapper<T, String, MPJQueryWrapp
@Override @Override
public String getSqlSelect() { public String getSqlSelect() {
if (StringUtils.isBlank(sqlSelect.getStringValue())) { if (StrUtils.isBlank(sqlSelect.getStringValue())) {
if (CollectionUtils.isNotEmpty(ignoreColumns)) { if (CollectionUtils.isNotEmpty(ignoreColumns)) {
selectColumns.removeIf(ignoreColumns::contains); selectColumns.removeIf(ignoreColumns::contains);
} }
@ -277,7 +278,7 @@ public class MPJQueryWrapper<T> extends AbstractWrapper<T, String, MPJQueryWrapp
* @param alias 主表别名 * @param alias 主表别名
*/ */
public MPJQueryWrapper<T> setAlias(String alias) { public MPJQueryWrapper<T> setAlias(String alias) {
Assert.isTrue(StringUtils.isNotBlank(alias), "别名不能为空"); Assert.isTrue(StrUtils.isNotBlank(alias), "别名不能为空");
this.alias = alias; this.alias = alias;
return this; return this;
} }

View File

@ -1,6 +1,5 @@
package com.github.yulichang.toolkit; package com.github.yulichang.toolkit;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.github.yulichang.base.JoinMapper; import com.github.yulichang.base.JoinMapper;
import java.util.Map; import java.util.Map;
@ -39,7 +38,7 @@ public class MPJTableMapperHelper {
} }
public static Class<?> getMapperForName(String name) { public static Class<?> getMapperForName(String name) {
if (StringUtils.isBlank(name)) { if (StrUtils.isBlank(name)) {
return null; return null;
} }
return CACHE_MAPPER.get(name); return CACHE_MAPPER.get(name);

View File

@ -34,7 +34,7 @@ import static java.util.stream.Collectors.joining;
* @since 2016-08-18 * @since 2016-08-18
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class MPJStringUtils { public final class StrUtils {
/** /**
* 判断是否是中文 * 判断是否是中文
@ -237,7 +237,7 @@ public final class MPJStringUtils {
* @param args 填充参数 * @param args 填充参数
*/ */
public static String sqlArgsFill(String content, Object... args) { public static String sqlArgsFill(String content, Object... args) {
if (MPJStringUtils.isNotBlank(content) && ArrayUtils.isNotEmpty(args)) { if (StrUtils.isNotBlank(content) && ArrayUtils.isNotEmpty(args)) {
// 索引不能使用因为 SQL 中的占位符数字与索引不相同 // 索引不能使用因为 SQL 中的占位符数字与索引不相同
BiIntFunction<Matcher, CharSequence> handler = (m, i) -> sqlParam(args[Integer.parseInt(m.group("idx"))]); BiIntFunction<Matcher, CharSequence> handler = (m, i) -> sqlParam(args[Integer.parseInt(m.group("idx"))]);
return replace(content, MP_SQL_PLACE_HOLDER, handler).toString(); return replace(content, MP_SQL_PLACE_HOLDER, handler).toString();
@ -280,9 +280,9 @@ public final class MPJStringUtils {
public static String sqlParam(Object obj) { public static String sqlParam(Object obj) {
String repStr; String repStr;
if (obj instanceof Collection) { if (obj instanceof Collection) {
repStr = MPJStringUtils.quotaMarkList((Collection<?>) obj); repStr = StrUtils.quotaMarkList((Collection<?>) obj);
} else { } else {
repStr = MPJStringUtils.quotaMark(obj); repStr = StrUtils.quotaMark(obj);
} }
return repStr; return repStr;
} }
@ -309,7 +309,7 @@ public final class MPJStringUtils {
* @return 单引号包含的原字符串的集合形式 * @return 单引号包含的原字符串的集合形式
*/ */
public static String quotaMarkList(Collection<?> coll) { 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)); .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>StrUtils.removePrefixAfterPrefixToLower( "isUser", 2 ) = user</p>
* <p>StringUtils.removePrefixAfterPrefixToLower( "isUserInfo", 2 ) = userInfo</p> * <p>StrUtils.removePrefixAfterPrefixToLower( "isUserInfo", 2 ) = userInfo</p>
* *
* @param rawString 需要处理的字符串 * @param rawString 需要处理的字符串
* @param index 删除多少个字符(从左至右) * @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 * @param input ignore
* @return '-'分隔 * @return '-'分隔
@ -525,11 +525,11 @@ public final class MPJStringUtils {
* <p>对字符串大小写敏感</p> * <p>对字符串大小写敏感</p>
* *
* <pre> * <pre>
* StringUtils.equals(null, null) = true * StrUtils.equals(null, null) = true
* StringUtils.equals(null, "abc") = false * StrUtils.equals(null, "abc") = false
* StringUtils.equals("abc", null) = false * StrUtils.equals("abc", null) = false
* StringUtils.equals("abc", "abc") = true * StrUtils.equals("abc", "abc") = true
* StringUtils.equals("abc", "ABC") = false * StrUtils.equals("abc", "ABC") = false
* </pre> * </pre>
* *
* @param cs1 第一个字符串, 可为 {@code null} * @param cs1 第一个字符串, 可为 {@code null}

View File

@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; 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.AdapterHelper;
import com.github.yulichang.toolkit.sql.SqlScriptUtils; import com.github.yulichang.toolkit.sql.SqlScriptUtils;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
@ -28,18 +27,18 @@ public class WrapperUtils {
String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY); String first = Optional.ofNullable(wrapper.getSqlFirst()).orElse(StringPool.EMPTY);
boolean hasWhere = false; boolean hasWhere = false;
String entityWhere = getEntitySql(tableInfo, wrapper); String entityWhere = getEntitySql(tableInfo, wrapper);
if (StringUtils.isNotBlank(entityWhere)) { if (StrUtils.isNotBlank(entityWhere)) {
hasWhere = true; hasWhere = true;
} }
String mainLogic = mainLogic(hasWhere, clazz, wrapper); String mainLogic = mainLogic(hasWhere, clazz, wrapper);
if (StringUtils.isNotBlank(mainLogic)) { if (StrUtils.isNotBlank(mainLogic)) {
hasWhere = true; hasWhere = true;
} }
String subLogic = subLogic(hasWhere, wrapper); String subLogic = subLogic(hasWhere, wrapper);
if (StringUtils.isNotBlank(subLogic)) { if (StrUtils.isNotBlank(subLogic)) {
hasWhere = true; 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; ((wrapper.isEmptyOfNormal() ? StringPool.EMPTY : (hasWhere ? " AND " : " WHERE ")) + wrapper.getSqlSegment()) : StringPool.EMPTY;
String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY); String sqlComment = Optional.ofNullable(wrapper.getSqlComment()).orElse(StringPool.EMPTY);
@ -97,7 +96,7 @@ public class WrapperUtils {
return StringPool.EMPTY; return StringPool.EMPTY;
} }
String info = LogicInfoUtils.getLogicInfo(null, clazz, true, wrapper.getAlias()); String info = LogicInfoUtils.getLogicInfo(null, clazz, true, wrapper.getAlias());
if (StringUtils.isNotBlank(info)) { if (StrUtils.isNotBlank(info)) {
if (hasWhere) { if (hasWhere) {
return " AND " + info; return " AND " + info;
} }
@ -108,7 +107,7 @@ public class WrapperUtils {
private static String subLogic(boolean hasWhere, MPJLambdaWrapper<?> wrapper) { private static String subLogic(boolean hasWhere, MPJLambdaWrapper<?> wrapper) {
String sql = wrapper.getSubLogicSql(); String sql = wrapper.getSubLogicSql();
if (StringUtils.isNotBlank(sql)) { if (StrUtils.isNotBlank(sql)) {
if (hasWhere) { if (hasWhere) {
return sql; return sql;
} }

View File

@ -1,7 +1,7 @@
package com.github.yulichang.toolkit.sql; package com.github.yulichang.toolkit.sql;
import com.baomidou.mybatisplus.core.toolkit.Constants; 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.JdbcType;
import org.apache.ibatis.type.TypeHandler; 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, public static String convertTrim(final String sqlScript, final String prefix, final String suffix,
final String prefixOverrides, final String suffixOverrides) { final String prefixOverrides, final String suffixOverrides) {
StringBuilder sb = new StringBuilder("<trim"); StringBuilder sb = new StringBuilder("<trim");
if (StringUtils.isNotBlank(prefix)) { if (StrUtils.isNotBlank(prefix)) {
sb.append(" prefix=\"").append(prefix).append(QUOTE); sb.append(" prefix=\"").append(prefix).append(QUOTE);
} }
if (StringUtils.isNotBlank(suffix)) { if (StrUtils.isNotBlank(suffix)) {
sb.append(" suffix=\"").append(suffix).append(QUOTE); sb.append(" suffix=\"").append(suffix).append(QUOTE);
} }
if (StringUtils.isNotBlank(prefixOverrides)) { if (StrUtils.isNotBlank(prefixOverrides)) {
sb.append(" prefixOverrides=\"").append(prefixOverrides).append(QUOTE); sb.append(" prefixOverrides=\"").append(prefixOverrides).append(QUOTE);
} }
if (StringUtils.isNotBlank(suffixOverrides)) { if (StrUtils.isNotBlank(suffixOverrides)) {
sb.append(" suffixOverrides=\"").append(suffixOverrides).append(QUOTE); sb.append(" suffixOverrides=\"").append(suffixOverrides).append(QUOTE);
} }
return sb.append(RIGHT_CHEV).append(NEWLINE).append(sqlScript).append(NEWLINE).append("</trim>").toString(); 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, public static String convertForeach(final String sqlScript, final String collection, final String index,
final String item, final String separator) { final String item, final String separator) {
StringBuilder sb = new StringBuilder("<foreach"); StringBuilder sb = new StringBuilder("<foreach");
if (StringUtils.isNotBlank(collection)) { if (StrUtils.isNotBlank(collection)) {
sb.append(" collection=\"").append(collection).append(QUOTE); sb.append(" collection=\"").append(collection).append(QUOTE);
} }
if (StringUtils.isNotBlank(index)) { if (StrUtils.isNotBlank(index)) {
sb.append(" index=\"").append(index).append(QUOTE); sb.append(" index=\"").append(index).append(QUOTE);
} }
if (StringUtils.isNotBlank(item)) { if (StrUtils.isNotBlank(item)) {
sb.append(" item=\"").append(item).append(QUOTE); sb.append(" item=\"").append(item).append(QUOTE);
} }
if (StringUtils.isNotBlank(separator)) { if (StrUtils.isNotBlank(separator)) {
sb.append(" separator=\"").append(separator).append(QUOTE); sb.append(" separator=\"").append(separator).append(QUOTE);
} }
return sb.append(RIGHT_CHEV).append(NEWLINE).append(sqlScript).append(NEWLINE).append("</foreach>").toString(); 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) { public static String safeParam(final String param, final String mapping) {
String target = HASH_LEFT_BRACE + param; String target = HASH_LEFT_BRACE + param;
if (StringUtils.isBlank(mapping)) { if (StrUtils.isBlank(mapping)) {
return target + RIGHT_BRACE; return target + RIGHT_BRACE;
} }
return target + COMMA + mapping + RIGHT_BRACE; return target + COMMA + mapping + RIGHT_BRACE;

View File

@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.*; import com.baomidou.mybatisplus.core.toolkit.*;
import com.github.yulichang.adapter.AdapterHelper; import com.github.yulichang.adapter.AdapterHelper;
import com.github.yulichang.toolkit.LogicInfoUtils; import com.github.yulichang.toolkit.LogicInfoUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.TableHelper; import com.github.yulichang.toolkit.TableHelper;
import com.github.yulichang.toolkit.TableList; import com.github.yulichang.toolkit.TableList;
import com.github.yulichang.wrapper.interfaces.DeleteChain; import com.github.yulichang.wrapper.interfaces.DeleteChain;
@ -71,7 +72,7 @@ public class DeleteJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, DeleteJoi
@Override @Override
@SuppressWarnings({"UnusedReturnValue", "DuplicatedCode"}) @SuppressWarnings({"UnusedReturnValue", "DuplicatedCode"})
public String getDeleteSql() { public String getDeleteSql() {
if (StringUtils.isNotBlank(this.deleteSql.getStringValue())) { if (StrUtils.isNotBlank(this.deleteSql.getStringValue())) {
return this.deleteSql.getStringValue(); return this.deleteSql.getStringValue();
} }
String delete = null; String delete = null;
@ -89,7 +90,7 @@ public class DeleteJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, DeleteJoi
if (CollectionUtils.isNotEmpty(deleteTableName)) { if (CollectionUtils.isNotEmpty(deleteTableName)) {
delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName); delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName);
} }
if (StringUtils.isBlank(delete)) { if (StrUtils.isBlank(delete)) {
delete = this.alias; delete = this.alias;
} }
deleteSql.setStringValue(delete); deleteSql.setStringValue(delete);
@ -102,7 +103,7 @@ public class DeleteJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, DeleteJoi
@Override @Override
@SuppressWarnings("DuplicatedCode") @SuppressWarnings("DuplicatedCode")
public String getDeleteLogicSql() { public String getDeleteLogicSql() {
if (StringUtils.isNotBlank(this.deleteSql.getStringValue())) { if (StrUtils.isNotBlank(this.deleteSql.getStringValue())) {
return this.deleteSql.getStringValue(); return this.deleteSql.getStringValue();
} }
String delete = null; String delete = null;
@ -120,7 +121,7 @@ public class DeleteJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, DeleteJoi
if (CollectionUtils.isNotEmpty(deleteTableName)) { if (CollectionUtils.isNotEmpty(deleteTableName)) {
delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName); delete = delete + StringPool.COMMA + String.join(StringPool.COMMA, deleteTableName);
} }
if (StringUtils.isNotBlank(delete)) { if (StrUtils.isNotBlank(delete)) {
delete = StringPool.COMMA + delete; delete = StringPool.COMMA + delete;
} else { } else {
delete = StringPool.EMPTY; delete = StringPool.EMPTY;

View File

@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.adapter.AdapterHelper; import com.github.yulichang.adapter.AdapterHelper;
import com.github.yulichang.config.ConfigProperties; import com.github.yulichang.config.ConfigProperties;
@ -380,10 +379,10 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
* 获取连表部分语句 * 获取连表部分语句
*/ */
public String getFrom() { public String getFrom() {
if (StringUtils.isBlank(from.getStringValue())) { if (StrUtils.isBlank(from.getStringValue())) {
StringBuilder value = new StringBuilder(); StringBuilder value = new StringBuilder();
for (Children wrapper : onWrappers) { for (Children wrapper : onWrappers) {
if (StringUtils.isBlank(wrapper.from.getStringValue())) { if (StrUtils.isBlank(wrapper.from.getStringValue())) {
if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) { if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) {
TableInfo tableInfo = TableHelper.getAssert(wrapper.getJoinClass()); TableInfo tableInfo = TableHelper.getAssert(wrapper.getJoinClass());
if (AdapterHelper.getAdapter().mpjHasLogic(tableInfo)) { if (AdapterHelper.getAdapter().mpjHasLogic(tableInfo)) {
@ -453,7 +452,7 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
tableWrapper.tableList.setRootClass(clazz); tableWrapper.tableList.setRootClass(clazz);
table.accept(tableWrapper); table.accept(tableWrapper);
if (MPJStringUtils.isBlank(tableWrapper.getSqlSelect())) { if (StrUtils.isBlank(tableWrapper.getSqlSelect())) {
tableWrapper.selectAll(); tableWrapper.selectAll();
} }
tabName = WrapperUtils.buildUnionSqlByWrapper(clazz, tableWrapper); tabName = WrapperUtils.buildUnionSqlByWrapper(clazz, tableWrapper);
@ -467,7 +466,7 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
instance.isOn = true; instance.isOn = true;
instance.isMain = false; instance.isMain = false;
onWrappers.add(instance); onWrappers.add(instance);
if (StringUtils.isBlank(tableAlias)) { if (StrUtils.isBlank(tableAlias)) {
tableList.put(oldIndex, clazz, false, subTableAlias, newIndex); tableList.put(oldIndex, clazz, false, subTableAlias, newIndex);
instance.alias = subTableAlias; instance.alias = subTableAlias;
instance.hasAlias = false; instance.hasAlias = false;
@ -512,7 +511,7 @@ public abstract class JoinAbstractLambdaWrapper<T, Children extends JoinAbstract
*/ */
public boolean isUseAnnotationOrderBy() { public boolean isUseAnnotationOrderBy() {
final String _sqlSegment = this.getSqlSegment(); final String _sqlSegment = this.getSqlSegment();
if (StringUtils.isBlank(_sqlSegment)) { if (StrUtils.isBlank(_sqlSegment)) {
return true; return true;
} }
final String _sqlSegmentToUpperCase = _sqlSegment.toUpperCase(); final String _sqlSegmentToUpperCase = _sqlSegment.toUpperCase();

View File

@ -223,7 +223,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
/** /**
* 设置 IfExists * 设置 IfExists
* .IfExists(val -> val != null && StringUtils.isNotBlank(val)) * .IfExists(val -> val != null && StrUtils.isNotBlank(val))
* *
* @param IfExists 判断 * @param IfExists 判断
* @return Children * @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) { public <X, V> Children allEq(boolean condition, Map<SFunction<X, ?>, V> params, boolean null2IsNull) {
if (condition && CollectionUtils.isNotEmpty(params)) { if (condition && CollectionUtils.isNotEmpty(params)) {
params.forEach((k, v) -> { params.forEach((k, v) -> {
if (StringUtils.checkValNotNull(v)) { if (StrUtils.checkValNotNull(v)) {
eq(k, v); eq(k, v);
} else { } else {
if (null2IsNull) { if (null2IsNull) {
@ -254,7 +254,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
if (condition && CollectionUtils.isNotEmpty(params)) { if (condition && CollectionUtils.isNotEmpty(params)) {
params.forEach((k, v) -> { params.forEach((k, v) -> {
if (filter.test(k, v)) { if (filter.test(k, v)) {
if (StringUtils.checkValNotNull(v)) { if (StrUtils.checkValNotNull(v)) {
eq(k, v); eq(k, v);
} else { } else {
if (null2IsNull) { if (null2IsNull) {
@ -839,7 +839,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
*/ */
@SuppressWarnings("SameParameterValue") @SuppressWarnings("SameParameterValue")
protected final String formatSqlMaybeWithParam(String sqlStr, String mapping, Object... params) { protected final String formatSqlMaybeWithParam(String sqlStr, String mapping, Object... params) {
if (StringUtils.isBlank(sqlStr)) { if (StrUtils.isBlank(sqlStr)) {
// todo 何时会这样? // todo 何时会这样?
return null; return null;
} }
@ -941,7 +941,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
@Override @Override
public String getSqlComment() { public String getSqlComment() {
if (StringUtils.isNotBlank(sqlComment.getStringValue())) { if (StrUtils.isNotBlank(sqlComment.getStringValue())) {
return "/*" + StringEscape.escapeRawString(sqlComment.getStringValue()) + "*/"; return "/*" + StringEscape.escapeRawString(sqlComment.getStringValue()) + "*/";
} }
return null; return null;
@ -949,7 +949,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
@Override @Override
public String getSqlFirst() { public String getSqlFirst() {
if (StringUtils.isNotBlank(sqlFirst.getStringValue())) { if (StrUtils.isNotBlank(sqlFirst.getStringValue())) {
return StringEscape.escapeRawString(sqlFirst.getStringValue()); return StringEscape.escapeRawString(sqlFirst.getStringValue());
} }
return null; 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) { public <V> Children allEqStr(boolean condition, Map<String, V> params, boolean null2IsNull) {
if (condition && CollectionUtils.isNotEmpty(params)) { if (condition && CollectionUtils.isNotEmpty(params)) {
params.forEach((k, v) -> { params.forEach((k, v) -> {
if (StringUtils.checkValNotNull(v)) { if (StrUtils.checkValNotNull(v)) {
eq(k, v); eq(k, v);
} else { } else {
if (null2IsNull) { if (null2IsNull) {
@ -1093,7 +1093,7 @@ public abstract class JoinAbstractWrapper<T, Children extends JoinAbstractWrappe
if (condition && CollectionUtils.isNotEmpty(params)) { if (condition && CollectionUtils.isNotEmpty(params)) {
params.forEach((k, v) -> { params.forEach((k, v) -> {
if (filter.test(k, v)) { if (filter.test(k, v)) {
if (StringUtils.checkValNotNull(v)) { if (StrUtils.checkValNotNull(v)) {
eq(k, v); eq(k, v);
} else { } else {
if (null2IsNull) { if (null2IsNull) {

View File

@ -5,10 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.segments.MergeSegments;
import com.baomidou.mybatisplus.core.toolkit.*; import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.config.ConfigProperties; import com.github.yulichang.config.ConfigProperties;
import com.github.yulichang.toolkit.Constant; import com.github.yulichang.toolkit.*;
import com.github.yulichang.toolkit.LambdaUtils; 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.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum; import com.github.yulichang.wrapper.enums.IfExistsSqlKeyWordEnum;
import com.github.yulichang.wrapper.interfaces.*; import com.github.yulichang.wrapper.interfaces.*;
@ -322,7 +320,7 @@ public class MPJLambdaWrapper<T> extends JoinAbstractLambdaWrapper<T, MPJLambdaW
*/ */
@Override @Override
public String getSqlSelect() { 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 -> { String s = selectColumns.stream().map(i -> {
if (i.isStr()) { if (i.isStr()) {
return i.getColumn(); return i.getColumn();

View File

@ -129,7 +129,7 @@ public class UpdateJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, UpdateJoi
@Override @Override
public UpdateJoinWrapper<T> setApply(boolean condition, String applySql, MFunction<FuncConsumer> consumerFunction, Object... values) { 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()); FuncConsumer funcConsumer = consumerFunction.apply(new FuncConsumer());
UpdateSet set = new UpdateSet(); UpdateSet set = new UpdateSet();
set.setApply(true); set.setApply(true);
@ -143,7 +143,7 @@ public class UpdateJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, UpdateJoi
@Override @Override
public UpdateJoinWrapper<T> setSql(boolean condition, String sql) { public UpdateJoinWrapper<T> setSql(boolean condition, String sql) {
if (condition && StringUtils.isNotBlank(sql)) { if (condition && StrUtils.isNotBlank(sql)) {
if (Objects.isNull(sqlSet)) { if (Objects.isNull(sqlSet)) {
sqlSet = new ArrayList<>(); sqlSet = new ArrayList<>();
} }
@ -155,7 +155,7 @@ public class UpdateJoinWrapper<T> extends JoinAbstractLambdaWrapper<T, UpdateJoi
@SuppressWarnings("DuplicatedCode") @SuppressWarnings("DuplicatedCode")
@Override @Override
public String getSqlSet() { public String getSqlSet() {
if (StringUtils.isNotBlank(sqlSetStr.getStringValue())) { if (StrUtils.isNotBlank(sqlSetStr.getStringValue())) {
return sqlSetStr.getStringValue(); return sqlSetStr.getStringValue();
} }
StringBuilder set = new StringBuilder(StringPool.EMPTY); StringBuilder set = new StringBuilder(StringPool.EMPTY);

View File

@ -1,10 +1,10 @@
package com.github.yulichang.wrapper.interfaces; package com.github.yulichang.wrapper.interfaces;
import com.baomidou.mybatisplus.core.toolkit.Assert; import com.baomidou.mybatisplus.core.toolkit.Assert;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.toolkit.LambdaUtils; import com.github.yulichang.toolkit.LambdaUtils;
import com.github.yulichang.toolkit.MPJReflectionKit; import com.github.yulichang.toolkit.MPJReflectionKit;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.support.FieldCache; import com.github.yulichang.toolkit.support.FieldCache;
import com.github.yulichang.wrapper.resultmap.Label; import com.github.yulichang.wrapper.resultmap.Label;
import com.github.yulichang.wrapper.resultmap.MybatisLabel; import com.github.yulichang.wrapper.resultmap.MybatisLabel;
@ -152,7 +152,7 @@ public interface QueryLabel<Children> {
FieldCache field = fieldMap.get(dtoFieldName); FieldCache field = fieldMap.get(dtoFieldName);
Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类"); Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类");
MybatisLabel.Builder<C, F> builder; 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); dtoFieldName, child, field.getType(), (Class<F>) field.getType(), true);
addLabel(builder.build(), false); addLabel(builder.build(), false);
return getChildren(); return getChildren();
@ -186,7 +186,7 @@ public interface QueryLabel<Children> {
Class<S> dtoClass = LambdaUtils.getEntityClass(dtoField); Class<S> dtoClass = LambdaUtils.getEntityClass(dtoField);
FieldCache field = MPJReflectionKit.getFieldMap(dtoClass).get(dtoFieldName); FieldCache field = MPJReflectionKit.getFieldMap(dtoClass).get(dtoFieldName);
Assert.isFalse(Collection.class.isAssignableFrom(field.getType()), "association 不支持集合类"); 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); dtoFieldName, child, field.getType(), (Class<F>) field.getType(), false);
MybatisLabel.Builder<C, F> cfBuilder = collection.apply(builder); MybatisLabel.Builder<C, F> cfBuilder = collection.apply(builder);
addLabel(cfBuilder.build(), false); addLabel(cfBuilder.build(), false);

View File

@ -1,8 +1,8 @@
package com.github.yulichang.wrapper.resultmap; package com.github.yulichang.wrapper.resultmap;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.toolkit.LambdaUtils; import com.github.yulichang.toolkit.LambdaUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.support.ColumnCache; import com.github.yulichang.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.segments.SelectCache; import com.github.yulichang.wrapper.segments.SelectCache;
import lombok.AccessLevel; import lombok.AccessLevel;
@ -71,7 +71,7 @@ public class Result implements IResult {
String name = LambdaUtils.getName(column); String name = LambdaUtils.getName(column);
SelectCache normal = normalMap.get(name); SelectCache normal = normalMap.get(name);
result.selectNormal = normal; result.selectNormal = normal;
if (StringUtils.isBlank(result.property)) { if (StrUtils.isBlank(result.property)) {
result.property = normal.getColumProperty(); result.property = normal.getColumProperty();
} }
if (Objects.isNull(result.javaType)) { if (Objects.isNull(result.javaType)) {

View File

@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.github.yulichang.adapter.AdapterHelper; 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.ReflectionKit;
import com.github.yulichang.toolkit.TableHelper; import com.github.yulichang.toolkit.TableHelper;
import lombok.Getter; import lombok.Getter;
@ -82,7 +82,7 @@ public class SelectCache implements Serializable {
this.column = column; this.column = column;
this.columnType = columnType; this.columnType = columnType;
this.columProperty = columProperty; this.columProperty = columProperty;
this.tagColumn = MPJStringUtils.getTargetColumn(column); this.tagColumn = StrUtils.getTargetColumn(column);
this.isSelect = isSelect; this.isSelect = isSelect;
if (Objects.isNull(tableFieldInfo)) { if (Objects.isNull(tableFieldInfo)) {
this.hasTypeHandle = false; this.hasTypeHandle = false;

View File

@ -3,7 +3,7 @@ package com.github.yulichang.extension.mapping.mapper;
import com.baomidou.mybatisplus.core.enums.SqlKeyword; import com.baomidou.mybatisplus.core.enums.SqlKeyword;
import com.baomidou.mybatisplus.core.toolkit.StringPool; 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.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.segments.SelectCache; import com.github.yulichang.wrapper.segments.SelectCache;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -44,12 +44,12 @@ public class MPJMappingWrapper {
public MPJMappingWrapper(Class<?> joinClass, String first, String select, com.github.yulichang.annotation.Apply[] applyArr, 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) { 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) { if (this.hasFirst) {
this.first = first; this.first = first;
} }
this.hasSelect = StringUtils.isNotBlank(select); this.hasSelect = StrUtils.isNotBlank(select);
if (this.hasSelect) { if (this.hasSelect) {
this.select = select; this.select = select;
} }
@ -78,7 +78,7 @@ public class MPJMappingWrapper {
} }
} }
this.hasLast = StringUtils.isNotBlank(last); this.hasLast = StrUtils.isNotBlank(last);
if (this.hasLast) { if (this.hasLast) {
this.last = last; this.last = last;
} }
@ -91,7 +91,7 @@ public class MPJMappingWrapper {
for (String orderBy : orderByAsc) { for (String orderBy : orderByAsc) {
allColumns.addAll(Arrays.asList(orderBy.split(StringPool.COMMA))); 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)) colSet.contains(f) ? f : listField.stream().filter(s -> s.getColumProperty().equals(f))
.findFirst().map(SelectCache::getColumn).orElse(f)).collect(Collectors.toList()); .findFirst().map(SelectCache::getColumn).orElse(f)).collect(Collectors.toList());
} }
@ -104,7 +104,7 @@ public class MPJMappingWrapper {
for (String orderBy : orderByDesc) { for (String orderBy : orderByDesc) {
allColumns.addAll(Arrays.asList(orderBy.split(StringPool.COMMA))); 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)) colSet.contains(f) ? f : listField.stream().filter(s -> s.getColumProperty().equals(f))
.findFirst().map(SelectCache::getColumn).orElse(f)).collect(Collectors.toList()); .findFirst().map(SelectCache::getColumn).orElse(f)).collect(Collectors.toList());
} }

View File

@ -3,12 +3,16 @@ package com.github.yulichang.extension.mapping.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo; import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo; 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.adapter.AdapterHelper;
import com.github.yulichang.annotation.EntityMapping; import com.github.yulichang.annotation.EntityMapping;
import com.github.yulichang.annotation.FieldMapping; import com.github.yulichang.annotation.FieldMapping;
import com.github.yulichang.toolkit.ReflectionKit; import com.github.yulichang.toolkit.ReflectionKit;
import com.github.yulichang.toolkit.SpringContentUtils; import com.github.yulichang.toolkit.SpringContentUtils;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.toolkit.TableHelper; import com.github.yulichang.toolkit.TableHelper;
import com.github.yulichang.toolkit.support.ColumnCache; import com.github.yulichang.toolkit.support.ColumnCache;
import com.github.yulichang.wrapper.segments.SelectCache; import com.github.yulichang.wrapper.segments.SelectCache;
@ -178,7 +182,7 @@ public class MPJTableFieldInfo {
} }
private void initJoinField(String joinField) { private void initJoinField(String joinField) {
if (StringUtils.isNotBlank(joinField)) { if (StrUtils.isNotBlank(joinField)) {
this.joinProperty = joinField; this.joinProperty = joinField;
} else { } else {
TableInfo info = getTableInfo(this.joinClass); TableInfo info = getTableInfo(this.joinClass);
@ -200,14 +204,14 @@ public class MPJTableFieldInfo {
this.joinField = getField(this.joinClass, joinFieldInfo); this.joinField = getField(this.joinClass, joinFieldInfo);
} }
Assert.notNull(this.joinField, "注解属性joinField不存在 %s , %s", this.joinClass.getName(), 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(), 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); this.joinField.setAccessible(true);
} }
private void initThisField(String thisField) { private void initThisField(String thisField) {
if (StringUtils.isNotBlank(thisField)) { if (StrUtils.isNotBlank(thisField)) {
this.thisProperty = thisField; this.thisProperty = thisField;
} else { } else {
TableInfo info = getTableInfo(this.entityType); TableInfo info = getTableInfo(this.entityType);
@ -220,13 +224,13 @@ public class MPJTableFieldInfo {
this.thisField = ReflectionKit.getFieldList(ClassUtils.getUserClass(entityType)).stream().filter(f -> this.thisField = ReflectionKit.getFieldList(ClassUtils.getUserClass(entityType)).stream().filter(f ->
f.getName().equals(tableInfo.getKeyProperty())).findFirst().orElse(null); f.getName().equals(tableInfo.getKeyProperty())).findFirst().orElse(null);
Assert.notNull(this.thisField, "注解属性thisField不存在 %s , %s", entityType.getName(), 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(); this.thisColumn = tableInfo.getKeyColumn();
} else { } else {
TableFieldInfo fieldInfo = tableInfo.getFieldList().stream().filter(f -> TableFieldInfo fieldInfo = tableInfo.getFieldList().stream().filter(f ->
f.getProperty().equals(this.thisProperty)).findFirst().orElse(null); f.getProperty().equals(this.thisProperty)).findFirst().orElse(null);
Assert.notNull(fieldInfo, "注解属性thisField不存在 %s , %s", entityType.getName(), 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.thisField = getField(this.entityType, fieldInfo);
this.thisColumn = fieldInfo.getColumn(); this.thisColumn = fieldInfo.getColumn();
} }
@ -269,20 +273,20 @@ public class MPJTableFieldInfo {
if (Objects.isNull(arr) || arr.length == 0) { if (Objects.isNull(arr) || arr.length == 0) {
return false; 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) { private String propToColumn(Class<?> tag, String[] arr, String joinC) {
Map<String, SelectCache> mapField = ColumnCache.getMapField(tag); Map<String, SelectCache> mapField = ColumnCache.getMapField(tag);
List<String> args = null; List<String> args = null;
if (checkArr(arr)) { 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)) { if (mapField.containsKey(c)) {
return mapField.get(c).getColumn(); return mapField.get(c).getColumn();
} }
return c; return c;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (StringUtils.isNotBlank(joinC)) { if (StrUtils.isNotBlank(joinC)) {
if (mapField.containsKey(joinC)) { if (mapField.containsKey(joinC)) {
args.add(mapField.get(joinC).getColumn()); args.add(mapField.get(joinC).getColumn());
} }

View File

@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.injector.ISqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo; import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.PluginUtils; 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.injector.methods.InsertBatchSomeColumn;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; 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.baomidou.mybatisplus.extension.toolkit.JdbcUtils;
import com.github.yulichang.injector.MPJSqlInjector; import com.github.yulichang.injector.MPJSqlInjector;
import com.github.yulichang.test.util.ThreadLocalUtils; import com.github.yulichang.test.util.ThreadLocalUtils;
import com.github.yulichang.toolkit.StrUtils;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue; import net.sf.jsqlparser.expression.LongValue;
@ -149,7 +149,7 @@ public class MybatisPlusConfig {
@SneakyThrows @SneakyThrows
public void beforePrepare(StatementHandler sh, Connection connection, Integer transactionTimeout) { public void beforePrepare(StatementHandler sh, Connection connection, Integer transactionTimeout) {
BoundSql boundSql = sh.getBoundSql(); BoundSql boundSql = sh.getBoundSql();
if (boundSql != null && StringUtils.isNotBlank(boundSql.getSql())) { if (boundSql != null && StrUtils.isNotBlank(boundSql.getSql())) {
String sql = boundSql.getSql(); String sql = boundSql.getSql();
this.dbType = Optional.ofNullable(this.dbType).orElse(JdbcUtils.getDbType(connection.getMetaData().getURL())); this.dbType = Optional.ofNullable(this.dbType).orElse(JdbcUtils.getDbType(connection.getMetaData().getURL()));
if (P.test(this.dbType)) { if (P.test(this.dbType)) {
@ -166,7 +166,7 @@ public class MybatisPlusConfig {
} }
private String formatSql(String sql) { private String formatSql(String sql) {
if (StringUtils.isBlank(sql)) { if (StrUtils.isBlank(sql)) {
return sql; return sql;
} }
sql = sql.replaceAll("\n", ""); sql = sql.replaceAll("\n", "");

View File

@ -1,9 +1,9 @@
package com.github.yulichang.test.util; package com.github.yulichang.test.util;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.yulichang.toolkit.StrUtils;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import java.util.Arrays; import java.util.Arrays;
@ -31,13 +31,13 @@ public class ThreadLocalUtils {
@SneakyThrows @SneakyThrows
public static List<String> get() { public static List<String> get() {
String s = userThreadLocal.get(); String s = userThreadLocal.get();
if (StringUtils.isBlank(s)) { if (StrUtils.isBlank(s)) {
return null; return null;
} }
ObjectMapper mapper = new ObjectMapper(); 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(""); set("");
return sqlList; return sqlList;
} }

View File

@ -2,7 +2,6 @@ package com.github.yulichang.test.join;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.adapter.base.tookit.VersionUtils; import com.github.yulichang.adapter.base.tookit.VersionUtils;
import com.github.yulichang.test.join.dto.AddressDTO; 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.Reset;
import com.github.yulichang.test.util.ThreadLocalUtils; import com.github.yulichang.test.util.ThreadLocalUtils;
import com.github.yulichang.toolkit.JoinWrappers; import com.github.yulichang.toolkit.JoinWrappers;
import com.github.yulichang.toolkit.StrUtils;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
@ -329,9 +329,9 @@ class LambdaWrapperTest {
.leftJoin(UserDO.class, "uc", UserDO::getId, UserDto::getUpdateBy, ext -> ext .leftJoin(UserDO.class, "uc", UserDO::getId, UserDto::getUpdateBy, ext -> ext
.selectAs(UserDO::getName, UserDto::getUpdateName)); .selectAs(UserDO::getName, UserDto::getUpdateName));
List<UserDto> userDtos = userDTOMapper.selectJoinList(UserDto.class, wrapper.clone()); List<UserDto> userDtos = userDTOMapper.selectJoinList(UserDto.class, wrapper.clone());
assert StringUtils.isNotBlank(userDtos.get(0).getUserName()); assert StrUtils.isNotBlank(userDtos.get(0).getUserName());
assert StringUtils.isNotBlank(userDtos.get(0).getCreateName()); assert StrUtils.isNotBlank(userDtos.get(0).getCreateName());
assert StringUtils.isNotBlank(userDtos.get(0).getUpdateName()); assert StrUtils.isNotBlank(userDtos.get(0).getUpdateName());
ThreadLocalUtils.set(""" ThreadLocalUtils.set("""

View File

@ -2,7 +2,6 @@ package com.github.yulichang.test.join.apt;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.adapter.base.tookit.VersionUtils; import com.github.yulichang.adapter.base.tookit.VersionUtils;
import com.github.yulichang.extension.apt.AptQueryWrapper; 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.join.mapper.*;
import com.github.yulichang.test.util.Reset; import com.github.yulichang.test.util.Reset;
import com.github.yulichang.test.util.ThreadLocalUtils; import com.github.yulichang.test.util.ThreadLocalUtils;
import com.github.yulichang.toolkit.StrUtils;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -364,9 +364,9 @@ class AptWrapperTest {
.ge(ub.id, 0); .ge(ub.id, 0);
List<UserDto> userDtos = userDTOMapper.selectJoinList(UserDto.class, wrapper); List<UserDto> userDtos = userDTOMapper.selectJoinList(UserDto.class, wrapper);
assert StringUtils.isNotBlank(userDtos.get(0).getUserName()); assert StrUtils.isNotBlank(userDtos.get(0).getUserName());
assert StringUtils.isNotBlank(userDtos.get(0).getCreateName()); assert StrUtils.isNotBlank(userDtos.get(0).getCreateName());
assert StringUtils.isNotBlank(userDtos.get(0).getUpdateName()); assert StrUtils.isNotBlank(userDtos.get(0).getUpdateName());
ThreadLocalUtils.set(""" ThreadLocalUtils.set("""

View File

@ -1,7 +1,6 @@
package com.github.yulichang.test.kt package com.github.yulichang.test.kt
import com.baomidou.mybatisplus.core.metadata.IPage import com.baomidou.mybatisplus.core.metadata.IPage
import com.baomidou.mybatisplus.core.toolkit.StringUtils
import com.baomidou.mybatisplus.extension.plugins.pagination.Page import com.baomidou.mybatisplus.extension.plugins.pagination.Page
import com.github.yulichang.extension.kt.KtDeleteJoinWrapper import com.github.yulichang.extension.kt.KtDeleteJoinWrapper
import com.github.yulichang.extension.kt.KtLambdaWrapper 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.kt.mapper.UserMapper
import com.github.yulichang.test.util.Reset import com.github.yulichang.test.util.Reset
import com.github.yulichang.test.util.ThreadLocalUtils import com.github.yulichang.test.util.ThreadLocalUtils
import com.github.yulichang.toolkit.StrUtils
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Autowired
@ -295,9 +295,9 @@ class LambdaWrapperTest {
ext.selectAs(UserDO::name, UserDto::updateName) ext.selectAs(UserDO::name, UserDto::updateName)
} }
val userDtos: List<UserDto> = userDTOMapper!!.selectJoinList(UserDto::class.java, wrapper) val userDtos: List<UserDto> = userDTOMapper!!.selectJoinList(UserDto::class.java, wrapper)
assert(StringUtils.isNotBlank(userDtos[0].userName)) assert(StrUtils.isNotBlank(userDtos[0].userName))
assert(StringUtils.isNotBlank(userDtos[0].createName)) assert(StrUtils.isNotBlank(userDtos[0].createName))
assert(StringUtils.isNotBlank(userDtos[0].updateName)) assert(StrUtils.isNotBlank(userDtos[0].updateName))
ThreadLocalUtils.set( ThreadLocalUtils.set(