소스 검색

feat(user): 添加用户参与赛事总数查询功能- 在 ParticipantsMapper 中新增 selectUserTournamentTotal 方法
- 忽略租户拦截器对新方法的影响
- 实现对应的 XML 查询语句,统计指定用户的参赛次数- 注入 ParticipantsMapper 到 UserServiceImpl 中
- 修改用户信息查询逻辑,使用新的赛事计数方式
- 移除旧的通过奖励领取记录计算赛事数量的代码
- 更新用户 VO 对象中的 tournamentCount 字段赋值逻辑

fugui001 2 달 전
부모
커밋
f781d4f564

+ 4 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/mapper/ParticipantsMapper.java

@@ -44,4 +44,8 @@ public interface ParticipantsMapper extends BaseMapperPlus<Participants, Partici
     int selectParticipantsTotal(@Param("tournamentId") Long tournamentId);
 
 
+    @InterceptorIgnore(tenantLine = "true")
+    int selectUserTournamentTotal(@Param("playerId") Long playerId);
+
+
 }

+ 5 - 3
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/business/service/impl/UserServiceImpl.java

@@ -62,6 +62,7 @@ public class UserServiceImpl implements IUserService {
 
     private final PlayersItemsLogMapper playersItemsLogMapper;
 
+    private final ParticipantsMapper participantsMapper;
 
     private static final ObjectMapper objectMapper = new ObjectMapper();
 
@@ -108,15 +109,16 @@ public class UserServiceImpl implements IUserService {
         Page<UserVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
         List<UserVo> resultRecords = result.getRecords();
         for (UserVo resultRecord : resultRecords) {
-            int userRewardCount = rewardClaimsMapper.selectUserRewardCount(resultRecord.getId());
-            resultRecord.setTournamentCount(userRewardCount);
+            //int userRewardCount = rewardClaimsMapper.selectUserRewardCount(resultRecord.getId());
+
+            int tournamentCount= participantsMapper.selectUserTournamentTotal(resultRecord.getId());
+            resultRecord.setTournamentCount(tournamentCount);
 
             PlayerItemsVo playerItemsVo = playerItemsMapper.selectPlayerItemsInfo(resultRecord.getId(), 1001L);
 
             if(playerItemsVo!=null){
                 //道具数量 /门票数
                 resultRecord.setItemsQuantity(playerItemsVo.getQuantity());
-
             }
 
             Long jiFenCount = playerItemsMapper.selectPlayerJiFenCount(resultRecord.getId());

+ 4 - 0
ruoyi-modules/ruoyi-system/src/main/resources/mapper/business/ParticipantsMapper.xml

@@ -79,4 +79,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT IFNULL(count(*),0) total FROM participants WHERE tournament_id = #{tournamentId}
     </select>
 
+    <select id="selectUserTournamentTotal" parameterType="Long" resultType="int">
+        select count(1) from participants where player_id=#{playerId}
+    </select>
+
 </mapper>