<?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.liquidnet.service.sweet.mapper.SweetIntegralActivityMapper">

    <select id="searchActivityList" resultType="com.liquidnet.service.sweet.dto.SweetIntegralActivityDto">
        <!--SELECT
               d.*, sum(b.prize_num) AS prize_num
        FROM (
            SELECT a.*, count(c.prize_id) AS draw_num
            FROM sweet_integral_activity AS a
            LEFT JOIN sweet_integral_activity_draw AS c ON a.integral_activity_id = c.integral_activity_id
            <where>
                <if test="activityTitle != null  and activityTitle != ''">
                    and a.activity_title like concat('%', #{activityTitle}, '%')
                </if>
            </where>
            GROUP BY a.integral_activity_id
            ORDER BY a.integral_activity_id DESC
            ) d
        LEFT JOIN sweet_integral_activity_prize AS b ON d.integral_activity_id = b.integral_activity_id
        GROUP BY d.integral_activity_id-->
        SELECT
        *
        FROM sweet_integral_activity
        <where>
            <if test="activityTitle != null  and activityTitle != ''">
                and activity_title like concat('%', #{activityTitle}, '%')
            </if>
        </where>
        ORDER BY mid DESC
    </select>
</mapper>
