<?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.CurrentConfigMapper">
    
    <resultMap type="CurrentConfig" id="CurrentConfigResult">
        <result property="currentId"    column="current_id"    />
        <result property="currentTitle"    column="current_title"    />
        <result property="currentText"    column="current_text"    />
        <result property="currentPriority"    column="current_priority"    />
        <result property="currentImage"    column="current_image"    />
    </resultMap>

    <sql id="selectCurrentConfigVo">
        select current_id, current_title, current_text, current_priority, current_image from current_config
    </sql>

    <select id="selectCurrentConfigList" parameterType="CurrentConfig" resultMap="CurrentConfigResult">
        <include refid="selectCurrentConfigVo"/>
        <where>  
            <if test="currentTitle != null  and currentTitle != ''"> and current_title = #{currentTitle}</if>
            <if test="currentText != null  and currentText != ''"> and current_text = #{currentText}</if>
            <if test="currentPriority != null "> and current_priority = #{currentPriority}</if>
            <if test="currentImage != null  and currentImage != ''"> and current_image = #{currentImage}</if>
        </where>
    </select>
    
    <select id="selectCurrentConfigByCurrentId" parameterType="Long" resultMap="CurrentConfigResult">
        <include refid="selectCurrentConfigVo"/>
        where current_id = #{currentId}
    </select>
    <select id="getCurrentConfigList" resultType="com.ruoyi.model.domain.CurrentConfig">
        <include refid="selectCurrentConfigVo"/>
    </select>

    <insert id="insertCurrentConfig" parameterType="CurrentConfig">
        insert into current_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="currentId != null">current_id,</if>
            <if test="currentTitle != null">current_title,</if>
            <if test="currentText != null">current_text,</if>
            <if test="currentPriority != null">current_priority,</if>
            <if test="currentImage != null">current_image,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="currentId != null">#{currentId},</if>
            <if test="currentTitle != null">#{currentTitle},</if>
            <if test="currentText != null">#{currentText},</if>
            <if test="currentPriority != null">#{currentPriority},</if>
            <if test="currentImage != null">#{currentImage},</if>
         </trim>
    </insert>

    <update id="updateCurrentConfig" parameterType="CurrentConfig">
        update current_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="currentTitle != null">current_title = #{currentTitle},</if>
            <if test="currentText != null">current_text = #{currentText},</if>
            <if test="currentPriority != null">current_priority = #{currentPriority},</if>
            <if test="currentImage != null">current_image = #{currentImage},</if>
        </trim>
        where current_id = #{currentId}
    </update>

    <delete id="deleteCurrentConfigByCurrentId" parameterType="Long">
        delete from current_config where current_id = #{currentId}
    </delete>

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