冷门种子推荐,冷门种子下载不计入下载量,冷门种子自动化判断
Change-Id: Iba4d232d8408195c5af01d2f1686d171e3d5eeac
diff --git a/src/main/resources/mapper/PeerMapper.xml b/src/main/resources/mapper/PeerMapper.xml
index b3d4780..4c90eae 100644
--- a/src/main/resources/mapper/PeerMapper.xml
+++ b/src/main/resources/mapper/PeerMapper.xml
@@ -10,6 +10,22 @@
SELECT * FROM peers
WHERE info_hash = #{infoHash} and peer_id = #{peerId}
</select>
+ <select id="selectAllInfoHashesWithPeers" resultType="String">
+ SELECT DISTINCT info_hash FROM peers
+ </select>
+
+ <select id="countRecentActivity" resultType="Long" parameterType="String">
+ SELECT COUNT(*) FROM peers
+ WHERE info_hash = #{infoHash}
+ AND last_activity_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+ </select>
+ <select id="selectByInfoHashList" parameterType="list" resultType="com.example.g8backend.entity.Torrent">
+ SELECT * FROM torrents
+ WHERE info_hash IN
+ <foreach item="item" index="index" collection="infoHashes" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ </select>
<update id="updatePeer">
UPDATE peers
SET uploaded = #{uploaded}, downloaded = #{downloaded}