/** * /api/xcx/post/findById */ @ResponseBody @RequestMapping("/findById") public JSONObject findById(@RequestParam(value = "postId", required = false) Integer postId) throws Exception { Post post = postDao.findId(postId); post.setClickHit(post.getClickHit()+1); postDao.save(post); List<PostImg> postImgs = postImgDao.findByPostId(postId); JSONObject result = new JSONObject(); result.put("post", post); result.put("postImgs", postImgs); return result; }
/** * /api/xcx/post/findById?blogId=1 */ @ResponseBody @RequestMapping("/findById") public Map<String,Object> findById(@RequestParam(value = "postId", required = false) Integer postId) throws Exception { Post post = postDao.findId(postId); post.setClickHit(post.getClickHit()+1); postDao.save(post); List<PostImg> postImgs = postImgDao.findByPostId(postId); Map<String,Object> map = new HashMap<String,Object>(); map.put("post", post); map.put("postImgs", postImgs); return map; }
站长微信:xiaomao0055
站长QQ:14496453