<?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.bonus.material.push.mapper.PushDataReceiveInfoMapper">
    <resultMap type="com.bonus.material.push.domain.PushDataReceiveInfo" id="PushDataReceiveInfoResult">
        <result property="id"    column="id"    />
        <result property="receiveStatus"    column="receive_status"    />
        <result property="pushNum"    column="push_num"    />
        <result property="receiveDate"    column="receive_date"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectPushDataReceiveInfoVo">
        select id, receive_status, push_num, receive_date, create_time, update_time from push_data_receive_info
    </sql>

    <select id="selectPushDataReceiveInfoList" parameterType="com.bonus.material.push.domain.PushDataReceiveInfo" resultMap="PushDataReceiveInfoResult">
        <include refid="selectPushDataReceiveInfoVo"/>
        <where>  
            <if test="receiveStatus != null "> and receive_status = #{receiveStatus}</if>
            <if test="pushNum != null "> and push_num = #{pushNum}</if>
            <if test="receiveDate != null "> and receive_date = #{receiveDate}</if>
        </where>
    </select>
    
    <select id="selectPushDataReceiveInfoById" parameterType="Long" resultMap="PushDataReceiveInfoResult">
        <include refid="selectPushDataReceiveInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertPushDataReceiveInfo" parameterType="com.bonus.material.push.domain.PushDataReceiveInfo" useGeneratedKeys="true" keyProperty="id">
        insert into push_data_receive_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="receiveStatus != null">receive_status,</if>
            <if test="pushNum != null">push_num,</if>
            <if test="receiveDate != null">receive_date,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="receiveStatus != null">#{receiveStatus},</if>
            <if test="pushNum != null">#{pushNum},</if>
            <if test="receiveDate != null">#{receiveDate},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updatePushDataReceiveInfo" parameterType="com.bonus.material.push.domain.PushDataReceiveInfo">
        update push_data_receive_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="receiveStatus != null">receive_status = #{receiveStatus},</if>
            <if test="pushNum != null">push_num = #{pushNum},</if>
            <if test="receiveDate != null">receive_date = #{receiveDate},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePushDataReceiveInfoById" parameterType="Long">
        delete from push_data_receive_info where id = #{id}
    </delete>

    <delete id="deletePushDataReceiveInfoByIds" parameterType="String">
        delete from push_data_receive_info where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>