<?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>