mapper.xml模板

眉间皱痕 提交于 2019-12-05 06:38:46
<?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.tsvv.dao.EmplyDao">

    <!-- 数据表列字段与pojo类属性映射关系 type:指定将查询的结果封装到哪个类pojo对象中 id:指定一个唯一表示resultMap的值 -->
    <resultMap type="com.tsvv.pojo.Emply" id="emplyRM">
        <id column="id" property="id" />
        <result column="name" property="name" />
        <result column="tele" property="tele" />
        <result column="addr" property="addr" />
        <result column="birthday" property="birthday" />
        <result column="create_time" property="createTime" />
    </resultMap>
    <!-- 1.查询所有员工信息 id值为对应接口中方法的名字 resultMap:指定为resultMap标签的id值 -->
    <select id="findAll" resultMap="emplyRM">
        select * from tb_emply
    </select>

</mapper>

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!