<?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.leromro.core.mapper.LSlideshowMapper">
    
    <resultMap type="Slideshow" id="LSlideshowResult">
        <result property="slideshowId"    column="slideshow_id"    />
        <result property="picture"    column="picture"    />
        <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="remark"    column="remark"    />
    </resultMap>

    <sql id="selectLSlideshowVo">
        select slideshow_id, picture, create_time, create_by, update_time, update_by, remark from l_slideshow
    </sql>

    <select id="selectLSlideshowList" parameterType="Slideshow" resultMap="LSlideshowResult">
        <include refid="selectLSlideshowVo"/>
        <where>  
            <if test="picture != null  and picture != ''"> and picture = #{picture}</if>
        </where>
    </select>
    
    <select id="selectLSlideshowBySlideshowId" parameterType="Long" resultMap="LSlideshowResult">
        <include refid="selectLSlideshowVo"/>
        where slideshow_id = #{slideshowId}
    </select>

    <insert id="insertLSlideshow" parameterType="Slideshow" useGeneratedKeys="true" keyProperty="slideshowId">
        insert into l_slideshow
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="picture != null">picture,</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="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="picture != null">#{picture},</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="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateLSlideshow" parameterType="Slideshow">
        update l_slideshow
        <trim prefix="SET" suffixOverrides=",">
            <if test="picture != null">picture = #{picture},</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="remark != null">remark = #{remark},</if>
        </trim>
        where slideshow_id = #{slideshowId}
    </update>

    <delete id="deleteLSlideshowBySlideshowId" parameterType="Long">
        delete from l_slideshow where slideshow_id = #{slideshowId}
    </delete>

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