<?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.cms.mapper.SensitiveWordDataMapper">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="SensitiveWordData" id="sensitiveWordDataResult">
        <result property="id" column="id"/>
        <result property="sensitiveWord" column="sensitive_word"/>
        <result property="type" column="type"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>


    <sql id="sensitiveWordDataVo">
        select id, sensitive_word, type, del_flag, create_by, create_time, update_by, update_time, remark from sensitive_word_data
    </sql>

    <select id="selectSensitiveworddataList" resultMap="sensitiveWordDataResult" parameterType="SensitiveWordData">
        <include refid="sensitiveWordDataVo"/>
        <where>  del_flag = '0'
            <if test="sensitiveWord != null  and sensitiveWord != ''"> and sensitive_word like concat('%', cast(#{sensitiveWord, jdbcType=VARCHAR} as varchar), '%')</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
        </where>
    </select>

    <insert id="batchInsert" parameterType="java.util.List">
        INSERT INTO sensitive_word_data (sensitive_word, type, create_time,create_by,del_flag,remark)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.sensitiveWord}, #{item.type}, #{item.createTime},#{item.createBy},#{item.delFlag},#{item.remark})
        </foreach>
    </insert>

</mapper>
