Browse Source

接口:根据taskId查询累计的任务时长

zyh
小久哥 3 years ago
parent
commit
44fee2cf6e
  1. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/controller/admin/discuss/DiscussController.java
  2. 5
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussService.java
  3. 7
      zsw-farm/zsw-farm-impl/src/main/java/cn/iocoder/yudao/module/farm/service/discuss/DiscussServiceImpl.java

5
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<Integer> cumulativeQuantity(@RequestParam("taskId") Long taskId){
return discussService.cumulativeQuantity(taskId);
}
}

5
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<PageVO<DiscussDTO>> findDiscussList(DiscussPageDTO pageDTO);
/**
* 根据taskId查询累计的任务时长
**/
R<Integer> cumulativeQuantity(Long taskId);
}

7
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<Integer> cumulativeQuantity(Long taskId){
List<DiscussDO> discussDOList = discussMapper.selectList(DiscussDO::getTaskId, taskId);
if (ObjectUtil.isEmpty(discussDOList)){
return R.success(0);
}
return R.success(discussDOList.stream().mapToInt(DiscussDO::getCropNum).sum());
}
}

Loading…
Cancel
Save