<?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.system.mapper.CpsGlbViewCfgMapper">

    <resultMap type="com.ruoyi.system.domain.CpsGlbViewCfg" id="CpsGlbViewCfgResult">
        <result property="id"    column="id"    />
        <result property="iconUri"    column="icon_uri"    />
        <result property="labelTxt"    column="label_txt"    />
        <result property="style"    column="style"    />
        <result property="url"    column="url"    />
        <result property="compCode"    column="comp_code"    />
        <result property="sort"    column="sort"    />
        <result property="showFlag"    column="show_flag"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectCpsGlbViewCfgVo">
        select id, icon_uri, label_txt, style, url, comp_code,sort, show_flag, update_time, create_time, create_by, update_by from cps_glb_view_cfg
    </sql>

    <select id="selectCpsGlbViewCfgList" parameterType="com.ruoyi.system.domain.CpsGlbViewCfg" resultMap="CpsGlbViewCfgResult">
        <include refid="selectCpsGlbViewCfgVo"/>
        <where>
            <if test="iconUri != null  and iconUri != ''"> and icon_uri = #{iconUri}</if>
            <if test="labelTxt != null  and labelTxt != ''"> and label_txt = #{labelTxt}</if>
            <if test="style != null  and style != ''"> and style = #{style}</if>
            <if test="url != null  and url != ''"> and url = #{url}</if>
            <if test="compCode != null  and compCode != ''"> and comp_code = #{compCode}</if>
             <if test="sort != null "> and sort = #{sort}</if>
            <if test="showFlag != null  and showFlag != ''"> and show_flag = #{showFlag}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
        </where>
        order by comp_code desc,sort asc,show_flag desc
    </select>

    <select id="selectCpsGlbViewCfgById" parameterType="Long" resultMap="CpsGlbViewCfgResult">
        <include refid="selectCpsGlbViewCfgVo"/>
        where id = #{id}
    </select>

    <insert id="insertCpsGlbViewCfg" parameterType="com.ruoyi.system.domain.CpsGlbViewCfg" useGeneratedKeys="true" keyProperty="id">
        insert into cps_glb_view_cfg
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="iconUri != null">icon_uri,</if>
            <if test="labelTxt != null">label_txt,</if>
            <if test="style != null">style,</if>
            <if test="url != null">url,</if>
            <if test="compCode != null">comp_code,</if>
            <if test="sort != null">sort,</if>
            <if test="showFlag != null">show_flag,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="iconUri != null">#{iconUri},</if>
            <if test="labelTxt != null">#{labelTxt},</if>
            <if test="style != null">#{style},</if>
            <if test="url != null">#{url},</if>
            <if test="compCode != null">#{compCode},</if>
            <if test="sort != null">#{sort},</if>
            <if test="showFlag != null">#{showFlag},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
         </trim>
    </insert>

    <update id="updateCpsGlbViewCfg" parameterType="com.ruoyi.system.domain.CpsGlbViewCfg">
        update cps_glb_view_cfg
        <trim prefix="SET" suffixOverrides=",">
            <if test="iconUri != null">icon_uri = #{iconUri},</if>
            <if test="labelTxt != null">label_txt = #{labelTxt},</if>
            <if test="style != null">style = #{style},</if>
            <if test="url != null">url = #{url},</if>
            <if test="compCode != null">comp_code = #{compCode},</if>
            <if test="sort != null">sort = #{sort},</if>
            <if test="showFlag != null">show_flag = #{showFlag},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCpsGlbViewCfgById" parameterType="Long">
        delete from cps_glb_view_cfg where id = #{id}
    </delete>

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