<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- namespace:该mapper.xml映射文件的 唯一标识 -->
<mapper namespace="org.student.entity.studentMapper">
<!-- 后续通过 namespace.id-->
<!--parameterType:输入参数的类型
resultType:查询返回结果值的类型 ,返回类型 -->
<select id="queryStudentByNumber" parameterType="int" resultType="org.student.entity.Student" >
select * from student where number = #{number}
</select>
<insert id="addStudent" parameterType="org.student.entity.Student" >
insert into student(number,age,name,grade) values(#{number},#{age},#{name},#{grade} )
</insert>
<delete id="deleteStudentByNumebr" parameterType="int">
delete from student where number = #{number}
</delete>
<update id="updateStudentByNumber" parameterType="org.student.entity.Student" >
update student set name=#{name} ,age=#{age},name=#{name} where stuno=#{name}
</update>
<select id="queryAllStudents" resultType="org.student.entity.Student" >
select * from student
</select>
</mapper>
Mybatis中的Mapper.xml
最新推荐文章于 2024-05-03 11:44:49 发布