sqlMapper.xml的基本解析
<?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">
<!--映射的接口名称-->
<mapper namespace="com.cn.Dao.StudentDao">
<!--
id: dao接口中对应的方法的名称
parameterType:参数类型,应该写全限定名,但是因为在mybatis-config.xml 中使用了
<typeAliases><package name="com.cn.Bean"/> </typeAliases>所以,
不需要再写全限定名称,单写类名就可以
-->
<insert id="save" parameterType="Student" >
insert into student values(
#{id},
#{sname},
#{age}
)
</insert>
<!-- 查询数据 -->
<select id="findStussByIds" resultMap="stussMap">
SELECT
*
FROM student
</select>
<!-- 修改数据 -->
<update id="updateStusss" parameterType="student">
UPDATE student
set
class = #{class}
WHERE = #{item}
</update>
<!-- 根据主键删除数据 -->
<delete id="deleteStussById" parameterType="student">
DELETE FROM student WHERE id= #{id}
</delete>
</mapper>