CategoryController
@GetMapping("/detail")
public Result<Category> detail(Integer id){
Category c = categoryService.findById(id);
return Result.success(c);
}
CategoryService
//根据id查询分类信息
Category findById(Integer id);
CategoryServiceImpl
@Override
public Category findById(Integer id) {
Category c = categoryMapper.findById(id);
return c;
}
CategoryMapper
//根据id查询
@Select("select * from category where id = #{id}")
Category findById(Integer id);