黑马程序员2023新版JavaWeb开发教程,实现javaweb企业开发全...

P139 练习 部门管理-修改部门名称
直接看接口文档好像也没有写到底是怎么实现修改的,阅读了前端代码后才清楚具体的请求过程
DeptController中添加代码:
@GetMapping("/{id}")
public Result getById(@PathVariable Integer id)
{
log.info("根据id查找部门:{}",id);
//调用service查找部门
Dept dept = deptService.getById(id);
return Result.success(dept);
}
@PutMapping
public Result modify(@RequestBody Dept dept)
{
log.info("修改部门:{}",dept);
//调用service修改部门
deptService.modify(dept);
return Result.success();
}