<?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.winsun.mapper.activity.ActivityMapper">

    <select id="mobileSelectActivityList" resultType="HashMap" parameterType="String">
        SELECT
            id AS id,
            title,
            `desc`,
            integral,
            image_url AS imageUrl,
            activity_type AS activityType,
            subclass,
            sub_name AS subName,
            sub_school AS subSchool,
            `range`,
            `status`,
            sort,
            is_sub_name AS isSubName,
            create_time AS createTime,
            creator,
            update_time AS updateTime,
            del_flag AS delFlag
              FROM
              hhr_activity
              WHERE
              (del_flag = 0 AND status = 1
                <if test="activityType != null and activityType != ''">
                    AND activity_type = #{activityType}
                </if>
              )
              AND (`range` = '全市' OR `range` = #{subName})
              AND (is_sub_name = 0 OR (is_sub_name = 1 AND sub_name = #{subName}))
              <if test="subClass != null and subClass != ''">
                  AND (subclass = #{subClass})
              </if>


    </select>


</mapper>