4.19
//controller
@PutMapping
public Result update(@RequestBody @Validated Article article){
articleService.update(article);
return Result.success();
}
//service
void update(Article article);
//serviceImpl
@Override
public void update(Article article) {
article.setUpdateTime(LocalDateTime.now());
articleMapper.update(article);
}
//mapper
@Update("update article set title=#{title},content=#{content},cover_img=#{coverImg},state=#{state},category_id=#{categoryId},update_time=#{updateTime} where id=#{id}")
void update(Article article);