<?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.system.mapper.IpnLogMapper">
    
    <resultMap type="IpnLog" id="IpnLogResult">
        <result property="id"    column="id"    />
        <result property="ip"    column="ip"    />
        <result property="cretim"    column="cretim"    />
        <result property="ipnLog"    column="ipn_log"    />
    </resultMap>

    <sql id="selectIpnLogVo">
        select id, ip, cretim, ipn_log from ipn_log
    </sql>

    <select id="selectIpnLogList" parameterType="IpnLog" resultMap="IpnLogResult">
        <include refid="selectIpnLogVo"/>
        <where>  
            <if test="ip != null  and ip != ''"> and ip = #{ip}</if>
            <if test="cretim != null "> and cretim = #{cretim}</if>
        </where>
    </select>
    
    <select id="selectIpnLogById" parameterType="Long" resultMap="IpnLogResult">
        <include refid="selectIpnLogVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertIpnLog" parameterType="IpnLog" useGeneratedKeys="true" keyProperty="id">
        insert into ipn_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ip != null">ip,</if>
            <if test="cretim != null">cretim,</if>
            <if test="ipnLog != null">ipn_log,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ip != null">#{ip},</if>
            <if test="cretim != null">#{cretim},</if>
            <if test="ipnLog != null">#{ipnLog},</if>
         </trim>
    </insert>

    <update id="updateIpnLog" parameterType="IpnLog">
        update ipn_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="ip != null">ip = #{ip},</if>
            <if test="cretim != null">cretim = #{cretim},</if>
            <if test="ipnLog != null">ipn_log = #{ipnLog},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIpnLogById" parameterType="Long">
        delete from ipn_log where id = #{id}
    </delete>

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