mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
移除无用代码
This commit is contained in:
parent
492c7f59d4
commit
cc003a13e8
@ -1,28 +0,0 @@
|
|||||||
package com.github.yulichang.toolkit;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class BiHashMap<K, V, E> {
|
|
||||||
|
|
||||||
private final Map<K, Map<V, E>> map;
|
|
||||||
|
|
||||||
public BiHashMap() {
|
|
||||||
this.map = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public E get(K k, V v) {
|
|
||||||
return map.containsKey(k) ? map.get(k).get(v) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void put(K k, V v, E e) {
|
|
||||||
if (map.containsKey(k)) {
|
|
||||||
map.get(k).put(v, e);
|
|
||||||
} else {
|
|
||||||
Map<V, E> veMap = new HashMap<>();
|
|
||||||
veMap.put(v, e);
|
|
||||||
map.put(k, veMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
package com.github.yulichang.toolkit;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询字段集合
|
|
||||||
*
|
|
||||||
* @author yulichang
|
|
||||||
* @since 1.2.5
|
|
||||||
*/
|
|
||||||
public class UniqueList<T extends UniqueObject> extends ArrayList<T> implements UniqueObject {
|
|
||||||
|
|
||||||
private String uniqueKey;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUniqueKey() {
|
|
||||||
if (StringUtils.isBlank(uniqueKey)) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
for (UniqueObject ub : this) {
|
|
||||||
sb.append(ub.getUniqueKey());
|
|
||||||
}
|
|
||||||
this.uniqueKey = sb.toString();
|
|
||||||
}
|
|
||||||
return this.uniqueKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean add(T t) {
|
|
||||||
this.uniqueKey = null;
|
|
||||||
return super.add(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean remove(Object o) {
|
|
||||||
this.uniqueKey = null;
|
|
||||||
return super.remove(o);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addAll(Collection<? extends T> c) {
|
|
||||||
this.uniqueKey = null;
|
|
||||||
return super.addAll(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addAll(int index, Collection<? extends T> c) {
|
|
||||||
this.uniqueKey = null;
|
|
||||||
return super.addAll(index, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean removeAll(Collection<?> c) {
|
|
||||||
this.uniqueKey = null;
|
|
||||||
return super.removeAll(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void removeRange(int fromIndex, int toIndex) {
|
|
||||||
this.uniqueKey = null;
|
|
||||||
super.removeRange(fromIndex, toIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clear() {
|
|
||||||
this.uniqueKey = null;
|
|
||||||
super.clear();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.github.yulichang.toolkit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类唯一标识
|
|
||||||
*
|
|
||||||
* @author yulichang
|
|
||||||
* @since 1.2.5
|
|
||||||
*/
|
|
||||||
public interface UniqueObject {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取类唯一标识
|
|
||||||
*/
|
|
||||||
String getUniqueKey();
|
|
||||||
}
|
|
@ -1,14 +1,10 @@
|
|||||||
package com.github.yulichang.toolkit.support;
|
package com.github.yulichang.toolkit.support;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.github.yulichang.toolkit.UniqueObject;
|
|
||||||
import com.github.yulichang.wrapper.enums.BaseFuncEnum;
|
import com.github.yulichang.wrapper.enums.BaseFuncEnum;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MPJLambdaWrapper 查询字段
|
* MPJLambdaWrapper 查询字段
|
||||||
*
|
*
|
||||||
@ -16,7 +12,7 @@ import java.util.Objects;
|
|||||||
* @since 1.2.5
|
* @since 1.2.5
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
public class SelectColumn implements UniqueObject {
|
public class SelectColumn {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字段实体类
|
* 字段实体类
|
||||||
@ -77,13 +73,4 @@ public class SelectColumn implements UniqueObject {
|
|||||||
tagProperty = StringUtils.getTargetColumn(tagProperty);
|
tagProperty = StringUtils.getTargetColumn(tagProperty);
|
||||||
return new SelectColumn(clazz, columnName, tableFieldInfo, alias, tagProperty, keyType, label, funcEnum);
|
return new SelectColumn(clazz, columnName, tableFieldInfo, alias, tagProperty, keyType, label, funcEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取唯一标识
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getUniqueKey() {
|
|
||||||
return String.join(StringPool.AMPERSAND, clazz.getName(), columnName, alias,
|
|
||||||
Objects.isNull(funcEnum) ? null : funcEnum.getSql());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ public class MPJLambdaWrapper<T> extends MPJAbstractLambdaWrapper<T, MPJLambdaWr
|
|||||||
* 查询的字段
|
* 查询的字段
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private final List<SelectColumn> selectColumns = new UniqueList<>();
|
private final List<SelectColumn> selectColumns = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* ON sql wrapper集合
|
* ON sql wrapper集合
|
||||||
*/
|
*/
|
||||||
|
@ -4,11 +4,9 @@ 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.metadata.TableInfoHelper;
|
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
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.UniqueObject;
|
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@ -23,7 +21,7 @@ import org.apache.ibatis.type.TypeHandler;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter(AccessLevel.PACKAGE)
|
@Setter(AccessLevel.PACKAGE)
|
||||||
public class Result implements UniqueObject {
|
public class Result {
|
||||||
|
|
||||||
private boolean isId;
|
private boolean isId;
|
||||||
|
|
||||||
@ -42,10 +40,6 @@ public class Result implements UniqueObject {
|
|||||||
public Result() {
|
public Result() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUniqueKey() {
|
|
||||||
return String.join(StringPool.DASH, String.valueOf(isId), property, column);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings({"UnusedReturnValue", "unused"})
|
@SuppressWarnings({"UnusedReturnValue", "unused"})
|
||||||
public static class Builder<E, T> {
|
public static class Builder<E, T> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user