请求controller:增删改查
package com.imau.controller;
import java.util.List;
import com.imau.entry.Student;
import com.imau.service.StudentService;
public class StudentController {
private StudentService service;
public StudentController() {
service=new StudentService();
}
//1.请求初始化数据
public List<Student> queryAll(){
return service.getAll();
}
//2.添加学生请求
public boolean add(Student student) {
return service.addStu(student);
}
//3.修改学生请求
public boolean update(Student student) {
return service.updateStu(student);
}
//3.通过ID 查询对象
public Student findStudent(long id) {
Student student=new Student();
student.setId(id);
return service.byId(student);
}
//删除学生
public boolean delStudent(long id) {
Student student=new Student();
student.setId(id);
return service.delById(student);
}
//搜索请求
public List<Student> search(String field,Object value){
return service.searchStu(field, value