<?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.qs.mp.channel.mapper.ChannelOrderDetailMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.qs.mp.channel.domain.ChannelOrderDetail">
        <id column="id" property="id" />
        <result column="order_id" property="orderId" />
        <result column="channel_id" property="channelId" />
        <result column="box_id" property="boxId" />
        <result column="pkg_id" property="pkgId" />
        <result column="start_sn" property="startSn" />
        <result column="end_sn" property="endSn" />
        <result column="created_time" property="createdTime" />
        <result column="updated_time" property="updatedTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, order_id, channel_id, box_id, pkg_id, start_sn, end_sn, created_time, updated_time
    </sql>

    <select id="selectListMyTicketByChannelIdAndchannelMyTicketQueryParam"
            resultType="com.qs.mp.channel.domain.vo.ChannelMyTicketVO">
        SELECT t1.id,
               t1.channel_id,
               t1.box_id,
               t1.pkg_id,
               t1.created_time,
               t2.pkg_no,
               t2.sale_status,
               t2.sale_qty,
               t2.pkg_unit,
               t3.title,
               t3.pic_url,
               t3.face_price,
                t2.is_pre,
                t3.type ticketType
        FROM mp_channel_order_detail t1
         LEFT JOIN mp_ticket_package t2 ON t1.pkg_id = t2.pkg_id
         LEFT JOIN mp_ticket_box t3 ON t2.box_id = t3.box_id
        ${ew.customSqlSegment}
    </select>
</mapper>