测试本地

Change-Id: Ib3a541fac7efd46cccd608c351fcd5f3236f475f
diff --git a/src/main/resources/mapper/PeerMapper.xml b/src/main/resources/mapper/PeerMapper.xml
index 4c90eae..27814fd 100644
--- a/src/main/resources/mapper/PeerMapper.xml
+++ b/src/main/resources/mapper/PeerMapper.xml
@@ -2,33 +2,41 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.example.g8backend.mapper.PeerMapper">
-    <select id="getPeerByPK">
+
+    <select id="getPeerByPK" parameterType="map" resultType="com.example.g8backend.entity.Peer">
         SELECT * FROM peers
         WHERE peer_id = #{peerId} and info_hash = #{infoHash} and passkey = #{passkey}
     </select>
-    <select id="getPeerByInfoHashAndPeerId">
+
+    <select id="getPeerByInfoHashAndPeerId" parameterType="map" resultType="com.example.g8backend.entity.Peer">
         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
+        SELECT COUNT(*) FROM torrents
         WHERE info_hash = #{infoHash}
-        AND last_activity_time >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+        AND upload_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=")">
+        <foreach collection="infoHashes" item="item" open="(" separator="," close=")">
             #{item}
         </foreach>
     </select>
-    <update id="updatePeer">
+
+
+    <update id="updatePeer" parameterType="map">
         UPDATE peers
         SET uploaded = #{uploaded}, downloaded = #{downloaded}
-        WHERE peer_id = #{peerId} and info_hash = #{info_hash} and passkey = #{passkey}
+        WHERE peer_id = #{peerId} and info_hash = #{infoHash} and passkey = #{passkey}
     </update>
+
 </mapper>