|
@@ -4,16 +4,12 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
|
|
|
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
|
|
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
import org.example.join.domain.Table;
|
|
|
|
|
|
import java.util.Map;
|
|
|
-import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
public class SqlUtil {
|
|
|
|
|
|
- private static final Map<String, String> delFlagMap = new ConcurrentHashMap<>();
|
|
|
-
|
|
|
public static String getTableAlias(Table table, Map<String, String> tableAliasMap) {
|
|
|
String tableAlias = table.getAlias();
|
|
|
String tableName = table.getName();
|
|
@@ -28,15 +24,13 @@ public class SqlUtil {
|
|
|
}
|
|
|
|
|
|
public static String getTableDelFlag(Table table) {
|
|
|
- return delFlagMap.computeIfAbsent(table.getName(), item -> {
|
|
|
- TableInfo tableInfo = TableInfoHelper.getTableInfo(item);
|
|
|
- for (TableFieldInfo tableFieldInfo : tableInfo.getFieldList()) {
|
|
|
- if (tableFieldInfo.isLogicDelete()) {
|
|
|
- return tableFieldInfo.getColumn();
|
|
|
- }
|
|
|
- }
|
|
|
- return StringPool.EMPTY;
|
|
|
- });
|
|
|
+ TableInfo tableInfo = TableInfoHelper.getTableInfo(table.getName());
|
|
|
+ if (!tableInfo.isWithLogicDelete()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ TableFieldInfo logicDeleteFieldInfo = tableInfo.getLogicDeleteFieldInfo();
|
|
|
+ return logicDeleteFieldInfo.getColumn();
|
|
|
}
|
|
|
|
|
|
}
|