CategoryController
@PutMapping
public Result update(@RequestBody @Validated Category category){
categoryService.update(category);
return Result.success();
}
CategoryService
//更新分类
void update(Category category);
CategoryServiceImpl
@Override
public void update(Category category) {
category.setUpdateTime(LocalDateTime.now());
categoryMapper.update(category);
}
CategoryMapper
//更新
@Update("update category set category_name=#{categoryName},category_alias=#{categoryAlias},update_time=#{updateTime} where id = #{id}")
void update(Category category);