<?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.IndexconfigMapper">
    
    <resultMap type="Indexconfig" id="IndexconfigResult">
        <result property="id"    column="id"    />
        <result property="indexIcon"    column="indexIcon"    />
        <result property="indexInfo"    column="indexInfo"    />
        <result property="indexType"    column="indexType"    />
        <result property="perfectService"    column="perfect_service"    />
        <result property="remark"    column="remark"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectIndexconfigVo">
        select id, indexIcon, indexInfo, indexType, perfect_service, remark, create_time, create_by, update_time, update_by, del_flag from indexconfig
    </sql>

    <select id="selectIndexconfigList" parameterType="Indexconfig" resultMap="IndexconfigResult">
        <include refid="selectIndexconfigVo"/>
        <where>  
            <if test="indexIcon != null  and indexIcon != ''"> and indexIcon = #{indexIcon}</if>
            <if test="indexInfo != null  and indexInfo != ''"> and indexInfo = #{indexInfo}</if>
            <if test="indexType != null "> and indexType = #{indexType}</if>
            <if test="perfectService != null  and perfectService != ''"> and perfect_service = #{perfectService}</if>
        </where>
    </select>
    
    <select id="selectIndexconfigById" parameterType="Long" resultMap="IndexconfigResult">
        <include refid="selectIndexconfigVo"/>
        where id = #{id}
    </select>
    <select id="getIndexconfigList" resultType="com.ruoyi.model.domain.Indexconfig">
        <include refid="selectIndexconfigVo"/> where indexType = #{indexType} and del_flag=0
    </select>

    <insert id="insertIndexconfig" parameterType="Indexconfig">
        insert into indexconfig
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="indexIcon != null">indexIcon,</if>
            <if test="indexInfo != null">indexInfo,</if>
            <if test="indexType != null">indexType,</if>
            <if test="perfectService != null">perfect_service,</if>
            <if test="remark != null">remark,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="indexIcon != null">#{indexIcon},</if>
            <if test="indexInfo != null">#{indexInfo},</if>
            <if test="indexType != null">#{indexType},</if>
            <if test="perfectService != null">#{perfectService},</if>
            <if test="remark != null">#{remark},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>

    <update id="updateIndexconfig" parameterType="Indexconfig">
        update indexconfig
        <trim prefix="SET" suffixOverrides=",">
            <if test="indexIcon != null">indexIcon = #{indexIcon},</if>
            <if test="indexInfo != null">indexInfo = #{indexInfo},</if>
            <if test="indexType != null">indexType = #{indexType},</if>
            <if test="perfectService != null">perfect_service = #{perfectService},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIndexconfigById" parameterType="Long">
        delete from indexconfig where id = #{id}
    </delete>

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