<?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.SysSmsBlacklistMapper">
    
    <resultMap type="SysSmsBlacklist" id="SysSmsBlacklistResult">
        <result property="id"    column="id"    />
        <result property="phoneNo"    column="phone_no"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectSysSmsBlacklistVo">
        select id, phone_no, create_time from sys_sms_blacklist
    </sql>

    <select id="selectSysSmsBlacklistList" parameterType="SysSmsBlacklist" resultMap="SysSmsBlacklistResult">
        <include refid="selectSysSmsBlacklistVo"/>
        <where>  
            <if test="phoneNo != null  and phoneNo != ''"> and phone_no = #{phoneNo}</if>
        </where>
    </select>
    
    <select id="selectSysSmsBlacklistById" parameterType="Long" resultMap="SysSmsBlacklistResult">
        <include refid="selectSysSmsBlacklistVo"/>
        where id = #{id}
    </select>

    <insert id="insertSysSmsBlacklist" parameterType="SysSmsBlacklist" useGeneratedKeys="true" keyProperty="id">
        insert into sys_sms_blacklist
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="phoneNo != null">phone_no,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="phoneNo != null">#{phoneNo},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateSysSmsBlacklist" parameterType="SysSmsBlacklist">
        update sys_sms_blacklist
        <trim prefix="SET" suffixOverrides=",">
            <if test="phoneNo != null">phone_no = #{phoneNo},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSysSmsBlacklistById" parameterType="Long">
        delete from sys_sms_blacklist where id = #{id}
    </delete>

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