<?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.ruoyi.ss.wxPayNotify.mapper.SmWxPayNotifyMapper">

    <resultMap type="SmWxPayNotify" id="SmWxPayNotifyResult">
        <result property="notifyId"    column="notify_id"    />
        <result property="billId"    column="bill_id"    />
        <result property="body"    column="body"    />
        <result property="plaintext"    column="plaintext"    />
    </resultMap>

    <sql id="selectSmWxPayNotifyVo">
        select notify_id, bill_id, body, plaintext from sm_wx_pay_notify
    </sql>

    <select id="selectSmWxPayNotifyList" parameterType="SmWxPayNotify" resultMap="SmWxPayNotifyResult">
        <include refid="selectSmWxPayNotifyVo"/>
        <where>
            <if test="billId != null "> and bill_id = #{billId}</if>
            <if test="body != null  and body != ''"> and body = #{body}</if>
            <if test="plaintext != null  and plaintext != ''"> and plaintext = #{plaintext}</if>
        </where>
    </select>

    <select id="selectSmWxPayNotifyByNotifyId" parameterType="Long" resultMap="SmWxPayNotifyResult">
        <include refid="selectSmWxPayNotifyVo"/>
        where notify_id = #{notifyId}
    </select>

    <insert id="insertSmWxPayNotify" parameterType="SmWxPayNotify">
        insert into sm_wx_pay_notify
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="notifyId != null">notify_id,</if>
            <if test="billId != null">bill_id,</if>
            <if test="body != null">body,</if>
            <if test="plaintext != null">plaintext,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="notifyId != null">#{notifyId},</if>
            <if test="billId != null">#{billId},</if>
            <if test="body != null">#{body},</if>
            <if test="plaintext != null">#{plaintext},</if>
         </trim>
    </insert>

    <update id="updateSmWxPayNotify" parameterType="SmWxPayNotify">
        update sm_wx_pay_notify
        <trim prefix="SET" suffixOverrides=",">
            <if test="billId != null">bill_id = #{billId},</if>
            <if test="body != null">body = #{body},</if>
            <if test="plaintext != null">plaintext = #{plaintext},</if>
        </trim>
        where notify_id = #{notifyId}
    </update>

    <delete id="deleteSmWxPayNotifyByNotifyId" parameterType="Long">
        delete from sm_wx_pay_notify where notify_id = #{notifyId}
    </delete>

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