UserMapper.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">
<!--namespace的值=dao层接口的全路径-->
<mapper namespace="cn.jt.dao.UserMapper">
<select id="getAllUser" resultType="User">
select * from user
</select>
<select id="getUserById" resultType="User">
select * from user where id=#{id}
</select>
<select id="getUserByName" resultType="User">
select * from user where name=#{name}
</select>
<insert id="addUser">
insert into user values(#{id},#{name},#{addr},#{age})
</insert>
<update id="updataUser">
update user set name=#{name},addr=#{addr},age