86133 | ec55c54 | 2025-04-21 11:51:32 +0800 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <!DOCTYPE mapper |
| 3 | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 5 | <mapper namespace="com.ruoyi.torrent.mapper.BtTorrentFileMapper"> |
| 6 | |
| 7 | <resultMap type="BtTorrentFile" id="BtTorrentFileResult"> |
| 8 | <result property="id" column="id" /> |
| 9 | <result property="torrentId" column="torrent_id" /> |
| 10 | <result property="filePath" column="file_path" /> |
| 11 | <result property="fileSize" column="file_size" /> |
| 12 | </resultMap> |
| 13 | |
| 14 | <sql id="selectBtTorrentFileVo"> |
| 15 | select id, torrent_id, file_path, file_size from bt_torrent_file |
| 16 | </sql> |
| 17 | |
| 18 | <select id="selectBtTorrentFileList" parameterType="BtTorrentFile" resultMap="BtTorrentFileResult"> |
| 19 | <include refid="selectBtTorrentFileVo"/> |
| 20 | <where> |
| 21 | <if test="torrentId != null "> and torrent_id = #{torrentId}</if> |
| 22 | <if test="filePath != null and filePath != ''"> and file_path = #{filePath}</if> |
| 23 | <if test="fileSize != null "> and file_size = #{fileSize}</if> |
| 24 | </where> |
| 25 | </select> |
| 26 | |
| 27 | <select id="selectBtTorrentFileById" parameterType="Long" resultMap="BtTorrentFileResult"> |
| 28 | <include refid="selectBtTorrentFileVo"/> |
| 29 | where id = #{id} |
| 30 | </select> |
| 31 | |
| 32 | <insert id="insertBtTorrentFile" parameterType="BtTorrentFile" useGeneratedKeys="true" keyProperty="id"> |
| 33 | insert into bt_torrent_file |
| 34 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 35 | <if test="torrentId != null">torrent_id,</if> |
| 36 | <if test="filePath != null and filePath != ''">file_path,</if> |
| 37 | <if test="fileSize != null">file_size,</if> |
| 38 | </trim> |
| 39 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 40 | <if test="torrentId != null">#{torrentId},</if> |
| 41 | <if test="filePath != null and filePath != ''">#{filePath},</if> |
| 42 | <if test="fileSize != null">#{fileSize},</if> |
| 43 | </trim> |
| 44 | </insert> |
| 45 | |
| 46 | <update id="updateBtTorrentFile" parameterType="BtTorrentFile"> |
| 47 | update bt_torrent_file |
| 48 | <trim prefix="SET" suffixOverrides=","> |
| 49 | <if test="torrentId != null">torrent_id = #{torrentId},</if> |
| 50 | <if test="filePath != null and filePath != ''">file_path = #{filePath},</if> |
| 51 | <if test="fileSize != null">file_size = #{fileSize},</if> |
| 52 | </trim> |
| 53 | where id = #{id} |
| 54 | </update> |
| 55 | |
| 56 | <delete id="deleteBtTorrentFileById" parameterType="Long"> |
| 57 | delete from bt_torrent_file where id = #{id} |
| 58 | </delete> |
| 59 | |
| 60 | <delete id="deleteBtTorrentFileByIds" parameterType="String"> |
| 61 | delete from bt_torrent_file where id in |
| 62 | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| 63 | #{id} |
| 64 | </foreach> |
| 65 | </delete> |
| 66 | </mapper> |