<?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.IndexconfigIconMapper">
    
    <resultMap type="IndexconfigIcon" id="IndexconfigIconResult">
        <result property="id"    column="id"    />
        <result property="icon"    column="icon"    />
        <result property="iconName"    column="icon_name"    />
        <result property="identity"    column="identity"    />
    </resultMap>

    <sql id="selectIndexconfigIconVo">
        select id, icon, icon_name, identity from indexconfig_icon
    </sql>

    <select id="selectIndexconfigIconList" parameterType="IndexconfigIcon" resultMap="IndexconfigIconResult">
        <include refid="selectIndexconfigIconVo"/>
        <where>  
            <if test="icon != null  and icon != ''"> and icon = #{icon}</if>
            <if test="iconName != null  and iconName != ''"> and icon_name like concat('%', #{iconName}, '%')</if>
            <if test="identity != null "> and identity = #{identity}</if>
        </where>
    </select>
    
    <select id="selectIndexconfigIconById" parameterType="Long" resultMap="IndexconfigIconResult">
        <include refid="selectIndexconfigIconVo"/>
        where id = #{id}
    </select>
    <select id="getIndexconfigIconByIdentity" resultType="com.ruoyi.model.domain.IndexconfigIcon">
        <include refid="selectIndexconfigIconVo"/>
        <where>
            <if test="identity != null ">identity = #{identity}</if>
        </where>
    </select>

    <insert id="insertIndexconfigIcon" parameterType="IndexconfigIcon">
        insert into indexconfig_icon
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="icon != null">icon,</if>
            <if test="iconName != null">icon_name,</if>
            <if test="identity != null">identity,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="icon != null">#{icon},</if>
            <if test="iconName != null">#{iconName},</if>
            <if test="identity != null">#{identity},</if>
         </trim>
    </insert>

    <update id="updateIndexconfigIcon" parameterType="IndexconfigIcon">
        update indexconfig_icon
        <trim prefix="SET" suffixOverrides=",">
            <if test="icon != null">icon = #{icon},</if>
            <if test="iconName != null">icon_name = #{iconName},</if>
            <if test="identity != null">identity = #{identity},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIndexconfigIconById" parameterType="Long">
        delete from indexconfig_icon where id = #{id}
    </delete>

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