package com.mosty.yjzl.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.entity.yjzl.TbZxzb;
import com.mosty.base.model.query.yjzl.TbZxzbQuery;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.token.JwtSysUser;
import com.mosty.yjzl.service.TbZxzbService;
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.*;

import java.util.List;

@Api(tags = "中心坐标相关接口")
@RestController
@AllArgsConstructor
@CrossOrigin
@RequestMapping("/tbZxzb")
public class TbZxzbController {

    private final TbZxzbService tbZxzbService;

    @ApiOperation("查询中心坐标列表-分页")
    @GetMapping(value = "/getPageList")
    @JwtSysUser
    public ResponseResult<IPage<TbZxzb>> getPageList(@RequestBody TbZxzbQuery zxzbQuery) {
        return ResponseResult.success(tbZxzbService.queryListPage(zxzbQuery));
    }

    @ApiOperation("查询中心坐标列表-不分页")
    @GetMapping("/getList")
    @JwtSysUser
    public ResponseResult<List<TbZxzb>> getList(TbZxzbQuery zxzbQuery) {
        return ResponseResult.success(tbZxzbService.queryList(zxzbQuery));
    }

    @ApiOperation("计算犯罪区域")
    @GetMapping("/computeCenter")
    @JwtSysUser
    @ApiImplicitParams({
            @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "String", required = false),
            @ApiImplicitParam(name = "endTime", value = "结束时间", dataType = "String", required = false)
    })
    public ResponseResult computeCenter(String startTime, String endTime) {
        tbZxzbService.computeCenter(startTime, endTime);
        return ResponseResult.success();
    }

}
