<?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.model.mapper.IndexPartnerConfigMapper">
    
    <resultMap type="IndexPartnerConfig" id="IndexPartnerConfigResult">
        <result property="partnerBackground"    column="partner_background"    />
        <result property="prompt"    column="prompt"    />
        <result property="promptText"    column="prompt_text"    />
    </resultMap>

    <sql id="selectIndexPartnerConfigVo">
        select partner_background, prompt, prompt_text from index_partner_config
    </sql>

    <select id="selectIndexPartnerConfigList" parameterType="IndexPartnerConfig" resultMap="IndexPartnerConfigResult">
        <include refid="selectIndexPartnerConfigVo"/>
        <where>  
            <if test="partnerBackground != null  and partnerBackground != ''"> and partner_background = #{partnerBackground}</if>
            <if test="prompt != null  and prompt != ''"> and prompt = #{prompt}</if>
            <if test="promptText != null  and promptText != ''"> and prompt_text = #{promptText}</if>
        </where>
    </select>
    
    <select id="selectIndexPartnerConfigByPartnerBackground" parameterType="String" resultMap="IndexPartnerConfigResult">
        <include refid="selectIndexPartnerConfigVo"/>
        where partner_background = #{partnerBackground}
    </select>
    <select id="getIndexPartnerConfigList" resultType="com.ruoyi.model.domain.IndexPartnerConfig">
        <include refid="selectIndexPartnerConfigVo"/>
    </select>

    <insert id="insertIndexPartnerConfig" parameterType="IndexPartnerConfig">
        insert into index_partner_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="partnerBackground != null">partner_background,</if>
            <if test="prompt != null">prompt,</if>
            <if test="promptText != null">prompt_text,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="partnerBackground != null">#{partnerBackground},</if>
            <if test="prompt != null">#{prompt},</if>
            <if test="promptText != null">#{promptText},</if>
         </trim>
    </insert>

    <update id="updateIndexPartnerConfig" parameterType="IndexPartnerConfig">
        update index_partner_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="prompt != null">prompt = #{prompt},</if>
            <if test="promptText != null">prompt_text = #{promptText},</if>
        </trim>
        where partner_background = #{partnerBackground}
    </update>

    <delete id="deleteIndexPartnerConfigByPartnerBackground" parameterType="String">
        delete from index_partner_config where partner_background = #{partnerBackground}
    </delete>

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