视图修改、接口修改

This commit is contained in:
2025-10-28 19:04:35 +08:00
parent 98c73632bd
commit c5c134fbb3
96 changed files with 7122 additions and 4194 deletions

View File

@@ -5,6 +5,7 @@
<!-- 基础结果映射 -->
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.resource.TbBanner">
<id column="id" property="id" jdbcType="VARCHAR"/>
<result column="banner_id" property="bannerID" jdbcType="VARCHAR"/>
<result column="title" property="title" jdbcType="VARCHAR"/>
<result column="image_url" property="imageUrl" jdbcType="VARCHAR"/>
<result column="link_type" property="linkType" jdbcType="INTEGER"/>
@@ -22,7 +23,7 @@
<!-- 基础字段 -->
<sql id="Base_Column_List">
id, title, image_url, link_type, link_id, link_url, order_num, status,
id, banner_id, title, image_url, link_type, link_id, link_url, order_num, status,
creator, updater, create_time, update_time, delete_time, deleted
</sql>
@@ -30,6 +31,9 @@
<sql id="Where_Clause">
<where>
deleted = 0
<if test="bannerID != null and bannerID != ''">
AND banner_id = #{bannerID}
</if>
<if test="title != null and title != ''">
AND title LIKE CONCAT('%', #{title}, '%')
</if>
@@ -44,6 +48,26 @@
</if>
</where>
</sql>
<sql id="Filter_Clause">
<where>
deleted = 0
<if test="filter.bannerID != null and filter.bannerID != ''">
AND banner_id = #{filter.bannerID}
</if>
<if test="filter.title != null and filter.title != ''">
AND title LIKE CONCAT('%', #{filter.title}, '%')
</if>
<if test="filter.linkType != null">
AND link_type = #{filter.linkType}
</if>
<if test="filter.linkID != null and filter.linkID != ''">
AND link_id = #{filter.linkID}
</if>
<if test="filter.status != null">
AND status = #{filter.status}
</if>
</where>
</sql>
<!-- selectBanners -->
<select id="selectBanners" resultMap="BaseResultMap">
@@ -54,12 +78,21 @@
ORDER BY order_num ASC, create_time DESC
</select>
<select id="selectBannersLimit" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM tb_banner
<include refid="Filter_Clause"/>
ORDER BY order_num ASC, create_time DESC
LIMIT #{limit}
</select>
<!-- 根据Banner ID查询Banner信息 -->
<select id="selectByBannerId" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List" />
FROM tb_banner
WHERE id = #{bannerId} AND deleted = 0
WHERE banner_id = #{bannerID} AND deleted = 0
</select>
<!-- 根据状态查询Banner列表 -->
@@ -95,18 +128,18 @@
FROM tb_banner
WHERE title = #{title} AND deleted = 0
<if test="excludeId != null and excludeId != ''">
AND id != #{excludeId}
AND banner_id != #{excludeId}
</if>
</select>
<!-- 插入Banner -->
<insert id="insertBanner" parameterType="org.xyzh.common.dto.resource.TbBanner">
INSERT INTO tb_banner (
id, title, image_url, link_type, link_id, link_url, order_num, status,
creator, updater, create_time, update_time, delete_time, deleted
id, banner_id, title, image_url, link_type, link_id, link_url, order_num, status,
creator, create_time
) VALUES (
#{id}, #{title}, #{imageUrl}, #{linkType}, #{linkID}, #{linkUrl}, #{orderNum}, #{status},
#{creator}, #{updater}, #{createTime}, #{updateTime}, #{deleteTime}, #{deleted}
#{id}, #{bannerID}, #{title}, #{imageUrl}, #{linkType}, #{linkID}, #{linkUrl}, #{orderNum}, #{status},
#{creator}, #{createTime}
)
</insert>
@@ -114,6 +147,9 @@
<update id="updateBanner" parameterType="org.xyzh.common.dto.resource.TbBanner">
UPDATE tb_banner
<set>
<if test="bannerID != null and bannerID != ''">
banner_id = #{bannerID},
</if>
<if test="title != null and title != ''">
title = #{title},
</if>
@@ -148,24 +184,24 @@
deleted = #{deleted},
</if>
</set>
WHERE id = #{id}
WHERE banner_id = #{bannerID}
</update>
<!-- 删除Banner -->
<delete id="deleteBanner" parameterType="org.xyzh.common.dto.resource.TbBanner">
DELETE FROM tb_banner
WHERE id = #{id}
WHERE banner_id = #{bannerID}
</delete>
<!-- 批量插入Banner -->
<insert id="batchInsertBanners" parameterType="java.util.List">
INSERT INTO tb_banner (
id, title, image_url, link_type, link_id, link_url, order_num, status,
id, banner_id, title, image_url, link_type, link_id, link_url, order_num, status,
creator, updater, create_time, update_time, delete_time, deleted
) VALUES
<foreach collection="bannerList" item="item" separator=",">
(
#{item.id}, #{item.title}, #{item.imageUrl}, #{item.linkType}, #{item.linkID},
#{item.id}, #{item.bannerID}, #{item.title}, #{item.imageUrl}, #{item.linkType}, #{item.linkID},
#{item.linkUrl}, #{item.orderNum}, #{item.status}, #{item.creator}, #{item.updater},
#{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
)
@@ -175,9 +211,9 @@
<!-- 批量删除Banner -->
<delete id="batchDeleteBanners">
DELETE FROM tb_banner
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
WHERE banner_id IN
<foreach collection="ids" item="bannerID" open="(" separator="," close=")">
#{bannerID}
</foreach>
</delete>
@@ -186,7 +222,7 @@
SELECT
<include refid="Base_Column_List" />
FROM tb_banner
<include refid="Where_Clause" />
<include refid="Filter_Clause" />
ORDER BY order_num ASC, create_time DESC
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.offset}
</select>
@@ -195,7 +231,7 @@
<select id="countBanners" resultType="long">
SELECT COUNT(1)
FROM tb_banner
<include refid="Where_Clause" />
<include refid="Filter_Clause" />
</select>
</mapper>