<?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.miaxis.activities.mapper.ActivitiesTmallMapper">

    <resultMap type="ActivitiesTmall" id="ActivitiesTmallResult">
        <result property="id"    column="id"    />
        <result property="tmallNo"    column="tmall_no"    />
        <result property="isExchange"    column="is_exchange"    />
        <result property="exchangeTime"    column="exchange_time"    />
        <result property="activitiesType"    column="activities_type"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectActivitiesTmallVo">
        select * from activities_tmall
    </sql>

    <select id="selectActivitiesTmallList" parameterType="ActivitiesTmall" resultMap="ActivitiesTmallResult">
        <include refid="selectActivitiesTmallVo"/>
        <where>
            <if test="tmallNo != null  and tmallNo != ''"> and tmall_no = #{tmallNo}</if>
            <if test="isExchange != null "> and is_exchange = #{isExchange}</if>
            <if test="exchangeTime != null "> and exchange_time = #{exchangeTime}</if>
            <if test="activitiesType != null "> and activities_type = #{activitiesType}</if>
        </where>
    </select>


    <select id="getByTmallNoWithPhoneBill" parameterType="string" resultType="com.miaxis.activities.domain.ActivitiesTmall">
        select * from activities_tmall
        <where>
            activities_type =1 and
            tmall_no = #{tmallNo}
        </where>
    </select>

</mapper>
