From f3941b2f0eb14a545268a822f3f038e036fbf580 Mon Sep 17 00:00:00 2001 From: Himit_ZH <372347736@qq.com> Date: Fri, 15 Jan 2021 17:39:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=80=E8=BF=917=E5=A4=A9?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8E=92=E8=A1=8C=E6=A6=9C=EF=BC=8C=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E5=B8=83=E5=B1=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/AdminContestController.java | 13 +- .../hoj/controller/oj/HomeController.java | 22 +- .../top/hcode/hoj/dao/UserRecordMapper.java | 2 + .../top/hcode/hoj/dao/xml/ContestMapper.xml | 6 +- .../hcode/hoj/dao/xml/UserRecordMapper.xml | 14 + .../hcode/hoj/service/UserRecordService.java | 4 + .../service/impl/UserRecordServiceImpl.java | 7 + .../admin/AdminContestController.class | Bin 14397 -> 14269 bytes .../hoj/controller/oj/HomeController.class | Bin 3353 -> 3897 bytes .../top/hcode/hoj/dao/UserRecordMapper.class | Bin 974 -> 1086 bytes .../top/hcode/hoj/dao/xml/ContestMapper.xml | 6 +- .../hcode/hoj/dao/xml/UserRecordMapper.xml | 14 + .../hcode/hoj/service/UserRecordService.class | Bin 748 -> 860 bytes .../service/impl/UserRecordServiceImpl.class | Bin 2270 -> 2450 bytes hoj-vue/src/common/api.js | 4 + hoj-vue/src/common/constants.js | 6 +- hoj-vue/src/store/contest.js | 16 +- hoj-vue/src/views/oj/Home.vue | 266 ++++++++++++------ 18 files changed, 272 insertions(+), 108 deletions(-) diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/AdminContestController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/AdminContestController.java index af3706d1..a7d6e2ff 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/AdminContestController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/AdminContestController.java @@ -58,16 +58,17 @@ public class AdminContestController { if (currentPage == null || currentPage < 1) currentPage = 1; if (limit == null || limit < 1) limit = 10; IPage iPage = new Page<>(currentPage,limit); - IPage contestList = null; + QueryWrapper queryWrapper = new QueryWrapper<>(); + if (!StringUtils.isEmpty(keyword)) { - QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper .like("title", keyword).or() - .like("id", keyword).orderByDesc("gmt_create"); - contestList = contestService.page(iPage, queryWrapper); - }else{ - contestList = contestService.page(iPage); + .like("id", keyword); } + + queryWrapper.orderByDesc("start_time"); + + IPage contestList = contestService.page(iPage, queryWrapper); if (contestList.getTotal() == 0) { // 未查询到一条数据 return CommonResult.successResponse(contestList,"暂无数据"); } else { diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java index c1f1ba43..e192dfad 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/HomeController.java @@ -9,10 +9,12 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import top.hcode.hoj.common.result.CommonResult; import top.hcode.hoj.dao.ContestMapper; +import top.hcode.hoj.pojo.vo.ACMRankVo; import top.hcode.hoj.pojo.vo.AnnouncementVo; import top.hcode.hoj.pojo.vo.ConfigVo; import top.hcode.hoj.pojo.vo.ContestVo; import top.hcode.hoj.service.impl.AnnouncementServiceImpl; +import top.hcode.hoj.service.impl.UserRecordServiceImpl; import java.util.List; @@ -33,6 +35,9 @@ public class HomeController { @Autowired private AnnouncementServiceImpl announcementDao; + + @Autowired + private UserRecordServiceImpl userRecordService; /** * @MethodName getRecentContest @@ -47,7 +52,22 @@ public class HomeController { List contests = contestDao.getWithinNext14DaysContests(); return CommonResult.successResponse(contests); } - + + + /** + * @MethodName getRecentSevenACRank + * @Params * @param null + * @Description 获取最近7天用户做题榜单 + * @Return + * @Since 2021/1/15 + */ + @GetMapping("/get-recent-seven-ac-rank") + public CommonResult getRecentSevenACRank(){ + List recent7ACRank = userRecordService.getRecent7ACRank(); + + return CommonResult.successResponse(recent7ACRank,"获取成功!"); + } + /** * @MethodName getCommonAnnouncement diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/UserRecordMapper.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/UserRecordMapper.java index c15a539a..66efcca5 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/UserRecordMapper.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/UserRecordMapper.java @@ -24,6 +24,8 @@ import java.util.List; @Repository public interface UserRecordMapper extends BaseMapper { List getACMRankList(IPage page); + List getRecent7ACRank(); List getOIRankList(IPage page); UserHomeVo getUserHomeInfo(@Param("uid") String uid); + } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/ContestMapper.xml b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/ContestMapper.xml index 41fe87c2..1bc883d7 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/ContestMapper.xml +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/ContestMapper.xml @@ -15,15 +15,15 @@ and c.type = #{type} - order by c.gmt_create DESC + order by c.start_time DESC diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/UserRecordMapper.xml b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/UserRecordMapper.xml index aa49c3c0..93470860 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/UserRecordMapper.xml +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/dao/xml/UserRecordMapper.xml @@ -8,6 +8,20 @@ FROM user_info u,user_record ur WHERE u.uuid = ur.uid AND u.status = 0 ORDER BY ac DESC,solved DESC + + + diff --git a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/dao/xml/UserRecordMapper.xml b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/dao/xml/UserRecordMapper.xml index aa49c3c0..93470860 100644 --- a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/dao/xml/UserRecordMapper.xml +++ b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/dao/xml/UserRecordMapper.xml @@ -8,6 +8,20 @@ FROM user_info u,user_record ur WHERE u.uuid = ur.uid AND u.status = 0 ORDER BY ac DESC,solved DESC + + +