@RequestMapping("query")
public ModelAndView query(UserAgent userAgent, HttpServletRequest request) {
ModelAndView modelAndView = new ModelAndView("category/list");
Long userId = userAgent.getUserId();
List<ProductCategory> list = productCategoryService.query(userId);
List<Map<String,Object>> proList = new ArrayList<Map<String,Object>>();
for(ProductCategory p : list){
Map<String,Object> m = new HashMap<String,Object>();
m.put("classId", p.getId());
m.put("className", p.getCategoryName());
m.put("classSort", p.getOrderby());
proList.add(m);
}
JSONArray json = new JSONArray();
json.addAll(proList);
modelAndView.addObject("json",json.toJSONString());
System.out.println(json.toJSONString());
return modelAndView;
}