修复关注互关

This commit is contained in:
abu 2025-03-29 20:42:04 +08:00
parent 6834b4a129
commit 3d3d9a2bba
7 changed files with 29 additions and 9 deletions

View File

@ -13,9 +13,9 @@ spring:
minimum-idle: 5 # 最小连接数
maximum-pool-size: 20 # 最大连接数
auto-commit: true # 自动提交
idle-timeout: 600000 # 连接超时的最大时长毫秒超时则会被释放retired
idle-timeout: 300000 # 连接超时的最大时长毫秒超时则会被释放retired
pool-name: DataSourceHikariCP # 连接池的名字
max-lifetime: 18000000 # 连接池的最大生命时长毫秒超时则会被释放retired
max-lifetime: 540000 # 连接池的最大生命时长毫秒超时则会被释放retired
connection-test-query: SELECT 1
redis:
host: 82.156.121.2
@ -24,11 +24,11 @@ spring:
database: 1 # 使用的数据库编号
jedis:
pool:
max-idle: 200 # 最大空闲连接
max-idle: 50 # 最大空闲连接
max-active: 200 # 连接池最大连接数
max-wait: 100 # 连接池最大阻塞等待时间, -1表示没有限制
max-wait: 5000 # 连接池最大阻塞等待时间, -1表示没有限制
min-idle: 4 # 最小空闲连接
timeout: 50000
timeout: 60000
data:
mongodb:
# uri: mongodb://root:root@192.168.1.202:27017

View File

@ -6,4 +6,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface FansMapper extends MyMapper<Fans> {
int updateByPrimaryKeySelective(Fans record);
}

View File

@ -10,4 +10,13 @@
<result column="fan_id" property="fanId" jdbcType="VARCHAR" />
<result column="is_fan_friend_of_mine" property="isFanFriendOfMine" jdbcType="INTEGER" />
</resultMap>
<update id="updateByPrimaryKeySelective" parameterType="com.imooc.pojo.Fans">
UPDATE t_fans
<set>
<if test="vlogerId != null"> vloger_id = #{vlogerId}, </if>
<if test="fanId != null"> fan_id = #{fanId}, </if>
<if test="isFanFriendOfMine != null"> is_fan_friend_of_mine = #{isFanFriendOfMine}, </if>
</set>
WHERE id = #{id}
</update>
</mapper>

View File

@ -7,7 +7,9 @@
SELECT
u.id as vlogerId,
u.nickname as nickname,
u.face as face
u.face as face,
f.is_fan_friend_of_mine as bothFriend,
f.created_time as createdTime
FROM
t_fans f
LEFT JOIN
@ -17,7 +19,7 @@
WHERE
f.fan_id = #{paramMap.myId}
ORDER BY
u.nickname
f.created_time
ASC
</select>
@ -27,7 +29,9 @@
SELECT
u.id as fanId,
u.nickname as nickname,
u.face as face
u.face as face,
f.is_fan_friend_of_mine as bothFriend,
f.created_time as createdTime
FROM
t_fans f
LEFT JOIN

View File

@ -14,4 +14,6 @@ public class FansVO {
private String nickname;
private String face;
private boolean isFriend = false;
private int bothFriend;
private String createdTime;
}

View File

@ -14,4 +14,7 @@ public class VlogerVO {
private String nickname;
private String face;
private boolean isFollowed = true;
private int bothFriend;
private String createdTime;
}

View File

@ -63,6 +63,7 @@ public class FansServiceImpl extends BaseInfoProperties implements FansService {
vloger.setIsFanFriendOfMine(YesOrNo.YES.type);
fansMapper.updateByPrimaryKeySelective(vloger);
System.out.println(vloger.getIsFanFriendOfMine());
} else {
fans.setIsFanFriendOfMine(YesOrNo.NO.type);
}
@ -86,7 +87,6 @@ public class FansServiceImpl extends BaseInfoProperties implements FansService {
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("vlogerId", vlogerId);
criteria.andEqualTo("fanId", fanId);
List list = fansMapper.selectByExample(example);
Fans fan = null;
@ -107,6 +107,7 @@ public class FansServiceImpl extends BaseInfoProperties implements FansService {
// 抹除双方的朋友关系自己的关系删除即可
Fans pendingFan = queryFansRelationship(vlogerId, myId);
pendingFan.setIsFanFriendOfMine(YesOrNo.NO.type);
System.out.println(pendingFan.getIsFanFriendOfMine());
fansMapper.updateByPrimaryKeySelective(pendingFan);
}