public interface StudentDao2 {
@Select("select * from student where stu_no = #{stu_no}")
@Results({
@Result(property = "stuNo" ,column="stu_no"),
@Result(property = "stuSex",column = "stu_sex"),
@Result(property = "birth",column = "stu_birth")
})
List<Student> getAll(String stu_no);
@Insert("insert into student (stu_no,stu_name,stu_sex,stu_birth)values(#{stuNo},#{stuName},#{stuSex},#{birth})")
int addStudent(Student student);
@Delete("delete from student where stu_no = #{stu_no}")
int delOne(String stu_no);
@Update("update student set stu_name = #{stuName} where stu_no = #{stuNo}")
int uptStudent(Student student);
}
博客展示了使用Java和MyBatis实现学生信息操作的代码。定义了StudentDao2接口,包含查询、插入、删除和更新学生信息的方法,通过注解配置SQL语句,体现了MyBatis在数据操作上的便捷性。
824

被折叠的 条评论
为什么被折叠?



