package com.tofly.analyse.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tofly.analyse.entity.PipeCountDto;
import com.tofly.analyse.entity.SpaceCountDto;
import com.tofly.analyse.entity.SubtypeCountDto;
import com.tofly.analyse.service.SpaceCountService;
import com.tofly.common.core.entity.ResultRespone;
import com.tofly.common.log.annotation.ToFlyAppLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/spaceCount")
@Api(tags = "空间统计")
public class SpaceCountController {

   @Autowired	
   private SpaceCountService spaceCountService;
      
   @ToFlyAppLog(title = "空间、查询统计")
   @PostMapping("/getCountData")
   public ResultRespone getCountData(@RequestBody SpaceCountDto spaceCountDto) {
       return spaceCountService.getSpaceCount(spaceCountDto);
   }

   @ToFlyAppLog(title = "管径、管材、埋深统计")
   @GetMapping("/getPipeCount")
   @ApiOperation(value = "管径、管材、埋深统计")
   public ResultRespone getPipeCount(Page page, @ModelAttribute PipeCountDto dto) {
      return ResultRespone.success(spaceCountService.getPipeCountData(page,dto));
   }

   @ToFlyAppLog(title = "附属物统计")
   @ApiOperation(value = "附属物统计")
   @PostMapping("/getSubtypeCount")
   public ResultRespone getSubtypeCount( @RequestBody SubtypeCountDto dto) {
      return ResultRespone.success(spaceCountService.getSubtypeCount(dto));
   }

}