<?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.base.mapper.RobotOpsScreenThemeConfigMapper">
    
    <resultMap type="RobotOpsScreenThemeConfig" id="RobotOpsScreenThemeConfigResult">
        <result property="id"    column="id"    />
        <result property="configKey"    column="config_key"    />
        <result property="logoUrl"    column="logo_url"    />
        <result property="robotName"    column="robot_name"    />
        <result property="brandSubtitle"    column="brand_subtitle"    />
        <result property="backgroundImage"    column="background_image"    />
        <result property="welcomeTitle"    column="welcome_title"    />
        <result property="welcomeSubtitle"    column="welcome_subtitle"    />
        <result property="touchText"    column="touch_text"    />
        <result property="buttonColor"    column="button_color"    />
        <result property="remark"    column="remark"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectRobotOpsScreenThemeConfigVo">
        select id, config_key, logo_url, robot_name, brand_subtitle, background_image, welcome_title, welcome_subtitle, touch_text, button_color, remark, create_by, create_time, update_by, update_time from robot_ops_screen_theme_config
    </sql>

    <select id="selectRobotOpsScreenThemeConfigList" parameterType="RobotOpsScreenThemeConfig" resultMap="RobotOpsScreenThemeConfigResult">
        <include refid="selectRobotOpsScreenThemeConfigVo"/>
        <where>  
            <if test="configKey != null  and configKey != ''"> and config_key = #{configKey}</if>
            <if test="logoUrl != null  and logoUrl != ''"> and logo_url = #{logoUrl}</if>
            <if test="robotName != null  and robotName != ''"> and robot_name like concat('%', #{robotName}, '%')</if>
            <if test="brandSubtitle != null  and brandSubtitle != ''"> and brand_subtitle = #{brandSubtitle}</if>
            <if test="backgroundImage != null  and backgroundImage != ''"> and background_image = #{backgroundImage}</if>
            <if test="welcomeTitle != null  and welcomeTitle != ''"> and welcome_title = #{welcomeTitle}</if>
            <if test="welcomeSubtitle != null  and welcomeSubtitle != ''"> and welcome_subtitle = #{welcomeSubtitle}</if>
            <if test="touchText != null  and touchText != ''"> and touch_text = #{touchText}</if>
            <if test="buttonColor != null  and buttonColor != ''"> and button_color = #{buttonColor}</if>
        </where>
    </select>
    
    <select id="selectRobotOpsScreenThemeConfigById" parameterType="Long" resultMap="RobotOpsScreenThemeConfigResult">
        <include refid="selectRobotOpsScreenThemeConfigVo"/>
        where id = #{id}
    </select>

    <select id="selectRobotOpsScreenThemeConfigByConfigKey" parameterType="String" resultMap="RobotOpsScreenThemeConfigResult">
        <include refid="selectRobotOpsScreenThemeConfigVo"/>
        where config_key = #{configKey}
        limit 1
    </select>

    <insert id="insertRobotOpsScreenThemeConfig" parameterType="RobotOpsScreenThemeConfig" useGeneratedKeys="true" keyProperty="id">
        insert into robot_ops_screen_theme_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="configKey != null and configKey != ''">config_key,</if>
            <if test="logoUrl != null">logo_url,</if>
            <if test="robotName != null">robot_name,</if>
            <if test="brandSubtitle != null">brand_subtitle,</if>
            <if test="backgroundImage != null">background_image,</if>
            <if test="welcomeTitle != null">welcome_title,</if>
            <if test="welcomeSubtitle != null">welcome_subtitle,</if>
            <if test="touchText != null">touch_text,</if>
            <if test="buttonColor != null">button_color,</if>
            <if test="remark != null">remark,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="configKey != null and configKey != ''">#{configKey},</if>
            <if test="logoUrl != null">#{logoUrl},</if>
            <if test="robotName != null">#{robotName},</if>
            <if test="brandSubtitle != null">#{brandSubtitle},</if>
            <if test="backgroundImage != null">#{backgroundImage},</if>
            <if test="welcomeTitle != null">#{welcomeTitle},</if>
            <if test="welcomeSubtitle != null">#{welcomeSubtitle},</if>
            <if test="touchText != null">#{touchText},</if>
            <if test="buttonColor != null">#{buttonColor},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateRobotOpsScreenThemeConfig" parameterType="RobotOpsScreenThemeConfig">
        update robot_ops_screen_theme_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
            <if test="logoUrl != null">logo_url = #{logoUrl},</if>
            <if test="robotName != null">robot_name = #{robotName},</if>
            <if test="brandSubtitle != null">brand_subtitle = #{brandSubtitle},</if>
            <if test="backgroundImage != null">background_image = #{backgroundImage},</if>
            <if test="welcomeTitle != null">welcome_title = #{welcomeTitle},</if>
            <if test="welcomeSubtitle != null">welcome_subtitle = #{welcomeSubtitle},</if>
            <if test="touchText != null">touch_text = #{touchText},</if>
            <if test="buttonColor != null">button_color = #{buttonColor},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteRobotOpsScreenThemeConfigById" parameterType="Long">
        delete from robot_ops_screen_theme_config where id = #{id}
    </delete>

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