<?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.admin.mapper.MarketingAwardsPrizeMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.qs.mp.admin.domain.MarketingAwardsPrize">
        <id column="id" property="id" />
        <result column="marketing_id" property="marketingId" />
        <result column="awards_id" property="awardsId" />
        <result column="ref_id" property="refId" />
        <result column="pic_url" property="picUrl" />
        <result column="title" property="title" />
        <result column="prize_type" property="prizeType" />
        <result column="quantity" property="quantity" />
        <result column="value" property="value" />
        <result column="sort_weight" property="sortWeight" />
        <result column="is_deleted" property="isDeleted" />
        <result column="created_time" property="createdTime" />
        <result column="updated_time" property="updatedTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, marketing_id, awards_id, ref_id, pic_url, title, prize_type, quantity, value, sort_weight, is_deleted, created_time, updated_time
    </sql>
    <select id="listPrizeVO" resultType="com.qs.mp.admin.domain.MarketingAwardsPrize">
        select t1.*,if(t2.coupon_detail is not null, t2.coupon_detail, '') as coupon_detail
        from mp_marketing_awards_prize t1 left join mp_coupon t2 on t1.ref_id = t2.coupon_id
        ${ew.customSqlSegment}
    </select>

</mapper>