fix(schedule): 修复集体项目类型显示为双人的问题

- 修改MartialScheduleServiceImpl中type=2的显示文本从双人改为集体
- 保持与前端项目管理页面的类型定义一致(1=单人,2=集体)
This commit is contained in:
2026-01-09 12:58:28 +08:00
parent 559dea702a
commit df7efac819
12 changed files with 16 additions and 11 deletions

View File

@@ -15,6 +15,7 @@ import org.springblade.core.tool.utils.Func;
import org.springblade.modules.martial.pojo.entity.MartialAthlete; import org.springblade.modules.martial.pojo.entity.MartialAthlete;
import org.springblade.modules.martial.pojo.entity.MartialCompetition; import org.springblade.modules.martial.pojo.entity.MartialCompetition;
import org.springblade.modules.martial.service.IMartialAthleteService; import org.springblade.modules.martial.service.IMartialAthleteService;
import org.springblade.modules.martial.mapper.MartialAthleteMapper;
import org.springblade.modules.martial.service.IMartialCompetitionService; import org.springblade.modules.martial.service.IMartialCompetitionService;
import org.springblade.modules.system.pojo.entity.User; import org.springblade.modules.system.pojo.entity.User;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@@ -43,11 +44,9 @@ public class MartialCompetitionController extends BladeController {
public R<MartialCompetition> detail(@RequestParam Long id) { public R<MartialCompetition> detail(@RequestParam Long id) {
MartialCompetition detail = competitionService.getById(id); MartialCompetition detail = competitionService.getById(id);
if (detail != null) { if (detail != null) {
Long cnt = martialAthleteService.count(Wrappers.<MartialAthlete>query().lambda() // Count distinct participants by id_card
.eq(MartialAthlete::getCompetitionId, detail.getId()) Long cnt = ((MartialAthleteMapper) martialAthleteService.getBaseMapper()).countDistinctParticipants(detail.getId());
.eq(MartialAthlete::getIsDeleted, 0) detail.setTotalParticipants(cnt != null ? cnt.intValue() : 0);
);
detail.setTotalParticipants(cnt.intValue());
} }
return R.data(detail); return R.data(detail);
} }
@@ -61,11 +60,9 @@ public class MartialCompetitionController extends BladeController {
IPage<MartialCompetition> pages = competitionService.page(Condition.getPage(query), Condition.getQueryWrapper(competition)); IPage<MartialCompetition> pages = competitionService.page(Condition.getPage(query), Condition.getQueryWrapper(competition));
List<MartialCompetition> pagelist = pages.getRecords(); List<MartialCompetition> pagelist = pages.getRecords();
for (MartialCompetition martialCompetition : pagelist) { for (MartialCompetition martialCompetition : pagelist) {
Long cnt = martialAthleteService.count(Wrappers.<MartialAthlete>query().lambda() // Count distinct participants by id_card
.eq(MartialAthlete::getCompetitionId, martialCompetition.getId()) Long cnt = ((MartialAthleteMapper) martialAthleteService.getBaseMapper()).countDistinctParticipants(martialCompetition.getId());
.eq(MartialAthlete::getIsDeleted, 0) martialCompetition.setTotalParticipants(cnt != null ? cnt.intValue() : 0);
);
martialCompetition.setTotalParticipants(cnt.intValue());
} }
return R.data(pages); return R.data(pages);
} }

View File

@@ -385,6 +385,8 @@ public class MartialRegistrationOrderController extends BladeController {
newRecord.setGender(existingAthlete.getGender()); newRecord.setGender(existingAthlete.getGender());
newRecord.setIdCard(existingAthlete.getIdCard()); newRecord.setIdCard(existingAthlete.getIdCard());
newRecord.setIdCardType(existingAthlete.getIdCardType()); newRecord.setIdCardType(existingAthlete.getIdCardType());
newRecord.setBirthDate(existingAthlete.getBirthDate());
newRecord.setAge(existingAthlete.getAge());
newRecord.setContactPhone(existingAthlete.getContactPhone()); newRecord.setContactPhone(existingAthlete.getContactPhone());
newRecord.setOrganization(existingAthlete.getOrganization()); newRecord.setOrganization(existingAthlete.getOrganization());
newRecord.setTeamName(existingAthlete.getTeamName()); newRecord.setTeamName(existingAthlete.getTeamName());

View File

@@ -22,4 +22,10 @@ public interface MartialAthleteMapper extends BaseMapper<MartialAthlete> {
*/ */
IPage<MartialAthleteVO> selectAthleteVOPage(IPage<MartialAthleteVO> page, @Param("athlete") MartialAthlete athlete); IPage<MartialAthleteVO> selectAthleteVOPage(IPage<MartialAthleteVO> page, @Param("athlete") MartialAthlete athlete);
/**
* Count distinct participants by id_card for a competition
*/
@org.apache.ibatis.annotations.Select("SELECT COUNT(DISTINCT id_card) FROM martial_athlete WHERE competition_id = #{competitionId} AND is_deleted = 0")
Long countDistinctParticipants(@Param("competitionId") Long competitionId);
} }

View File

@@ -348,7 +348,7 @@ public class MartialScheduleServiceImpl extends ServiceImpl<MartialScheduleMappe
groupDTO.setType("单人"); groupDTO.setType("单人");
break; break;
case 2: case 2:
groupDTO.setType("双人"); groupDTO.setType("集体");
break; break;
case 3: case 3:
groupDTO.setType("集体"); groupDTO.setType("集体");