springMvc directly and automatically converts the configuration of the object to json (you don't need to convert it to json yourself)

springMvc directly and automatically converts the configuration of the object to json (you don't need to convert it to json yourself)

 

 /**

  * According to search conditions, order classification Query order data (purchase)

  */

 @RequestMapping(value = "/myPurchase",produces="application/json")//Convert directly to json

 @ResponseBody 

 public  Object findMyPurchase(Integer status,@RequestParam Map<String,String> searchData,Integer pageSize,Integer pageNum){

 String searchKey=searchData.get("searchData[key]");

 String searchValue=searchData.get("searchData[value]");

 logger.debug("My purchase order classification status:"+status+"Search condition:"+searchKey+"--"+searchValue+"Number of pages:"+pageSize+"Number of pages:"+pageNum);

 // get logged in user

 CusUserBean cusUserBean = CASUtil.getCusUserBean ();

 String CustomerKey="";

 if(cusUserBean==null){

 return "";

 }else{

CustomerKey=cusUserBean.getCustomerKey();

 }

 //Query conditions

 Map<String,Object> map=new HashMap<>();

 map.put("buyId", CustomerKey);

 if(status!=null&&status!=0){

 map.put("orderstatustype", status);

 }

 if(!searchKey.equals("")&&!searchValue.equals("")){

 map.put(searchKey.trim(), searchValue);

 }

 // paging information

 SplitPageVo sp =null;

 if(pageSize!=null&&pageNum!=null){

 sp=new SplitPageVo();

 sp.setPageSize(pageSize);

 sp.setCurrentPage(pageNum-1);

 }

 Map<String, Object> maps=orderIronServ.getByOrdertypenameno(map,sp);

 return maps;

 }

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326226109&siteId=291194637