public ResultVo<Map<String,Object>> findproductchannel(){
JSONObject json = sysconfServiceFeign.getSysconfByNameFeign("json");//写获取json的方法,或者前端传过来也行,我这里是配置的
Map<String, Object> resultMap = new HashMap<>();
if (json != null && json.containsKey("data")) {
JSONObject data = json.getJSONObject("data");
resultMap.put("code", data.getStr("code"));
resultMap.put("name", data.getStr("name"));
}
// 构建返回结果
ResultVo<Map<String,Object>> resultVo = new ResultVo<>();
resultVo.setData(resultMap);
return resultVo;
}
json格式为
{
"data": [{
"code": "333",
"name": "测试"
},
{
"code": "222",
"name": "测试"
},
{
"code": "111",
"name": "测试"
}
]
}