|
@@ -203,7 +203,8 @@ public class TableServiceCmdService {
|
|
|
|
|
|
List<JSONObject> result = selectService.selectByCondition(genTable.getTableName(), condition, packCondition
|
|
|
, showData, dto.getOrderBy(), dto.getLimit(), dto.getOffset());
|
|
|
- handlerDate(result);
|
|
|
+ handlerDate(result, columns);
|
|
|
+ handlerSysDictData(result, columns);
|
|
|
result = isCustomized(dto.getTable(),result,"trigger_retrieve");
|
|
|
rows.put(FormDataConstant.PAGE_ROWS, result);
|
|
|
return AjaxResult.success(rows);
|
|
@@ -214,13 +215,38 @@ public class TableServiceCmdService {
|
|
|
*
|
|
|
* @param result 被转的数据
|
|
|
*/
|
|
|
- private void handlerDate(List<JSONObject> result) {
|
|
|
+ private void handlerDate(List<JSONObject> result, List<GenTableColumn> columns) {
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isEmpty(result)) {
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
for (JSONObject jsonObject : result) {
|
|
|
- getStrByTimeStamp(jsonObject, FormDataConstant.CREATE_TIME);
|
|
|
- getStrByTimeStamp(jsonObject, FormDataConstant.UPDATE_TIME.toLowerCase());
|
|
|
+ for (GenTableColumn column : columns) {
|
|
|
+ if (jsonObject.containsKey(column.getColumnName()) && DATETIME.equalsIgnoreCase(column.getColumnType())) {
|
|
|
+ getStrByTimeStamp(jsonObject, column.getColumnName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 功能描述: 把返回值中含有字典值的转为可视化的心事
|
|
|
+ *
|
|
|
+ * @param result 被转的数据
|
|
|
+ */
|
|
|
+ private void handlerSysDictData(List<JSONObject> result, List<GenTableColumn> columns) {
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(result)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (JSONObject jsonObject : result) {
|
|
|
+ for (GenTableColumn column : columns) {
|
|
|
+ String dictType = column.getDictType();
|
|
|
+ if (isNotEmpty(dictType) && jsonObject.containsKey(column.getColumnName())) {
|
|
|
+ String dictLabel = remoteDictDataService.selectDictLabel(dictType, jsonObject.getString(column.getColumnName()));
|
|
|
+ jsonObject.put(column.getColumnName(), dictLabel);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -233,7 +259,6 @@ public class TableServiceCmdService {
|
|
|
private void getStrByTimeStamp(JSONObject jsonObject, String columnType) {
|
|
|
Date date = jsonObject.getTimestamp(columnType);
|
|
|
if (null != date) {
|
|
|
-
|
|
|
jsonObject.put(columnType, DateUtils.dateTime(date));
|
|
|
}
|
|
|
}
|