From 65f0f31276e44be4bc12b4cc22497e4f62419a94 Mon Sep 17 00:00:00 2001 From: dinggang <2498628697@qq.com> Date: Thu, 28 Apr 2022 20:19:09 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResourceController.java | 11 ++++-- .../modules/resource/dao/ResourceDao.java | 2 ++ .../resource/service/ResourceService.java | 3 ++ .../service/impl/ResourceServiceImpl.java | 15 +++++++- .../service/impl/ResourceCarServiceImpl.java | 7 ++-- .../resources/mapper/resource/ResourceDao.xml | 34 +++++++++++++++++++ 6 files changed, 66 insertions(+), 6 deletions(-) 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 fadd7ffc..351b9601 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 @@ -49,10 +49,8 @@ public class ResourceController { @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "creator", value = "创建者用户id", paramType = "query", dataType = "String") }) - //@RequiresPermissions("resource:resource:page") public Result> page(@ApiIgnore @RequestParam Map params) { - //ResourceDTO resourceDTO = JSON.toJavaObject(jsonObject, ResourceDTO.class); - //resourceService.pageWithAttrs(resourceDTO); + params.put("del_flag", 0); PageData page = resourceService.page(params); page.getList().forEach(item -> { item.setInfoList(resourceService.selectAttrsByResourceId(item.getId())); @@ -97,6 +95,13 @@ public class ResourceController { return new Result<>().ok(resourceService.selectMostPopular(jsonObject)); } + @GetMapping("/selectRecommend") + @ApiOperation("根据用户查询推荐能力") + @LogOperation("根据用户查询推荐能力") + public Result selectRecommend() { + return new Result<>().ok(resourceService.selectRecommend()); + } + @GetMapping("/updateVisits") @ApiOperation("更新能力访问量") @LogOperation("更新能力访问量") 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 2c9de0fd..df9d23b0 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 @@ -35,4 +35,6 @@ public interface ResourceDao extends BaseDao { @Param("pageSize") Integer pageSize, @Param("orderField")String orderField, @Param("orderType") String orderType); + + List selectApplyArea(Long userId); } \ 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 9a06a2e8..38bb0a81 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 @@ -35,4 +35,7 @@ public interface ResourceService extends CrudService resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType); int j = Math.min(pageNum * pageSize, resourceDTOS.size()); @@ -227,4 +227,17 @@ public class ResourceServiceImpl extends CrudServiceImpl applyAreaList = resourceDao.selectApplyArea(userId); + //1.没有收藏和申请过,按最热能力选取 + if (applyAreaList.isEmpty()) { + + } + return null; + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java index 3deea775..a3916edb 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java @@ -12,6 +12,7 @@ import io.renren.modules.resourceCar.entity.ResourceCarEntity; import io.renren.modules.resourceCar.service.ResourceCarService; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.security.user.UserDetail; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -43,8 +44,10 @@ public class ResourceCarServiceImpl extends CrudServiceImpl ids = jsonObject.getJSONArray("ids").toJavaList(Long.class); - resourceCarDao.deleteByIds(ids); + if (ObjectUtils.allNotNull(jsonObject.getJSONArray("ids"))) { + List ids = jsonObject.getJSONArray("ids").toJavaList(Long.class); + resourceCarDao.deleteByIds(ids); + } } @Override diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 912409c8..49df40fd 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -254,4 +254,38 @@ ORDER BY ${orderField} ${orderType} LIMIT ${pageNum}, ${pageSize} + + \ No newline at end of file