2021.3.23

mybatis 的dao层,是接口加接口实现类的(mapper)

Dao接口

public interface UserDao {

public List<User> getUserList();

}

接口实现类 (由原来的UserDaoImpl转变为一个Mapper配置文件)

<?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接口-->
<mapper namespace="com.kuang.dao.UserDao">
<select id="getUserList" resultType="com.kuang.pojo.User">
select * from USER
</select>
</mapper>


posted @ 2021-03-23 20:22  不详·Christina  阅读(46)  评论(0)    收藏  举报