Skip to content

Commit d5676a6

Browse files
committed
完善合并字段插件,测试可用
1 parent 60d88a6 commit d5676a6

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

src/main/java/apijson/framework/APIJSONSQLConfig.java

+8
Original file line numberDiff line numberDiff line change
@@ -418,4 +418,12 @@ public APIJSONSQLConfig<T, M, L> setColumn(List<String> column) {
418418
return this;
419419
}
420420

421+
@Override
422+
public String gainKey(String key) {
423+
if (ENABLE_COLUMN_CONFIG) {
424+
key = ColumnUtil.compatInputKey(key, getTable(), getMethod());
425+
}
426+
return super.gainKey(key);
427+
}
428+
421429
}

src/main/java/apijson/framework/APIJSONSQLExecutor.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.List;
2222
import java.util.Map;
2323

24-
//import apijson.column.ColumnUtil;
2524
import org.postgresql.util.PGobject;
2625

2726
import apijson.JSON;
@@ -104,9 +103,9 @@ protected String getKey(
104103
) throws Exception {
105104

106105
String key = super.getKey(config, rs, rsmd, row, table, columnIndex, childMap, keyMap);
107-
// if (APIJSONSQLConfig.ENABLE_COLUMN_CONFIG) {
108-
// return ColumnUtil.compatOutputKey(key, config.getTable(), config.getMethod());
109-
// }
106+
if (APIJSONSQLConfig.ENABLE_COLUMN_CONFIG) {
107+
return ColumnUtil.compatOutputKey(key, config.getTable(), config.getMethod());
108+
}
110109

111110
return key;
112111
}

src/main/java/apijson/framework/ColumnUtil.java

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public class ColumnUtil {
4848
public static final Comparator<Integer> DESC_COMPARATOR = new Comparator<Integer>() {
4949
@Override
5050
public int compare(Integer o1, Integer o2) {
51+
if (o2 == null) {
52+
return o1 == null ? 0 : -1;
53+
}
5154
return o2.compareTo(o1);
5255
}
5356
};

src/main/java/apijson/framework/javax/APIJSONSQLConfig.java

+8
Original file line numberDiff line numberDiff line change
@@ -411,4 +411,12 @@ public APIJSONSQLConfig<T, M, L> setColumn(List<String> column) {
411411
return this;
412412
}
413413

414+
@Override
415+
public String gainKey(String key) {
416+
if (ENABLE_COLUMN_CONFIG) {
417+
key = ColumnUtil.compatInputKey(key, getTable(), getMethod());
418+
}
419+
return super.gainKey(key);
420+
}
421+
414422
}

0 commit comments

Comments
 (0)