|
@@ -334,7 +334,7 @@ public class TableServiceCmdService {
|
|
* @param queryBySql queryBySql
|
|
* @param queryBySql queryBySql
|
|
* @return com.boman.domain.dto.AjaxResult
|
|
* @return com.boman.domain.dto.AjaxResult
|
|
*/
|
|
*/
|
|
- public AjaxResult queryListBySql(QueryBySqlDto queryBySql) {
|
|
|
|
|
|
+ public AjaxResult queryListByUnionTable(QueryBySqlDto queryBySql) {
|
|
String primaryTableName = queryBySql.getPrimaryTableName();
|
|
String primaryTableName = queryBySql.getPrimaryTableName();
|
|
String deputyTableName = queryBySql.getDeputyTableName();
|
|
String deputyTableName = queryBySql.getDeputyTableName();
|
|
String primaryTableNameRelKey = queryBySql.getPrimaryTableNameRelKey();
|
|
String primaryTableNameRelKey = queryBySql.getPrimaryTableNameRelKey();
|
|
@@ -348,51 +348,47 @@ public class TableServiceCmdService {
|
|
List<GenTableColumn> columns = primaryGenTable.getColumns();
|
|
List<GenTableColumn> columns = primaryGenTable.getColumns();
|
|
GenTable deputyGenTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, deputyTableName);
|
|
GenTable deputyGenTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, deputyTableName);
|
|
List<GenTableColumn> deputyColumns = deputyGenTable.getColumns();
|
|
List<GenTableColumn> deputyColumns = deputyGenTable.getColumns();
|
|
- columns.addAll(deputyColumns);
|
|
|
|
|
|
+ List<GenTableColumn> allColumnName = new ArrayList<>(columns);
|
|
|
|
+ allColumnName.addAll(deputyColumns);
|
|
// 查询条件
|
|
// 查询条件
|
|
JSONObject condition = queryBySql.getCondition();
|
|
JSONObject condition = queryBySql.getCondition();
|
|
// 权限
|
|
// 权限
|
|
checkAuthQueryList(primaryGenTable, condition);
|
|
checkAuthQueryList(primaryGenTable, condition);
|
|
// 检查列
|
|
// 检查列
|
|
- checkLeftJoinColumn(condition.keySet(), columns);
|
|
|
|
|
|
+ checkLeftJoinColumn(condition.keySet(), allColumnName);
|
|
// 封装好以后的查询条件
|
|
// 封装好以后的查询条件
|
|
- JSONObject packCondition = ifNullSetEmpty(ColumnUtils.packColCondition(columns, condition));
|
|
|
|
|
|
+ JSONObject packCondition = ifNullSetEmpty(ColumnUtils.packLeftJoinCondition(allColumnName, condition));
|
|
|
|
|
|
JSONObject rows = new JSONObject();
|
|
JSONObject rows = new JSONObject();
|
|
int total = selectService.countByLeftJoinCondition(packCondition, queryBySql);
|
|
int total = selectService.countByLeftJoinCondition(packCondition, queryBySql);
|
|
rows.put(FormDataConstant.PAGE_TOTAL, total);
|
|
rows.put(FormDataConstant.PAGE_TOTAL, total);
|
|
rows.put(TABLE_HEAD_LIST, getTableHeadList(primaryGenTable));
|
|
rows.put(TABLE_HEAD_LIST, getTableHeadList(primaryGenTable));
|
|
if (total <= 0) {
|
|
if (total <= 0) {
|
|
- rows.put(FormDataConstant.PAGE_ROWS, new ArrayList<>());
|
|
|
|
|
|
+ rows.put(FormDataConstant.PAGE_ROWS, new ArrayList<>(0));
|
|
return AjaxResult.success(rows);
|
|
return AjaxResult.success(rows);
|
|
}
|
|
}
|
|
|
|
|
|
List<String> showData = queryBySql.getShowData();
|
|
List<String> showData = queryBySql.getShowData();
|
|
- // 检查列
|
|
|
|
- checkColumn(showData, columns);
|
|
|
|
// 需要返回到前台的列, 需要判断是否是列表展示, 4为判断列表是否可见
|
|
// 需要返回到前台的列, 需要判断是否是列表展示, 4为判断列表是否可见
|
|
showData = filterData(columns, 4, showData, MaskConstant.LIST_VISIBLE::equals);
|
|
showData = filterData(columns, 4, showData, MaskConstant.LIST_VISIBLE::equals);
|
|
// 表的id单独处理,不管mask,都查出来返给前台
|
|
// 表的id单独处理,不管mask,都查出来返给前台
|
|
IdUtils.putIfNotContains(showData, IdUtils.getPkName(columns));
|
|
IdUtils.putIfNotContains(showData, IdUtils.getPkName(columns));
|
|
List<JSONObject> result = selectService.selectByLeftJoinCondition(queryBySql, packCondition, showData);
|
|
List<JSONObject> result = selectService.selectByLeftJoinCondition(queryBySql, packCondition, showData);
|
|
-// result = filter(result, ObjectUtils::isNotEmpty);
|
|
|
|
-//
|
|
|
|
-// // 查询时为null的列不显示的处理
|
|
|
|
-// handleNullColumnValue(result, showData);
|
|
|
|
-//
|
|
|
|
-// // 处理blob
|
|
|
|
-// handleBlob(result, genTable.getIsContainsBlob());
|
|
|
|
-// // 处理日期、外键、字典值
|
|
|
|
-// handleDictForQueryList(result, columns);
|
|
|
|
-// handleDateTimeForQueryList(result, columns);
|
|
|
|
-// handleFkForQueryList(result, columns);
|
|
|
|
-//
|
|
|
|
-// // 定制接口
|
|
|
|
-// result = isCustomized(dto.getTable(), result, "trigger_retrieve");
|
|
|
|
-//
|
|
|
|
-// rows.put(PAGE_ROWS, result);
|
|
|
|
-// return AjaxResult.success(rows);
|
|
|
|
- return AjaxResult.success();
|
|
|
|
|
|
+ result = filter(result, ObjectUtils::isNotEmpty);
|
|
|
|
+
|
|
|
|
+ // 查询时为null的列不显示的处理
|
|
|
|
+ handleNullColumnValue(result, showData);
|
|
|
|
+ // 处理blob
|
|
|
|
+ handleBlob(result, primaryGenTable.getIsContainsBlob());
|
|
|
|
+ // 处理日期、外键、字典值
|
|
|
|
+ handleDictForQueryList(result, columns);
|
|
|
|
+ handleDateTimeForQueryList(result, columns);
|
|
|
|
+ handleFkForQueryList(result, columns);
|
|
|
|
+
|
|
|
|
+ // 定制接口
|
|
|
|
+ result = isCustomized(primaryGenTable.getTableName(), result, "trigger_retrieve");
|
|
|
|
+ rows.put(PAGE_ROWS, result);
|
|
|
|
+ return AjaxResult.success(rows);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|