From edb2fff00f6990217f7c39ebc2adb611a1c60478 Mon Sep 17 00:00:00 2001 From: nickchange <126672920+nickchange@users.noreply.github.com> Date: 星期六, 28 十月 2023 11:21:57 +0800 Subject: [PATCH] 10.28 --- cloud-server-competition/src/main/resources/mapper/CompetitionMapper.xml | 34 +++++++++++++++++++++------------- 1 files changed, 21 insertions(+), 13 deletions(-) diff --git a/cloud-server-competition/src/main/resources/mapper/CompetitionMapper.xml b/cloud-server-competition/src/main/resources/mapper/CompetitionMapper.xml index ddc2650..4483e47 100644 --- a/cloud-server-competition/src/main/resources/mapper/CompetitionMapper.xml +++ b/cloud-server-competition/src/main/resources/mapper/CompetitionMapper.xml @@ -13,20 +13,27 @@ aa.introduction, aa.registerEndTime, aa.age, - aa.heat + (aa.baseNumber+aa.userCompetitionCount) as heat from ( - select - a.id, - a.`name`, - a.coverDrawing, - a.city as cityName, - a.registerCondition, - a.introduction, - DATE_FORMAT(a.registerEndTime, '%Y-%m-%d %H:%i') registerEndTime, - CONCAT(a.startAge, '-', a.endAge) age, - (a.baseNumber + a.applicantsNumber) heat - from t_competition a - where a.auditStatus = 2 and a.`status` = 2 and a.state = 1 + SELECT + a.id, + a.`name`, + a.coverDrawing, + a.city AS cityName, + a.registerCondition, + a.introduction, + DATE_FORMAT(a.registerEndTime, '%Y-%m-%d %H:%i') AS registerEndTime, + CONCAT(a.startAge, '-', a.endAge) AS age, + a.baseNumber, + COUNT(uc.competitionId) AS userCompetitionCount + FROM + t_competition a + LEFT JOIN + t_user_competition5 uc ON a.id = uc.competitionId + WHERE + a.auditStatus = 2 + AND a.`status` IN (1, 2) + AND a.state = 1 <if test="null != cityCode and '' != cityCode"> and a.cityCode = #{cityCode} </if> @@ -36,6 +43,7 @@ <if test="null != registerCondition"> and a.registerCondition = #{registerCondition} </if> + GROUP BY a.id order by a.insertTime desc ) as aa <if test="null != heat and '' != heat"> -- Gitblit v1.7.1