<?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.xxfc.platform.activity.mapper.ActivityPopularizeRelationMapper">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.xxfc.platform.activity.entity.ActivityPopularizeRelation" id="activityPopularizeRelationMap">
        <result property="id" column="id"/>
        <result property="crtTime" column="crt_time"/>
        <result property="updTime" column="upd_time"/>
        <result property="popularizeId" column="popularize_id"/>
        <result property="majorUserId" column="major_user_id"/>
        <result property="minorUserId" column="minor_user_id"/>
    </resultMap>

    <select id="findActivityPopularizeRelationsByActivityIdAndTime" resultMap="activityPopularizeRelationMap">
        select  * from `activity_popularize_relation` where `popularize_id`=#{activityId}
        <if test="startTime != null and endTime !=null">
            and `crt_time` between #{startTime} and #{endTime}
        </if>
        <if test="startTime != null and endTime == null">
            and <![CDATA[ `crt_time` >= #{startTime}]]>
        </if>
        <if test="endTime != null and startTime ==null">
            and <![CDATA[ `crt_time` <= #{endTime}]]>
        </if>
    </select>
</mapper>