Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

50.9. update

		
	@RequestMapping(value="/comment/add/{siteId}/{articleId}", method = RequestMethod.POST)
	public ResponseRestful commentAdd(@PathVariable("siteId") int siteId, @PathVariable("articleId") int articleId, @RequestBody Comment comment) {
		String sql = "insert into cms.comment("
				+ "article_id, "
				+ "ctime,"
				+ "content,"
				+ "member_id,"
				+ "nickname,"
				+ "picture"
				+ ") values(?,?,now(),?,?,?,?,?)";

		int count = jdbcTemplate.update(sql, 
				comment.getArticleId(),
				comment.getContent(),
				comment.getMemberId(),
				comment.getNickname(),
				comment.getPicture()
		);
		
		return new ResponseRestful(true, count, "评论添加成功", comment);
	}