| <?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="com.example.g8backend.mapper.TorrentMapper"> |
| <insert id="insertTorrent" > |
| INSERT INTO torrents (user_id, torrent_name, info_hash, file_size) |
| VALUES (#{userId}, #{torrentName}, UNHEX(#{infoHash}), #{fileSize}) |
| <select id="getTorrentByInfoHash" resultType="com.example.g8backend.entity.Torrent"> |
| HEX(info_hash) AS infoHash, |
| WHERE info_hash = UNHEX(#{infoHash}) |
| <select id="getTorrentByTorrentId" resultType="com.example.g8backend.entity.Torrent"> |
| HEX(info_hash) AS infoHash, |
| WHERE torrent_id = #{torrentId} |