wuchimedes | a0649c6 | 2025-04-05 15:53:39 +0800 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 3 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 4 | |
| 5 | <mapper namespace="com.example.g8backend.mapper.TorrentMapper"> |
| 6 | <insert id="insertTorrent" > |
| 7 | INSERT INTO torrents (user_id, torrent_name, info_hash, file_size) |
| 8 | VALUES (#{userId}, #{torrentName}, UNHEX(#{infoHash}), #{fileSize}) |
| 9 | </insert> |
| 10 | |
| 11 | <select id="getTorrentByInfoHash" resultType="com.example.g8backend.entity.Torrent"> |
| 12 | SELECT |
| 13 | torrent_id, |
| 14 | user_id, |
| 15 | torrent_name, |
| 16 | HEX(info_hash) AS infoHash, |
| 17 | file_size |
| 18 | FROM torrents |
| 19 | WHERE info_hash = UNHEX(#{infoHash}) |
| 20 | </select> |
| 21 | |
| 22 | <select id="getTorrentByTorrentId" resultType="com.example.g8backend.entity.Torrent"> |
| 23 | SELECT |
| 24 | torrent_id, |
| 25 | user_id, |
| 26 | torrent_name, |
| 27 | HEX(info_hash) AS infoHash, |
| 28 | file_size |
| 29 | FROM torrents |
| 30 | WHERE torrent_id = #{torrentId} |
| 31 | </select> |
| 32 | </mapper> |