From 44fee2cf6e2bd789217883418e7d81c14aed9183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E4=B9=85=E5=93=A5?= <787952492@qq.com> Date: Thu, 16 Jun 2022 17:12:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=9A=E6=A0=B9=E6=8D=AEta?= =?UTF-8?q?skId=E6=9F=A5=E8=AF=A2=E7=B4=AF=E8=AE=A1=E7=9A=84=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../farm/controller/admin/discuss/DiscussController.java | 5 +++++ .../yudao/module/farm/service/discuss/DiscussService.java | 5 +++++ .../module/farm/service/discuss/DiscussServiceImpl.java | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java index e3e96e76..2a7c945a 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java @@ -110,4 +110,9 @@ public class DiscussController { return discussService.findDiscussList(pageDTO); } + @ApiModelProperty("根据taskId查询累计的任务时长") + @GetMapping("/cumulativeQuantity") + public R cumulativeQuantity(@RequestParam("taskId") Long taskId){ + return discussService.cumulativeQuantity(taskId); + } } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java index a9675fec..81674a3a 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java @@ -75,4 +75,9 @@ public interface DiscussService { R> findDiscussList(DiscussPageDTO pageDTO); + /** + * 根据taskId查询累计的任务时长 + **/ + R cumulativeQuantity(Long taskId); + } diff --git a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java index f58f25f9..91a1d915 100644 --- a/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java +++ b/zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java @@ -209,4 +209,11 @@ public class DiscussServiceImpl implements DiscussService { return R.success(returnList); } + public R cumulativeQuantity(Long taskId){ + List discussDOList = discussMapper.selectList(DiscussDO::getTaskId, taskId); + if (ObjectUtil.isEmpty(discussDOList)){ + return R.success(0); + } + return R.success(discussDOList.stream().mapToInt(DiscussDO::getCropNum).sum()); + } }