7.dao层接口与接口xml配置
public interface UserDao {
List<User> getUserList();
User getUser(int id);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bm.dao.UserDao">
<select id="getUserList" resultType="com.bm.pojo.User">
select * from user
</select>
<select id="getUser" resultType="com.bm.pojo.User">
select * from user where id = #{id}
</select>
</mapper>

浙公网安备 33010602011771号