From 34452ba5d5a2d2c9498cedee94f202fac2b2c484 Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Mon, 25 Dec 2023 17:26:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8A=A5=E5=90=8D=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/CompetitionRegistrationMapper.java | 2 ++ .../mapper/xml/CompetitionMapper.xml | 19 +++++++++++++++++-- .../xml/CompetitionRegistrationMapper.xml | 16 ++++++++++++++-- .../CompetitionRegistrationServiceImpl.java | 7 ++++--- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java index c924825..ec52c8b 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java +++ b/competition/src/main/java/com/huoran/competition/mapper/CompetitionRegistrationMapper.java @@ -32,4 +32,6 @@ public interface CompetitionRegistrationMapper extends BaseMapper selectApplicantByCondition(Page page,@Param("req") PageRegistrationStaffReq req); String selectSchoolName(@Param("accountId")String accountId); + + Integer countTheNumberOfApplicants(@Param("competitionId")Integer competitionId); } diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml index 286ac62..6793a78 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml @@ -61,12 +61,27 @@ c.play_end_time, c.create_time, IFNULL( - ( SELECT count( 1 ) FROM c_competition_registration WHERE competition_id = c.id GROUP BY competition_id HAVING count( 1 ) > 0 ), + ( + SELECT + count( 1 ) + FROM + c_competition_registration r + INNER JOIN nakadai.hr_user_account a ON a.id = r.account_id + AND a.is_del = 0 + INNER JOIN nakadai.hr_user_info u ON u.user_id = a.user_id + AND u.is_del = 0 + WHERE + competition_id = c.id + GROUP BY + competition_id + HAVING + count( 1 ) > 0 + ), 0 ) AS applicant_num, c.is_open, create_source, - ( CASE create_source WHEN 0 THEN '平台创建' WHEN 1 THEN '组织创建' ELSE '无' end) as createSource + ( CASE create_source WHEN 0 THEN '平台创建' WHEN 1 THEN '组织创建' ELSE '无' END ) AS createSource FROM c_competition c WHERE diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml index dfe48b9..186be89 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml @@ -48,8 +48,8 @@ END AS team_id FROM c_competition_registration qa - INNER JOIN nakadai.hr_user_account ua ON ua.id = qa.account_id - INNER JOIN nakadai.hr_user_info u ON u.user_id = ua.user_id + INNER JOIN nakadai.hr_user_account ua ON ua.id = qa.account_id and ua.is_del = 0 + INNER JOIN nakadai.hr_user_info u ON u.user_id = ua.user_id and u.is_del = 0 LEFT JOIN c_competition_team ct ON ct.competition_id = qa.competition_id AND ct.account_id = qa.account_id WHERE qa.competition_id = #{req.competitionId} @@ -135,4 +135,16 @@ join nakadai.school s on s.school_id = a.school_id WHERE a.id = #{accountId} and s.is_del = 0 + diff --git a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java index b9b8cc4..2a25baf 100644 --- a/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java +++ b/competition/src/main/java/com/huoran/competition/service/impl/CompetitionRegistrationServiceImpl.java @@ -251,9 +251,10 @@ public class CompetitionRegistrationServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); + /* QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("competition_id", competitionId); - List competitionRegistrations = baseMapper.selectList(queryWrapper); - return competitionRegistrations.size(); + List competitionRegistrations = baseMapper.selectList(queryWrapper);*/ +// return competitionRegistrations.size(); + return baseMapper.countTheNumberOfApplicants(Integer.valueOf(competitionId)); } } From 7915da7ad4750ecab8a52fe43d2fd9e027e25cbe Mon Sep 17 00:00:00 2001 From: "rong.liu" Date: Mon, 25 Dec 2023 17:40:57 +0800 Subject: [PATCH 2/2] commit --- .../mapper/xml/CompetitionMapper.xml | 111 +++++++++++------- 1 file changed, 71 insertions(+), 40 deletions(-) diff --git a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml index 6793a78..753caa7 100644 --- a/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml +++ b/competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionMapper.xml @@ -673,7 +673,22 @@ c.create_time, c.sponsor, IFNULL( - ( SELECT count( 1 ) FROM c_competition_registration WHERE competition_id = c.id GROUP BY competition_id HAVING count( 1 ) > 0 ), + ( + SELECT + count( 1 ) + FROM + c_competition_registration r + INNER JOIN nakadai.hr_user_account a ON a.id = r.account_id + AND a.is_del = 0 + INNER JOIN nakadai.hr_user_info u ON u.user_id = a.user_id + AND u.is_del = 0 + WHERE + competition_id = c.id + GROUP BY + competition_id + HAVING + count( 1 ) > 0 + ), 0 ) AS applicant_num, c.is_open, @@ -681,15 +696,15 @@ ( CASE create_source WHEN 0 THEN '平台创建' WHEN 1 THEN '组织创建' ELSE '无' END ) AS createSource, IF ( - ( SELECT r.id FROM c_competition_registration r WHERE r.competition_id = c.id AND r.account_id = #{req.accountId} ) IS NULL, + ( SELECT r.id FROM c_competition_registration r WHERE r.competition_id = c.id AND r.account_id = #{req.accountId} ) IS NULL, 1, 0 ) AS whetherToSignUp FROM c_competition c WHERE - c.is_open = 0 - and c.publish_status = 1 + c.is_open = 0 + AND c.publish_status = 1 @@ -713,44 +728,60 @@