yulichang 2023-06-06 01:02:05 +08:00
parent 1f0ada7593
commit 473ec1d052
3 changed files with 8 additions and 15 deletions

View File

@ -17,8 +17,8 @@ import com.github.yulichang.wrapper.segments.SelectCache;
import kotlin.reflect.KProperty; import kotlin.reflect.KProperty;
import lombok.Getter; import lombok.Getter;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -204,11 +204,7 @@ public abstract class KtAbstractLambdaWrapper<T, Children extends KtAbstractLamb
} }
} }
String decode; String decode;
try { decode = URLDecoder.decode(tableName, StandardCharsets.UTF_8);
decode = URLDecoder.decode(tableName, "UTF-8");
} catch (UnsupportedEncodingException e) {
decode = tableName;
}
if (dynamicTableName) { if (dynamicTableName) {
return tableFunc.apply(decode); return tableFunc.apply(decode);
} }
@ -334,7 +330,7 @@ public abstract class KtAbstractLambdaWrapper<T, Children extends KtAbstractLamb
StringBuilder value = new StringBuilder(); StringBuilder value = new StringBuilder();
for (Children wrapper : onWrappers) { for (Children wrapper : onWrappers) {
if (StringUtils.isBlank(wrapper.from.getStringValue())) { if (StringUtils.isBlank(wrapper.from.getStringValue())) {
if (wrapper.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) { if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) {
TableInfo tableInfo = TableHelper.get(wrapper.getJoinClass()); TableInfo tableInfo = TableHelper.get(wrapper.getJoinClass());
if (ConfigProperties.tableInfoAdapter.mpjHasLogic(tableInfo)) { if (ConfigProperties.tableInfoAdapter.mpjHasLogic(tableInfo)) {
wrapper.appendSqlSegments(APPLY, () -> LogicInfoUtils.getLogicInfoNoAnd( wrapper.appendSqlSegments(APPLY, () -> LogicInfoUtils.getLogicInfoNoAnd(

View File

@ -17,8 +17,8 @@ import com.github.yulichang.wrapper.interfaces.QueryJoin;
import com.github.yulichang.wrapper.segments.SelectCache; import com.github.yulichang.wrapper.segments.SelectCache;
import lombok.Getter; import lombok.Getter;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -204,11 +204,7 @@ public abstract class MPJAbstractLambdaWrapper<T, Children extends MPJAbstractLa
} }
} }
String decode; String decode;
try { decode = URLDecoder.decode(tableName, StandardCharsets.UTF_8);
decode = URLDecoder.decode(tableName, "UTF-8");
} catch (UnsupportedEncodingException e) {
decode = tableName;
}
if (dynamicTableName) { if (dynamicTableName) {
return tableFunc.apply(decode); return tableFunc.apply(decode);
} }
@ -335,7 +331,7 @@ public abstract class MPJAbstractLambdaWrapper<T, Children extends MPJAbstractLa
StringBuilder value = new StringBuilder(); StringBuilder value = new StringBuilder();
for (Children wrapper : onWrappers) { for (Children wrapper : onWrappers) {
if (StringUtils.isBlank(wrapper.from.getStringValue())) { if (StringUtils.isBlank(wrapper.from.getStringValue())) {
if (wrapper.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) { if (this.subLogicSql && this.logicDelType == LogicDelTypeEnum.ON) {
TableInfo tableInfo = TableHelper.get(wrapper.getJoinClass()); TableInfo tableInfo = TableHelper.get(wrapper.getJoinClass());
if (ConfigProperties.tableInfoAdapter.mpjHasLogic(tableInfo)) { if (ConfigProperties.tableInfoAdapter.mpjHasLogic(tableInfo)) {
wrapper.appendSqlSegments(APPLY, () -> LogicInfoUtils.getLogicInfoNoAnd( wrapper.appendSqlSegments(APPLY, () -> LogicInfoUtils.getLogicInfoNoAnd(

View File

@ -194,7 +194,7 @@ public class MPJLambdaWrapper<T> extends MPJAbstractLambdaWrapper<T, MPJLambdaWr
* 子查询 * 子查询
*/ */
public <E, F> MPJLambdaWrapper<T> selectSub(Class<E> clazz, String st, Consumer<MPJLambdaWrapper<E>> consumer, SFunction<F, ?> alias) { public <E, F> MPJLambdaWrapper<T> selectSub(Class<E> clazz, String st, Consumer<MPJLambdaWrapper<E>> consumer, SFunction<F, ?> alias) {
MPJLambdaWrapper<E> wrapper = new MPJLambdaWrapper<E>(null, clazz, SharedString.emptyString(), paramNameSeq, paramNameValuePairs, MPJLambdaWrapper<E> wrapper = new MPJLambdaWrapper<>(null, clazz, SharedString.emptyString(), paramNameSeq, paramNameValuePairs,
new MergeSegments(), SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(), new MergeSegments(), SharedString.emptyString(), SharedString.emptyString(), SharedString.emptyString(),
new TableList(), null, null, null, null) { new TableList(), null, null, null, null) {
}; };
@ -251,6 +251,7 @@ public class MPJLambdaWrapper<T> extends MPJAbstractLambdaWrapper<T, MPJLambdaWr
* 查询条件 SQL 片段 * 查询条件 SQL 片段
*/ */
@Override @Override
@SuppressWarnings("DuplicatedCode")
public String getSqlSelect() { public String getSqlSelect() {
if (StringUtils.isBlank(sqlSelect.getStringValue()) && CollectionUtils.isNotEmpty(selectColumns)) { if (StringUtils.isBlank(sqlSelect.getStringValue()) && CollectionUtils.isNotEmpty(selectColumns)) {
String s = selectColumns.stream().map(i -> { String s = selectColumns.stream().map(i -> {