blob: afb29d712a7a5439bfeec0d8db7f6ad36af017cd [file] [log] [blame]
86133ec55c542025-04-21 11:51:32 +08001<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE mapper
3PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5<mapper namespace="com.ruoyi.torrent.mapper.BtTorrentMapper">
6
7 <resultMap type="BtTorrent" id="BtTorrentResult">
8 <result property="torrentId" column="torrent_id" />
9 <result property="infoHash" column="info_hash" />
10 <result property="name" column="name" />
11 <result property="length" column="length" />
12 <result property="pieceLength" column="piece_length" />
13 <result property="piecesCount" column="pieces_count" />
14 <result property="createdBy" column="created_by" />
15 <result property="torrentCreateTime" column="torrent_create_time" />
16 <result property="uploaderId" column="uploader_id" />
17 <result property="uploadTime" column="upload_time" />
18 <result property="filePath" column="file_path" />
19 </resultMap>
20
21 <sql id="selectBtTorrentVo">
22 select torrent_id, info_hash, name, length, piece_length, pieces_count, created_by, torrent_create_time, uploader_id, upload_time, file_path from bt_torrent
23 </sql>
24
25 <select id="selectBtTorrentList" parameterType="BtTorrent" resultMap="BtTorrentResult">
26 <include refid="selectBtTorrentVo"/>
27 <where>
28 <if test="infoHash != null and infoHash != ''"> and info_hash = #{infoHash}</if>
29 <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
30 <if test="length != null "> and length = #{length}</if>
31 <if test="pieceLength != null "> and piece_length = #{pieceLength}</if>
32 <if test="piecesCount != null "> and pieces_count = #{piecesCount}</if>
33 <if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
34 <if test="torrentCreateTime != null "> and torrent_create_time = #{torrentCreateTime}</if>
35 <if test="uploaderId != null "> and uploader_id = #{uploaderId}</if>
36 <if test="uploadTime != null "> and upload_time = #{uploadTime}</if>
37 <if test="filePath != null and filePath != ''"> and file_path = #{filePath}</if>
38 </where>
39 </select>
40
41 <select id="selectBtTorrentByTorrentId" parameterType="Long" resultMap="BtTorrentResult">
42 <include refid="selectBtTorrentVo"/>
43 where torrent_id = #{torrentId}
44 </select>
45
46 <insert id="insertBtTorrent" parameterType="BtTorrent" useGeneratedKeys="true" keyProperty="torrentId">
47 insert into bt_torrent
48 <trim prefix="(" suffix=")" suffixOverrides=",">
49 <if test="infoHash != null and infoHash != ''">info_hash,</if>
50 <if test="name != null and name != ''">name,</if>
51 <if test="length != null">length,</if>
52 <if test="pieceLength != null">piece_length,</if>
53 <if test="piecesCount != null">pieces_count,</if>
54 <if test="createdBy != null">created_by,</if>
55 <if test="torrentCreateTime != null">torrent_create_time,</if>
56 <if test="uploaderId != null">uploader_id,</if>
57 <if test="uploadTime != null">upload_time,</if>
58 <if test="filePath != null">file_path,</if>
59 </trim>
60 <trim prefix="values (" suffix=")" suffixOverrides=",">
61 <if test="infoHash != null and infoHash != ''">#{infoHash},</if>
62 <if test="name != null and name != ''">#{name},</if>
63 <if test="length != null">#{length},</if>
64 <if test="pieceLength != null">#{pieceLength},</if>
65 <if test="piecesCount != null">#{piecesCount},</if>
66 <if test="createdBy != null">#{createdBy},</if>
67 <if test="torrentCreateTime != null">#{torrentCreateTime},</if>
68 <if test="uploaderId != null">#{uploaderId},</if>
69 <if test="uploadTime != null">#{uploadTime},</if>
70 <if test="filePath != null">#{filePath},</if>
71 </trim>
72 </insert>
73
74 <update id="updateBtTorrent" parameterType="BtTorrent">
75 update bt_torrent
76 <trim prefix="SET" suffixOverrides=",">
77 <if test="infoHash != null and infoHash != ''">info_hash = #{infoHash},</if>
78 <if test="name != null and name != ''">name = #{name},</if>
79 <if test="length != null">length = #{length},</if>
80 <if test="pieceLength != null">piece_length = #{pieceLength},</if>
81 <if test="piecesCount != null">pieces_count = #{piecesCount},</if>
82 <if test="createdBy != null">created_by = #{createdBy},</if>
83 <if test="torrentCreateTime != null">torrent_create_time = #{torrentCreateTime},</if>
84 <if test="uploaderId != null">uploader_id = #{uploaderId},</if>
85 <if test="uploadTime != null">upload_time = #{uploadTime},</if>
86 <if test="filePath != null">file_path = #{filePath},</if>
87 </trim>
88 where torrent_id = #{torrentId}
89 </update>
90
91 <delete id="deleteBtTorrentByTorrentId" parameterType="Long">
92 delete from bt_torrent where torrent_id = #{torrentId}
93 </delete>
94
95 <delete id="deleteBtTorrentByTorrentIds" parameterType="String">
96 delete from bt_torrent where torrent_id in
97 <foreach item="torrentId" collection="array" open="(" separator="," close=")">
98 #{torrentId}
99 </foreach>
100 </delete>
101</mapper>