测试本地

Change-Id: Ib3a541fac7efd46cccd608c351fcd5f3236f475f
diff --git a/src/main/resources/mapper/TorrentMapper.xml b/src/main/resources/mapper/TorrentMapper.xml
index cec75eb..e831504 100644
--- a/src/main/resources/mapper/TorrentMapper.xml
+++ b/src/main/resources/mapper/TorrentMapper.xml
@@ -3,31 +3,32 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
 <mapper namespace="com.example.g8backend.mapper.TorrentMapper">
-    <insert id="insertTorrent" >
+
+    <insert id="insertTorrent">
         INSERT INTO torrents (user_id, torrent_name, file_path, info_hash, file_size)
-        VALUES (#{userId}, #{torrentName}, #{filePath}, UNHEX(#{infoHash}), #{fileSize})
+        VALUES (#{userId}, #{torrentName}, #{filePath}, #{infoHash}, #{fileSize})
     </insert>
 
     <select id="getTorrentByInfoHash" resultType="com.example.g8backend.entity.Torrent">
         SELECT
-            torrent_id,
-            user_id,
-            torrent_name,
-            file_path,
-            HEX(info_hash) AS infoHash,
-            file_size
+        torrent_id,
+        user_id,
+        torrent_name,
+        file_path,
+        info_hash AS infoHash,
+        file_size
         FROM torrents
-        WHERE info_hash = UNHEX(#{infoHash})
+        WHERE info_hash = #{infoHash}
     </select>
 
     <select id="getTorrentByTorrentId" resultType="com.example.g8backend.entity.Torrent">
         SELECT
-            torrent_id,
-            user_id,
-            torrent_name,
-            file_path,
-            HEX(info_hash) AS infoHash,
-            file_size
+        torrent_id,
+        user_id,
+        torrent_name,
+        file_path,
+        info_hash AS infoHash,
+        file_size
         FROM torrents
         WHERE torrent_id = #{torrentId}
     </select>
@@ -38,19 +39,21 @@
         user_id,
         torrent_name,
         file_path,
-        HEX(info_hash) AS infoHash,
-        file_size
+        info_hash AS infoHash,
+        file_size,
+        upload_time
         FROM torrents
         WHERE info_hash IN
         <foreach collection="infoHashes" item="hash" open="(" separator="," close=")">
-            UNHEX(#{hash})
+            #{hash}
         </foreach>
     </select>
 
+
     <update id="updateIsRareByInfoHash">
-        UPDATE torrent
-        SET israre = #{israre}
+        UPDATE torrents
+        SET is_rare = #{israre}
         WHERE info_hash = #{infoHash}
     </update>
 
-</mapper>
\ No newline at end of file
+</mapper>