@@ -111,15 +111,15 @@ public static void init() {
111
111
112
112
for (Entry <Integer , Map <String , List <String >>> entry : allSet ) {
113
113
Map <String , Map <String , String >> keyColumnMap = VERSIONED_KEY_COLUMN_MAP .get (entry .getKey ());
114
- Map <String , Map <String , String >> columnKeyMap = VERSIONED_COLUMN_KEY_MAP .get (entry .getKey ());
114
+ // 没必要,没特殊配置的就原样返回,没有安全隐患,还能减少性能浪费 Map<String, Map<String, String>> columnKeyMap = VERSIONED_COLUMN_KEY_MAP.get(entry.getKey());
115
115
if (keyColumnMap == null ) {
116
116
keyColumnMap = new LinkedHashMap <>();
117
117
VERSIONED_KEY_COLUMN_MAP .put (entry .getKey (), keyColumnMap );
118
118
}
119
- if (columnKeyMap == null ) {
120
- columnKeyMap = new LinkedHashMap <>();
121
- VERSIONED_COLUMN_KEY_MAP .put (entry .getKey (), columnKeyMap );
122
- }
119
+ // if (columnKeyMap == null) {
120
+ // columnKeyMap = new LinkedHashMap<>();
121
+ // VERSIONED_COLUMN_KEY_MAP.put(entry.getKey(), columnKeyMap);
122
+ // }
123
123
124
124
Map <String , List <String >> tableKeyColumnMap = entry == null ? null : entry .getValue ();
125
125
Set <Entry <String , List <String >>> tableKeyColumnSet = tableKeyColumnMap == null ? null : tableKeyColumnMap .entrySet ();
@@ -133,22 +133,22 @@ public static void init() {
133
133
if (list != null && list .isEmpty () == false ) {
134
134
135
135
Map <String , String > kcm = keyColumnMap .get (tableKeyColumnEntry .getKey ());
136
- Map <String , String > ckm = columnKeyMap .get (tableKeyColumnEntry .getKey ());
136
+ // Map<String, String> ckm = columnKeyMap.get(tableKeyColumnEntry.getKey());
137
137
if (kcm == null ) {
138
138
kcm = new LinkedHashMap <>();
139
139
keyColumnMap .put (tableKeyColumnEntry .getKey (), kcm );
140
140
}
141
- if (ckm == null ) {
142
- ckm = new LinkedHashMap <>();
143
- columnKeyMap .put (tableKeyColumnEntry .getKey (), ckm );
144
- }
141
+ // if (ckm == null) {
142
+ // ckm = new LinkedHashMap<>();
143
+ // columnKeyMap.put(tableKeyColumnEntry.getKey(), ckm);
144
+ // }
145
145
146
146
for (String column : list ) {
147
147
if (column == null ) {
148
148
continue ;
149
149
}
150
150
151
- ckm .putIfAbsent (column , column );
151
+ // ckm.putIfAbsent(column, column);
152
152
//FIXME 对 Comment.toId (多版本) 居然不起作用
153
153
// if (kcm.containsValue(column) == false) {
154
154
kcm .putIfAbsent (column , column );
@@ -245,8 +245,7 @@ public static List<String> compatInputColumn(List<String> columns, String table,
245
245
}
246
246
247
247
boolean isEmpty = exceptColumns == null || exceptColumns .isEmpty (); // exceptColumnMap == null || exceptColumnMap.isEmpty();
248
- Map <String , List <String >> map = isEmpty || VERSIONED_TABLE_COLUMN_MAP == null || VERSIONED_TABLE_COLUMN_MAP .isEmpty () ? null : VERSIONED_TABLE_COLUMN_MAP .get (version );
249
- List <String > allColumns = map == null || map .isEmpty () ? null : map .get (table );
248
+ List <String > allColumns = isEmpty ? null : getClosestValue (VERSIONED_TABLE_COLUMN_MAP , version , table );
250
249
251
250
if (allColumns != null && allColumns .isEmpty () == false ) {
252
251
0 commit comments