1. 程式人生 > >【java專案】mybatis中的mapper查詢時返回其他實體(多用於多表查詢)

【java專案】mybatis中的mapper查詢時返回其他實體(多用於多表查詢)

	<select id="selectUserorder" resultType="com.pojo.Orderdetail"
		parameterType="java.lang.Integer">
		SELECT
		a.o_status,
		a.o_no,
		a.uid,
		b.p_home,
		b.p_starttime,
		b.p_endtime,
		b.p_playtype,
		b.p_price,
		c.m_name,
		c.m_pic
		from tb_order
		a,tb_play b, tb_movie c
		where a.uid=#{uid,jdbcType=INTEGER}
		and
		a.pid=b.pid
		and b.`mid`=c.`mid`
	</select>

注意是resultType不是resultMap!!!

而且實體屬性的名稱應該與資料庫列的名稱相同!!!