cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
@@ -765,4 +765,16 @@ public void changeScore(@RequestBody ChangeScore changeScore){ worldCupCompetitorService.changeScore(changeScore); } /** * 获取用户比赛记录明细 * @param userGameRecordList * @return */ @ResponseBody @PostMapping("/worldCup/userGameRecordList") public Map<String, Object> userGameRecordList(@RequestBody UserGameRecordList userGameRecordList){ return worldCupCompetitorService.userGameRecordList(userGameRecordList); } } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java
@@ -55,4 +55,12 @@ * @return */ List<Map<String, Object>> worldCupGameStatisticsInfoList(@Param("worldCupId") Integer worldCupId); /** * 获取用户比赛记录详情 * @param name * @return */ List<Map<String, Object>> userGameRecordList(@Param("name") String name); } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/UserGameRecordList.java
New file @@ -0,0 +1,27 @@ package com.dsh.communityWorldCup.model; import lombok.Data; /** * @author zhibing.pu * @Date 2024/3/7 10:34 */ @Data public class UserGameRecordList { /** * 用户姓名 */ private String userName; /** * 参与比赛名称 */ private String name; /** * 页码 */ private Integer offset; /** * 页条数 */ private Integer limit; } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/UserStatisticsList.java
New file @@ -0,0 +1,31 @@ package com.dsh.communityWorldCup.model; import lombok.Data; /** * @author zhibing.pu * @Date 2024/3/7 9:37 */ @Data public class UserStatisticsList { /** * 姓名 */ private String name; /** * 电话号码 */ private String phone; /** * 身份证号 */ private String idcard; /** * 页码 */ private Integer offset; /** * 页条数 */ private Integer limit; } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java
@@ -76,4 +76,12 @@ * @param changeScore */ void changeScore(ChangeScore changeScore); /** * 获取用户比赛记录明细 * @param userGameRecordList * @return */ Map<String, Object> userGameRecordList(UserGameRecordList userGameRecordList); } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
@@ -369,6 +369,8 @@ Integer win = Integer.valueOf(map.get("win").toString()); Integer lose = totalSession - win; map.put("lose", lose); map.put("participantType", participantType); map.put("participantId", participantId); AppUser appUser = appUserClient.getAppUser(appUserId); map.put("province", appUser.getProvince() + appUser.getCity()); if(1 == participantType){ @@ -517,4 +519,49 @@ } this.updateBatchById(blueList); } /** * 获取用户比赛记录详情 * @param userGameRecordList * @return */ @Override public Map<String, Object> userGameRecordList(UserGameRecordList userGameRecordList) { String name = userGameRecordList.getUserName(); List<Map<String, Object>> list = this.baseMapper.userGameRecordList(userGameRecordList.getName()); List<Map<String, Object>> mapList = new ArrayList<>(); for (Map<String, Object> map : list) { Long participantType = Long.valueOf(map.get("participantType").toString()); Integer participantId = Integer.valueOf(map.get("participantId").toString()); Integer ourScore = Integer.valueOf(map.get("ourScore").toString()); Integer opponentScore = Integer.valueOf(map.get("opponentScore").toString()); Integer matchResult = Integer.valueOf(map.get("matchResult").toString()); if(1 == participantType){ TStudent tStudent = studentClient.queryById(participantId); if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } map.put("userName", tStudent.getName()); }else{ Participant participant = participantClient.getParticipant(participantId); if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){ continue; } map.put("userName", participant.getName()); } map.put("score", ourScore.compareTo(opponentScore) > 0 ? ourScore + ":" + opponentScore : opponentScore + ":" + ourScore); map.put("matchResult", matchResult == 1 ? "胜" : "负"); mapList.add(map); } Map<String, Object> map = new HashMap<>(); map.put("total", mapList.size()); Integer offset = userGameRecordList.getOffset(); Integer limit = userGameRecordList.getLimit(); limit += offset; map.put("rows", mapList.subList(offset, mapList.size() >= limit ? limit : mapList.size())); return map; } } cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
@@ -199,4 +199,23 @@ ) as b on (a.participantId = b.participantId and a.participantType = b.participantType) ) as aa order by aa.totalSession desc </select> <select id="userGameRecordList" resultType="map"> select participantType, participantId, appUserId, DATE_FORMAT(a.startTime, '%Y-%m-%d %H:%i') as startTime, ourScore, opponentScore, matchResult, b.`name` from t_world_cup_competitor a left join t_world_cup b on (a.worldCupId = b.id) where 1 = 1 <if test="null != name and '' != name"> and b.name like CONCAT('%', #{name}, '%') </if> order by a.startTime desc </select> </mapper>