package com.example.controller; import com.example.common.Result; import com.example.entity.Student; import com.example.service.StudentService; import com.github.pagehelper.PageInfo; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @RestController @RequestMapping("/student") public class StudentController { @Resource StudentService studentService; @PostMapping("/add") public Result add(@RequestBody Student student) { studentService.add(student); return Result.success(); } @DeleteMapping("/delete/{id}") public Result delete(@PathVariable Integer id) { studentService.deleteById(id); return Result.success(); } @PutMapping ("/update") public Result update(@RequestBody Student student) { studentService.updateById(student); return Result.success(); } @GetMapping ("/selectPage") public Result selectPage(@RequestParam(defaultValue = "1")Integer pageNum, @RequestParam(defaultValue = "10")Integer pageSize, Student student) { PageInfopageInfo = studentService.selectPage(pageNum,pageSize,student); return Result.success(pageInfo); } }