<?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.ylx.massage.mapper.MaCarouselChartMapper">

    <resultMap type="MaCarouselChart" id="MaCarouselChartResult">
        <result property="id"    column="id"    />
        <result property="carouselSort"    column="carousel_sort"    />
        <result property="carouselUrl"    column="carousel_url"    />
        <result property="projectIsEnable"    column="project_is_enable"    />
        <result property="createUser"    column="create_user"    />
        <result property="updateUser"    column="update_user"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="isDelete"    column="is_delete"    />
    </resultMap>

    <sql id="selectMaCarouselChartVo">
        select id, carousel_sort, carousel_url, project_is_enable, create_user, update_user, create_time, update_time, is_delete from ma_carousel_chart
    </sql>

    <select id="selectMaCarouselChartList" parameterType="MaCarouselChart" resultMap="MaCarouselChartResult">
        <include refid="selectMaCarouselChartVo"/>
        <where>
            <if test="carouselSort != null "> and carousel_sort = #{carouselSort}</if>
            <if test="carouselUrl != null  and carouselUrl != ''"> and carousel_url = #{carouselUrl}</if>
            <if test="projectIsEnable != null "> and project_is_enable = #{projectIsEnable}</if>
            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
            <if test="isDelete != null "> and is_delete = #{isDelete}</if>
        </where>
    </select>

    <select id="selectMaCarouselChartById" parameterType="Long" resultMap="MaCarouselChartResult">
        <include refid="selectMaCarouselChartVo"/>
        where id = #{id}
    </select>

    <insert id="insertMaCarouselChart" parameterType="MaCarouselChart" useGeneratedKeys="true" keyProperty="id">
        insert into ma_carousel_chart
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="carouselSort != null">carousel_sort,</if>
            <if test="carouselUrl != null and carouselUrl != ''">carousel_url,</if>
            <if test="projectIsEnable != null">project_is_enable,</if>
            <if test="createUser != null and createUser != ''">create_user,</if>
            <if test="updateUser != null and updateUser != ''">update_user,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="isDelete != null">is_delete,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="carouselSort != null">#{carouselSort},</if>
            <if test="carouselUrl != null and carouselUrl != ''">#{carouselUrl},</if>
            <if test="projectIsEnable != null">#{projectIsEnable},</if>
            <if test="createUser != null and createUser != ''">#{createUser},</if>
            <if test="updateUser != null and updateUser != ''">#{updateUser},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="isDelete != null">#{isDelete},</if>
         </trim>
    </insert>

    <update id="updateMaCarouselChart" parameterType="MaCarouselChart">
        update ma_carousel_chart
        <trim prefix="SET" suffixOverrides=",">
            <if test="carouselSort != null">carousel_sort = #{carouselSort},</if>
            <if test="carouselUrl != null and carouselUrl != ''">carousel_url = #{carouselUrl},</if>
            <if test="projectIsEnable != null">project_is_enable = #{projectIsEnable},</if>
            <if test="createUser != null and createUser != ''">create_user = #{createUser},</if>
            <if test="updateUser != null and updateUser != ''">update_user = #{updateUser},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="isDelete != null">is_delete = #{isDelete},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMaCarouselChartById" parameterType="Long">
        delete from ma_carousel_chart where id = #{id}
    </delete>

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