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