mybatis查詢是一對多關係
<collection property="passengers" ofType="com.model.Passenger">
<result column="pax_nm" property="cjrName"/>
</collection>
<resultMap type="com.model.OrderInfo" id="orderMap">
<result column="id" property="orderNo"/>
<result column="order_type" property="orderType"/>
<result column="crs_pnr_ref" property="pnrNo"/>
<result column="bill_no" property="billno"/>
<result column="pnr_serial_no" property="serialNo"/>
<result column="fare_source" property="fareSource"/>
<result column="bank_id" property="bankId"/>
<result column="orgid" property="orgId"/>
<result column="pay_date" property="payDateTime"/>
<result column="carr_cd" property="caName"/>
<result column="qfDate" property="qfDate"/>
<result column="flightNo" property="flightNo"/>
<result column="qfTime" property="qfTime"/>
<result column="arrTime" property="arrTime"/>
<result column="qfPoint" property="qfPoint"/>
<result column="arrPoint" property="arrPoint"/>
<result column="alarmID" property="alarmId"/>
<result column="alarmType" property="alarmType"/>
<collection property="passengers" ofType="com.model.Passenger">
<result column="pax_nm" property="cjrName"/>
</collection>
</resultMap>
<select id="queryPayingEnsure" resultMap="orderMap" flushCache="false" parameterType="java.lang.String">
SELECT t3.id,
t3.order_type,
t3.crs_pnr_ref,
t3.pnr_serial_no,
t3.fare_source,
t2.bill_no ,
t2.bank_id,
t2.orgid,
t2.pay_date,
t4.pax_nm
FROM ETP_T_ORDER_SUB t3
JOIN ETP_T_SETTLEMENT_INFO t2 ON t3.id = t2.order_id
JOIN ETP_T_PASSENGER t4 ON t4.order_id=t3.id
WHERE
t3.order_status = '2'
AND (to_date(#{dateStr,jdbcType=VARCHAR},'yyyy-mm-dd HH24:MI:SS')- to_date(t2.pay_date,'yyyy-mm-dd HH24:MI:SS'))*24*60>5
<![CDATA[
AND (SELECT count(1) FROM ETP_T_ABNORMAL_ALARM r
WHERE r.alarm_type='0' and r.order_id = t3.id
and r.alarm_sms = '1' and r.delete_flag = 'N') < 3
]]>
</select>