serv-初始mapper

This commit is contained in:
2025-10-15 13:11:19 +08:00
parent 88976d7c47
commit 67e7432837
127 changed files with 8628 additions and 3 deletions

View File

@@ -0,0 +1,57 @@
<?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="org.xyzh.news.mapper.BannerMapper">
<!-- 基础结果映射 -->
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.resource.TbBanner">
<id column="id" property="id" 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"/>
<result column="link_id" property="linkID" jdbcType="VARCHAR"/>
<result column="link_url" property="linkUrl" jdbcType="VARCHAR"/>
<result column="order_num" property="orderNum" jdbcType="INTEGER"/>
<result column="status" property="status" jdbcType="INTEGER"/>
<result column="creator" property="creator" jdbcType="VARCHAR"/>
<result column="updater" property="updater" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="delete_time" property="deleteTime" jdbcType="TIMESTAMP"/>
<result column="deleted" property="deleted" jdbcType="BOOLEAN"/>
</resultMap>
<!-- 基础字段 -->
<sql id="Base_Column_List">
id, title, image_url, link_type, link_id, link_url, order_num, status,
creator, updater, create_time, update_time, delete_time, deleted
</sql>
<!-- 通用条件 -->
<sql id="Where_Clause">
<where>
deleted = 0
<if test="title != null and title != ''">
AND title LIKE CONCAT('%', #{title}, '%')
</if>
<if test="linkType != null">
AND link_type = #{linkType}
</if>
<if test="linkID != null and linkID != ''">
AND link_id = #{linkID}
</if>
<if test="status != null">
AND status = #{status}
</if>
</where>
</sql>
<!-- selectBanners -->
<select id="selectBanners" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM tb_banner
<include refid="Where_Clause"/>
ORDER BY order_num ASC, create_time DESC
</select>
</mapper>