package com.tofly.xrtygis.custom.controller.dma;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tofly.common.core.entity.ResultRespone;
import com.tofly.xrtygis.custom.service.CustomDmatableflowviewService;
import com.tofly.xrtygis.entity.Dmatableflowview;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * 流量历史采集分析
 *
 * @author Michael.Shu
 * @date 2021-5-26 15:57:22
 */
@RestController
@AllArgsConstructor
@RequestMapping("/dmaflow")
@Api(tags = "分区计量--流量历史采集分析")
public class CustomDmatableflowviewController {

    private final CustomDmatableflowviewService customDmatableflowviewService;

    /**
     * 分区获取流量数据
     *
     * @param response   响应对象
     * @param page       分页对象
     * @param start_time 开始时间
     * @param end_time   结束时间
     * @param table_ids  观察表ID集（多个英文逗号隔开）
     * @return
     */
    @PostMapping("/list")
    @ApiOperation(value = "流量历史采集列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "start_time", value = "开始时间"),
            @ApiImplicitParam(name = "end_time", value = "结束时间"),
            @ApiImplicitParam(name = "table_ids", value = "观察表ID集，多个用英文逗号隔开"),
            @ApiImplicitParam(name = "isExport", value = "是否导出（true导出，false不导出")
    })
    public ResultRespone getListInfo(HttpServletResponse response, Page<Dmatableflowview> page, String start_time, String end_time, String table_ids, boolean isExport) {
        return ResultRespone.success(customDmatableflowviewService.getListInfo(response, page, start_time, end_time, table_ids,isExport));
    }
}
