package daoImpl;import beanStudent;import daoStudentDao;import javautilArrayList;public class StudentDaoImpl implements StudentDao Override public ArrayListStudent GetAll return Student
这段代码是一个学生数据访问对象(StudentDao)的实现类(StudentDaoImpl)。 实现了StudentDao接口,并重写了接口中的方法。
- GetAll()方法返回一个ArrayList
,表示获取所有学生的信息。 - get(Integer id)方法接受一个学生id作为参数,返回一个Student对象,表示获取指定id的学生信息。
- add(Student student)方法接受一个Student对象作为参数,返回一个Integer值,表示添加学生信息的结果。
- edit(Student student)方法接受一个Student对象作为参数,返回一个Integer值,表示编辑学生信息的结果。
- delete(Integer id)方法接受一个学生id作为参数,返回一个Integer值,表示删除学生信息的结果。
这里的实现中,调用了StudentDao接口中的默认方法,这些默认方法提供了一些常用的操作,可以直接使用。
原文地址: https://www.cveoy.top/t/topic/iZgT 著作权归作者所有。请勿转载和采集!