<?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.FinalConfigMapper">
    
    <resultMap type="FinalConfig" id="FinalConfigResult">
        <result property="id"    column="id"    />
        <result property="finalImage"    column="final_image"    />
        <result property="finalText"    column="final_text"    />
    </resultMap>

    <sql id="selectFinalConfigVo">
        select id, final_image, final_text from final_config
    </sql>

    <select id="selectFinalConfigList" parameterType="FinalConfig" resultMap="FinalConfigResult">
        <include refid="selectFinalConfigVo"/>
        <where>  
            <if test="finalImage != null  and finalImage != ''"> and final_image = #{finalImage}</if>
            <if test="finalText != null  and finalText != ''"> and final_text = #{finalText}</if>
        </where>
    </select>
    
    <select id="selectFinalConfigById" parameterType="Long" resultMap="FinalConfigResult">
        <include refid="selectFinalConfigVo"/>
        where id = #{id}
    </select>
    <select id="getFinalConfigList" resultType="com.ruoyi.model.domain.FinalConfig">
        <include refid="selectFinalConfigVo"/>
    </select>

    <insert id="insertFinalConfig" parameterType="FinalConfig">
        insert into final_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="finalImage != null">final_image,</if>
            <if test="finalText != null">final_text,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="finalImage != null">#{finalImage},</if>
            <if test="finalText != null">#{finalText},</if>
         </trim>
    </insert>

    <update id="updateFinalConfig" parameterType="FinalConfig">
        update final_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="finalImage != null">final_image = #{finalImage},</if>
            <if test="finalText != null">final_text = #{finalText},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFinalConfigById" parameterType="Long">
        delete from final_config where id = #{id}
    </delete>

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