<?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.ChannelGoodsSettleOrderMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.qs.mp.channel.domain.ChannelGoodsSettleOrder">
        <id column="order_id" property="orderId" />
        <result column="channel_id" property="channelId" />
        <result column="title" property="title" />
        <result column="settle_num" property="settleNum" />
        <result column="order_amt" property="orderAmt" />
        <result column="settle_amt" property="settleAmt" />
        <result column="type" property="type" />
        <result column="pay_type" property="payType" />
        <result column="status" property="status" />
        <result column="settle_channel" property="settleChannel" />
        <result column="pay_time" property="payTime" />
        <result column="created_time" property="createdTime" />
        <result column="updated_time" property="updatedTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        order_id, channel_id, title, settle_num, order_amt, settle_amt, type, pay_type, status, settle_channel, pay_time, created_time, updated_time
    </sql>
    <select id="listGoodsSettleOrder" resultType="com.qs.mp.channel.domain.vo.ChannelSettleVO">
        select t3.order_id as purchaseOrderId,t1.order_id as settleOrderId,t1.order_amt,t1.settle_amt,t1.status,t1.created_time,t1.pay_time
        from mp_channel_goods_settle_order t1
        left join mp_channel_goods_settle_order_item t2 on t1.order_id = t2.order_id
        left join mp_channel_goods t3 on t3.id = channel_goods_id
            ${ew.customSqlSegment}
    </select>

</mapper>