<?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.business.mapper.SChartMapper">
    
    <resultMap type="com.ruoyi.business.domain.SChart" id="SChartResult">
        <result property="chartId"    column="chart_id"    />
        <result property="imgs"    column="imgs"    />
    </resultMap>

    <sql id="selectSChartVo">
        select chart_id, imgs from s_chart
    </sql>

    <select id="selectSChartList" parameterType="com.ruoyi.business.domain.SChart" resultMap="SChartResult">
        <include refid="selectSChartVo"/>
        <where>  
            <if test="imgs != null  and imgs != ''"> and imgs = #{imgs}</if>
        </where>
    </select>
    
    <select id="selectSChartByChartId" parameterType="Integer" resultMap="SChartResult">
        <include refid="selectSChartVo"/>
        where chart_id = #{chartId}
    </select>
        
    <insert id="insertSChart" parameterType="com.ruoyi.business.domain.SChart" useGeneratedKeys="true" keyProperty="chartId">
        insert into s_chart
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="imgs != null">imgs,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="imgs != null">#{imgs},</if>
         </trim>
    </insert>

    <update id="updateSChart" parameterType="com.ruoyi.business.domain.SChart">
        update s_chart
        <trim prefix="SET" suffixOverrides=",">
            <if test="imgs != null">imgs = #{imgs},</if>
        </trim>
        where chart_id = #{chartId}
    </update>

    <delete id="deleteSChartByChartId" parameterType="Integer">
        delete from s_chart where chart_id = #{chartId}
    </delete>

    <delete id="deleteSChartByChartIds" parameterType="String">
        delete from s_chart where chart_id in 
        <foreach item="chartId" collection="array" open="(" separator="," close=")">
            #{chartId}
        </foreach>
    </delete>

</mapper>