时间:2021-07-01 10:21:17 帮助过:2人阅读
package action; import dao.CourseDao; import model.Course; import java.sql.SQLException; import java.util.List; /** * Created by yinus * Date:2016/4/6 * Time:18:43 */ public class CourseAction { public void add(Course course) throws SQLException { CourseDao courseDao = new CourseDao(); courseDao.addCourse(course); } public void update(Course course) throws SQLException { CourseDao courseDao = new CourseDao(); courseDao.updateCourse(course); } public void delete(int id) throws SQLException { CourseDao courseDao = new CourseDao(); courseDao.delCourse(id); } public List<Course> queryByName(String name) throws SQLException { CourseDao courseDao = new CourseDao(); return courseDao.queryCourses(name); } public Course queryById(int id) throws SQLException { CourseDao courseDao = new CourseDao(); return courseDao.querySingleCourse(id); } }
package action; import dao.StudentDao; import model.Student; import java.sql.SQLException; import java.util.List; /** * Created by yinus * Date:2016/4/6 * Time:18:43 */ public class StudentAction { public void add(Student student) throws SQLException { StudentDao studentDao = new StudentDao(); studentDao.addStudent(student); } public void update(Student student) throws SQLException { StudentDao studentDao = new StudentDao(); studentDao.updateStudent(student); } public void delete(int id) throws SQLException { StudentDao studentDao = new StudentDao(); studentDao.delStudent(id); } public List<Student> queryByName(String name) throws SQLException { StudentDao studentDao = new StudentDao(); return studentDao.queryStudents(name); } public Student queryById(int id) throws SQLException { StudentDao studentDao = new StudentDao(); return studentDao.querySingleStudent(id); } }
第二次数据库作业--action
标签: