You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
student_system/springboot/src/main/java/com/example/controller/StudentController.java

44 lines
1.2 KiB

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) {
PageInfo<Student>pageInfo = studentService.selectPage(pageNum,pageSize,student);
return Result.success(pageInfo);
}
}