|
@@ -5,14 +5,38 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
@RestController
|
|
@RestController
|
|
public class StudentController {
|
|
public class StudentController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private StudentService studentService;
|
|
private StudentService studentService;
|
|
|
|
|
|
|
|
+ @RequestMapping( value = "/add", method = RequestMethod.POST)
|
|
|
|
+ public int add(Student student) {
|
|
|
|
+ return studentService.add(student);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping( value = "/update", method = RequestMethod.POST)
|
|
|
|
+ public int update(Student student) {
|
|
|
|
+ return studentService.update(student);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
@RequestMapping( value = "/querystudent", method = RequestMethod.GET)
|
|
@RequestMapping( value = "/querystudent", method = RequestMethod.GET)
|
|
public Student queryStudentBySno(String sno) {
|
|
public Student queryStudentBySno(String sno) {
|
|
- return this.studentService.queryStudentBySno(sno);
|
|
|
|
|
|
+ return studentService.queryStudentBySno(sno);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/queryStudents", method = RequestMethod.GET)
|
|
|
|
+ public List<Student> queryStudents() {
|
|
|
|
+ return studentService.queryStudents();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @RequestMapping( value = "/delete", method = RequestMethod.DELETE)
|
|
|
|
+ public int deleteBysno(String sno) {
|
|
|
|
+ return studentService.deleteBysno(sno);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|