@Controller@RequestMapping("/detail")public class DetailController { @Autowired private DetailService detailService; @RequestMapping("/day") public @ResponseBody Object day(HttpServletRequest request){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); Map<String, Object> params = new HashMap<String, Object>(); //解释一下这个Map有什么作用.谢谢! //获取日期及作者id String date = request.getParameter("date"); String authorid = request.getParameter("authorid"); //为空或为null 赋一个新值 if(date==null||"".equals(date)){ date = sdf.format(new Date()); } //赋值 date params.put("date", date); params.put("authorid", authorid); //调用service List<Map<String, Object>> list = detailService.dayDetail(params); // 清除 params.clear(); // params.put("rows", list); //{rows:[{},{},{}]} json return params; }
添加回答
举报
0/150
提交
取消