From c28ec496f1be725be92bfdf43b98c117953e0069 Mon Sep 17 00:00:00 2001 From: DingGang <2498628697@qq.com> Date: Sat, 23 Apr 2022 18:51:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E6=88=B7=E6=9F=A5=E8=AF=A2=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E5=8F=8A=E6=9C=80=E7=83=AD=E8=83=BD=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResourceController.java | 15 +++++++++++++ .../modules/resource/dao/ResourceDao.java | 2 ++ .../resource/service/ResourceService.java | 3 +++ .../service/impl/ResourceServiceImpl.java | 15 +++++++++++++ .../resources/mapper/resource/ResourceDao.xml | 22 +++++++++++++++++++ 5 files changed, 57 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java index a18c9360..1d04f184 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/controller/ResourceController.java @@ -92,6 +92,21 @@ public class ResourceController { return new Result<>().ok(resourceService.selectTotal()); } + @GetMapping("/selectNewest") + @ApiOperation("查询最新上架能力") + @LogOperation("查询最新上架能力") + public Result selectNewest(@RequestBody JSONObject jsonObject){ + return new Result<>().ok(resourceService.selectNewest(jsonObject)); + } + + + @GetMapping("/selectMostPopular") + @ApiOperation("查询热门能力") + @LogOperation("查询热门能力") + public Result selectMostPopular(@RequestBody JSONObject jsonObject){ + return new Result<>().ok(resourceService.selectMostPopular(jsonObject)); + } + @PostMapping("/insert") @ApiOperation("保存") diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java index 15fc6082..7a8c8e1d 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dao/ResourceDao.java @@ -23,4 +23,6 @@ public interface ResourceDao extends BaseDao { List selectWithAttrs(@Param("dto") ResourceDTO resourceDTO); List selectTypeCount(Long deptId); + + List selectMostPopular(); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java index 8aa19d76..8e590ab3 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/ResourceService.java @@ -34,4 +34,7 @@ public interface ResourceService extends CrudService queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("create_date") + .eq(StringUtils.isNotBlank(jsonObject.getString("type")),"type", jsonObject.getString("type")); + return resourceDao.selectList(queryWrapper); + + } + + @Override + public Object selectMostPopular(JSONObject jsonObject) { + resourceDao.selectMostPopular(); + return null; + } } \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 861320cf..e2e911a1 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -132,4 +132,26 @@ group by type order by type + + \ No newline at end of file