- 在 PlayerItemsMapper 中添加 selectPlayerJiFenCount 方法,用于查询玩家的积分总数 - 更新 UserServiceImpl 中的逻辑,使用新的积分查询方法- 修改 PlayerItemsMapper.xml,添加新的 SQL 查询语句
@@ -35,7 +35,8 @@ public interface PlayerItemsMapper extends BaseMapperPlus<PlayerItems, PlayerIte
@InterceptorIgnore(tenantLine = "true")
PlayerItemsVo selectPlayerItemsInfo(@Param("playerId") Long playerId,@Param("itemId") Long itemId);
-
+ @InterceptorIgnore(tenantLine = "true")
+ Long selectPlayerJiFenCount(@Param("playerId") Long playerId);
}
@@ -83,10 +83,11 @@ public class UserServiceImpl implements IUserService {
resultRecord.setItemsQuantity(playerItemsVo.getQuantity());
- playerItemsVo = playerItemsMapper.selectPlayerItemsInfo(resultRecord.getId(), 1L);
- if(playerItemsVo!=null){
+
+ Long jiFenCount = playerItemsMapper.selectPlayerJiFenCount(resultRecord.getId());
+ if(jiFenCount!=null){
//参赛积分
- resultRecord.setPointsQuantity(playerItemsVo.getQuantity());
+ resultRecord.setPointsQuantity(jiFenCount);
@@ -59,6 +59,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE player_id=#{playerId} and item_id= #{itemId}
</select>
+ <select id="selectPlayerJiFenCount" resultType="Long">
+ SELECT sum(quantity) FROM player_items
+ WHERE player_id=#{playerId} and item_id in (1,2)
+ </select>
</mapper>