<resultMap type="java.util.Map"
id="TransactionRecordBaseResultMap">
<result column="TRADE_NO" property="tradeNo" />
<result column="PAY_TYPE" property="payType"
javaType="kulink.cvscloud.core.enums.PayTypeEnum"
typeHandler="kulink.cvscloud.core.utils.EnumTypeHandler" />
id="TransactionRecordBaseResultMap">
<result column="TRADE_NO" property="tradeNo" />
<result column="PAY_TYPE" property="payType"
javaType="kulink.cvscloud.core.enums.PayTypeEnum"
typeHandler="kulink.cvscloud.core.utils.EnumTypeHandler" />
</resultMap>
<select id="selectTransactionRecord" resultMap="TransactionRecordBaseResultMap">
SELECT TRADE_NO,PAY_TYPE
FROM ku_transaction_record LEFT JOIN
ku_order_transaction ON
ku_transaction_record.ID=ku_order_transaction.TRANSACTION_RECORD_ID
WHERE ku_order_transaction.ORDER_ID=#{id}
</select>
跟普通实体的写法一致,只是返回值类型不一样。
在对应的列上加上自定义typeHandler就可以了