Commit 9795a4c5 by WeiCong

1.对返回list字段,增加__data后缀配置规则,这样返回的list数据是集合,而不加则返回map(包含data属性和pagenation属性)

parent 6d498c6d
......@@ -231,27 +231,34 @@ public abstract class AbstractCommonController {
}
private void doHandleReturnDataForModuleList(Alias alias, String aliasKey, Map<String, Object> dataMap, IModuleList moduleList, List<Map> lst, NoUiRequest noUiRequest) {
Map<String, Object> item = new HashMap<>();
//查询数据
item.put(Constants.DATA, lst);
if (noUiRequest.isSelByPagination()) {
//分页信息
if(aliasKey.endsWith("__data")){
//直接返回结果集
dataMap.put(aliasKey, lst);
}else{
//对该list封装一层,data属性表示实际结果集;pagination属性(分页请求下才有)表示分页信息
Map<String, Object> item = new HashMap<>();
//查询数据
item.put(Constants.DATA, lst);
if (noUiRequest.isSelByPagination()) {
//分页信息
/*int total = moduleList.fullSize();
int index = moduleList.getPage();
Map<String, Object> pagination = new HashMap<>();
pagination.put(Constants.PAGINATION_TOTAL, total);
pagination.put(Constants.PAGINATION_INDEX, index);
item.put(Constants.PAGINATION, pagination);*/
Map<String, Object> paginationInfo =AbstractCache.getPageInfo(moduleList);
if(paginationInfo!=null){
item.put(Constants.PAGINATION, paginationInfo);
Map<String, Object> paginationInfo =AbstractCache.getPageInfo(moduleList);
if(paginationInfo!=null){
item.put(Constants.PAGINATION, paginationInfo);
}
}
if (alias.isSingleLst()) {
dataMap.put(Constants.SIGNLE_LST, item);
} else {
dataMap.put(aliasKey, item);
}
}
if (alias.isSingleLst()) {
dataMap.put(Constants.SIGNLE_LST, item);
} else {
dataMap.put(aliasKey, item);
}
}
private Map<String, Object> handleReturnData(String eventType, NoUiContext context, NoUiRequest noUiRequest, Alias alias) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment