<?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.system.mapper.config.BannerMapper">
|
|
<resultMap type="Banner" id="BannerResult">
|
<result property="bannerId" column="banner_id" />
|
<result property="delFlag" column="del_flag" />
|
<result property="bannerPosition" column="banner_position" />
|
<result property="bannerUrl" column="banner_url" />
|
<result property="targetType" column="target_type" />
|
<result property="linkType" column="link_type" />
|
<result property="linkUrl" column="link_url" />
|
<result property="jumpType" column="jump_type" />
|
<result property="jumpId" column="jump_id" />
|
<result property="createTime" column="create_time" />
|
<result property="createUserId" column="create_user_id" />
|
</resultMap>
|
|
<!--<sql id="selectBannerVo">
|
select banner_id, del_flag, banner_position, banner_url, target_type, link_type, link_url, jump_type, jump_id, create_time, create_user_id from t_banner
|
</sql>
|
|
<select id="selectBannerList" parameterType="Banner" resultMap="BannerResult">
|
<include refid="selectBannerVo"/>
|
<where>
|
<if test="bannerPosition != null "> and banner_position = #{bannerPosition}</if>
|
<if test="bannerUrl != null and bannerUrl != ''"> and banner_url = #{bannerUrl}</if>
|
<if test="targetType != null "> and target_type = #{targetType}</if>
|
<if test="linkType != null "> and link_type = #{linkType}</if>
|
<if test="linkUrl != null and linkUrl != ''"> and link_url = #{linkUrl}</if>
|
<if test="jumpType != null "> and jump_type = #{jumpType}</if>
|
<if test="jumpId != null and jumpId != ''"> and jump_id = #{jumpId}</if>
|
<if test="createUserId != null "> and create_user_id = #{createUserId}</if>
|
</where>
|
</select>
|
|
<select id="selectBannerByBannerId" parameterType="Long" resultMap="BannerResult">
|
<include refid="selectBannerVo"/>
|
where banner_id = #{bannerId}
|
</select>
|
|
<insert id="insertBanner" parameterType="Banner" useGeneratedKeys="true" keyProperty="bannerId">
|
insert into t_banner
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="delFlag != null">del_flag,</if>
|
<if test="bannerPosition != null">banner_position,</if>
|
<if test="bannerUrl != null">banner_url,</if>
|
<if test="targetType != null">target_type,</if>
|
<if test="linkType != null">link_type,</if>
|
<if test="linkUrl != null">link_url,</if>
|
<if test="jumpType != null">jump_type,</if>
|
<if test="jumpId != null">jump_id,</if>
|
<if test="createTime != null">create_time,</if>
|
<if test="createUserId != null">create_user_id,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="delFlag != null">#{delFlag},</if>
|
<if test="bannerPosition != null">#{bannerPosition},</if>
|
<if test="bannerUrl != null">#{bannerUrl},</if>
|
<if test="targetType != null">#{targetType},</if>
|
<if test="linkType != null">#{linkType},</if>
|
<if test="linkUrl != null">#{linkUrl},</if>
|
<if test="jumpType != null">#{jumpType},</if>
|
<if test="jumpId != null">#{jumpId},</if>
|
<if test="createTime != null">#{createTime},</if>
|
<if test="createUserId != null">#{createUserId},</if>
|
</trim>
|
</insert>
|
|
<update id="updateBanner" parameterType="Banner">
|
update t_banner
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="bannerPosition != null">banner_position = #{bannerPosition},</if>
|
<if test="bannerUrl != null">banner_url = #{bannerUrl},</if>
|
<if test="targetType != null">target_type = #{targetType},</if>
|
<if test="linkType != null">link_type = #{linkType},</if>
|
<if test="linkUrl != null">link_url = #{linkUrl},</if>
|
<if test="jumpType != null">jump_type = #{jumpType},</if>
|
<if test="jumpId != null">jump_id = #{jumpId},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createUserId != null">create_user_id = #{createUserId},</if>
|
</trim>
|
where banner_id = #{bannerId}
|
</update>
|
|
<delete id="deleteBannerByBannerId" parameterType="Long">
|
delete from t_banner where banner_id = #{bannerId}
|
</delete>
|
|
<delete id="deleteBannerByBannerIds" parameterType="String">
|
delete from t_banner where banner_id in
|
<foreach item="bannerId" collection="array" open="(" separator="," close=")">
|
#{bannerId}
|
</foreach>
|
</delete>-->
|
|
<select id="listHomeBannerVo" resultType="com.ruoyi.system.domain.vo.AppBannerVo">
|
SELECT
|
banner_id bannerId,
|
banner_url bannerUrl,
|
target_type targetType,
|
link_type linkType,
|
link_url linkUrl,
|
jump_type jumpType,
|
jump_id jumpId
|
FROM t_banner WHERE del_flag = 0 AND banner_position = 1
|
ORDER BY banner_sort DESC,create_time DESC LIMIT 5
|
</select>
|
|
<select id="pageMgtBannerVo" resultType="com.ruoyi.system.domain.vo.MgtBannerPageVo">
|
SELECT
|
banner_id bannerId,
|
banner_url bannerUrl,
|
CASE target_type
|
WHEN 1 THEN "外链"
|
WHEN 2 THEN "内链"
|
ELSE "无"
|
END targetType,
|
create_time createTime
|
FROM t_banner WHERE del_flag = 0
|
ORDER BY create_time DESC
|
</select>
|
</mapper>
|