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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.qs.mp.channel.domain.PromoterUser">
        <id column="id" property="id" />
        <result column="promoter_id" property="promoterId" />
        <result column="user_id" property="userId" />
        <result column="channel_id" property="channelId" />
        <result column="created_time" property="createdTime" />
        <result column="updated_time" property="updatedTime" />
        <result column="is_deleted" property="isDeleted" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, promoter_id, user_id, channel_id, created_time, updated_time, is_deleted
    </sql>

    <select id="getPromoterByQueryWrapper" resultType="com.qs.mp.channel.domain.vo.PromoterVO">
        select t5.*
        from mp_promoter_user t1
            left join mp_channel t2 on t1.channel_id = t2.channel_id
            left join mp_channel_order_detail t3 on t2.channel_id = t3.channel_id
            left join mp_ticket t4 on t3.pkg_id = t4.pkg_id
            left join mp_channel t5 on t1.promoter_id = t5.channel_id
        ${ew.customSqlSegment}
    </select>
</mapper>