<?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="cn.iocoder.yudao.module.appBase.mapper.AppSwiperMapper">

    <resultMap type="cn.iocoder.yudao.module.appBase.entity.AppSwiper" id="AppSwiperResult">
        <result property="swiperId"    column="swiper_id"    />
        <result property="moudleName"    column="moudle_name"    />
        <result property="swiperName"    column="swiper_name"    />
        <result property="swiperPicture"    column="swiper_picture"    />
        <result property="jumpUrl"    column="jump_url"    />
        <result property="listOrder"    column="list_order"    />
    </resultMap>

    <sql id="selectAppSwiperVo">
        select swiper_id, moudle_name, swiper_name, swiper_picture, jump_url, list_order from app_swiper
    </sql>

    <select id="selectAppSwiperList" parameterType="cn.iocoder.yudao.module.appBase.entity.AppSwiper" resultMap="AppSwiperResult">
        <include refid="selectAppSwiperVo"/>
        <where>
            <if test="vo.moudleName != null  and vo.moudleName != ''"> and moudle_name like concat('%', #{vo.moudleName}, '%')</if>
            <if test="vo.swiperName != null  and vo.swiperName != ''"> and swiper_name like concat('%', #{vo.swiperName}, '%')</if>
            <if test="vo.swiperPicture != null  and vo.swiperPicture != ''"> and swiper_picture = #{vo.swiperPicture}</if>
            <if test="vo.jumpUrl != null  and vo.jumpUrl != ''"> and jump_url = #{vo.jumpUrl}</if>
            <if test="vo.listOrder != null "> and list_order = #{vo.listOrder}</if>
        </where>
        order by list_order asc
    </select>

    <select id="selectAppSwiperBySwiperId" parameterType="Long" resultMap="AppSwiperResult">
        <include refid="selectAppSwiperVo"/>
        where swiper_id = #{swiperId}
    </select>

    <insert id="insertAppSwiper" parameterType="cn.iocoder.yudao.module.appBase.entity.AppSwiper" useGeneratedKeys="true" keyProperty="swiperId">
        insert into app_swiper
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="moudleName != null">moudle_name,</if>
            <if test="swiperName != null">swiper_name,</if>
            <if test="swiperPicture != null">swiper_picture,</if>
            <if test="jumpUrl != null">jump_url,</if>
            <if test="listOrder != null">list_order,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="moudleName != null">#{moudleName},</if>
            <if test="swiperName != null">#{swiperName},</if>
            <if test="swiperPicture != null">#{swiperPicture},</if>
            <if test="jumpUrl != null">#{jumpUrl},</if>
            <if test="listOrder != null">#{listOrder},</if>
        </trim>
    </insert>

    <update id="updateAppSwiper" parameterType="cn.iocoder.yudao.module.appBase.entity.AppSwiper">
        update app_swiper
        <trim prefix="SET" suffixOverrides=",">
            <if test="moudleName != null">moudle_name = #{moudleName},</if>
            <if test="swiperName != null">swiper_name = #{swiperName},</if>
            <if test="swiperPicture != null">swiper_picture = #{swiperPicture},</if>
            <if test="jumpUrl != null">jump_url = #{jumpUrl},</if>
            <if test="listOrder != null">list_order = #{listOrder},</if>
        </trim>
        where swiper_id = #{swiperId}
    </update>

    <delete id="deleteAppSwiperBySwiperId" parameterType="Long">
        delete from app_swiper where swiper_id = #{swiperId}
    </delete>

    <delete id="deleteAppSwiperBySwiperIds" parameterType="String">
        delete from app_swiper where swiper_id in
        <foreach item="swiperId" collection="array" open="(" separator="," close=")">
            #{swiperId}
        </foreach>
    </delete>

</mapper>
