mirror of https://github.com/jeecgboot/jeecg-boot
增加字典对Reslt中List的支持
parent
2af165b201
commit
1bff6013ef
|
@ -93,7 +93,7 @@ public class DictAspect {
|
||||||
*/
|
*/
|
||||||
private Object parseDictText(Object result) {
|
private Object parseDictText(Object result) {
|
||||||
if (result instanceof Result) {
|
if (result instanceof Result) {
|
||||||
if (((Result) result).getResult() instanceof IPage) {
|
if (((Result) result).getResult() instanceof IPage || ((Result) result).getResult() instanceof List) {
|
||||||
List<JSONObject> items = new ArrayList<>();
|
List<JSONObject> items = new ArrayList<>();
|
||||||
|
|
||||||
//step.1 筛选出加了 Dict 注解的字段列表
|
//step.1 筛选出加了 Dict 注解的字段列表
|
||||||
|
@ -101,7 +101,14 @@ public class DictAspect {
|
||||||
// 字典数据列表, key = 字典code,value=数据列表
|
// 字典数据列表, key = 字典code,value=数据列表
|
||||||
Map<String, List<String>> dataListMap = new HashMap<>(5);
|
Map<String, List<String>> dataListMap = new HashMap<>(5);
|
||||||
//取出结果集
|
//取出结果集
|
||||||
List<Object> records=((IPage) ((Result) result).getResult()).getRecords();
|
List<Object> records= null;
|
||||||
|
|
||||||
|
if (((Result) result).getResult() instanceof List) {
|
||||||
|
records= (List<Object>) ((Result) result).getResult();
|
||||||
|
} else {
|
||||||
|
records= ((IPage) ((Result) result).getResult()).getRecords();
|
||||||
|
}
|
||||||
|
|
||||||
//update-begin--Author:zyf -- Date:20220606 ----for:【VUEN-1230】 判断是否含有字典注解,没有注解返回-----
|
//update-begin--Author:zyf -- Date:20220606 ----for:【VUEN-1230】 判断是否含有字典注解,没有注解返回-----
|
||||||
Boolean hasDict= checkHasDict(records);
|
Boolean hasDict= checkHasDict(records);
|
||||||
if(!hasDict){
|
if(!hasDict){
|
||||||
|
@ -206,10 +213,17 @@ public class DictAspect {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//List 处理
|
||||||
|
if (((Result) result).getResult() instanceof List) {
|
||||||
|
((Result) result).setResult(items);
|
||||||
|
} else {
|
||||||
((IPage) ((Result) result).getResult()).setRecords(items);
|
((IPage) ((Result) result).getResult()).setRecords(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue