1、在mapper.xml中namespace等于mapper接口地址
<mapper namespace="cn.garkey.mybatis.UserMapper">
2、mapper.java接口中的方法名和mapper.xml中statement的id一致
3、mapper.java接口中的方法输入参数类型和mapper.xml中statement的parameterType指定的类型一致
4、mapper.java接口中的方法返回值类型和mapper.xml中statement的resultType指定的类型一致
UserMapper.xml
<select id="findUserById" parameterType="int" resultType="cn.garkey.mybatis.po.User">
SELECT * FROM USER WHERE id=#{value}
</select>
UserMapper.java
public User findUserById(int id) throws Exception;