package com.zanxiang.game.data.serve.controller;

import com.zanxiang.erp.security.annotation.PreAuthorize;
import com.zanxiang.game.data.serve.pojo.dto.*;
import com.zanxiang.game.data.serve.pojo.vo.*;
import com.zanxiang.game.data.serve.service.IPitcherDataService;
import com.zanxiang.game.data.serve.utils.Page;
import com.zanxiang.module.util.pojo.ResultVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tianhua
 * @time 2023/8/15
 * @Description 投手数据相关控制层接口
 **/
@RestController
@RequestMapping("/pitcherData")
@Slf4j
public class PitcherDataController {

    @Autowired
    private IPitcherDataService pitcherDataService;

    @PreAuthorize(permissionKey = "pitcherData:pitcher:day")
    @PostMapping("/pitcher/day")
    public ResultVO<Page<PitcherDataDayVO>> getPitcherDataDay(@RequestBody PitcherDataDayDTO dto) {
        return ResultVO.ok(pitcherDataService.getPitcherDataDay(dto));
    }

    @PreAuthorize(permissionKey = "pitcherData:pitcher:dayTotal")
    @PostMapping("/pitcher/day/total")
    public ResultVO<PitcherDataDayTotalVO> getPitcherDataDayTotal(@RequestBody PitcherDataDayTotalDTO dto) {
        return ResultVO.ok(pitcherDataService.getPitcherDataDayTotal(dto));
    }

    @PreAuthorize(permissionKey = "pitcherData:pitcher:total")
    @PostMapping("/pitcher/total")
    public ResultVO<Page<PitcherDataTotalVO>> getPitcherDataTotal(@RequestBody PitcherDataTotalDTO dto) {
        return ResultVO.ok(pitcherDataService.getPitcherDataTotal(dto));
    }

    @PreAuthorize(permissionKey = "pitcherData:pitcher:totalSum")
    @PostMapping("/pitcher/total/sum")
    public ResultVO<PitcherDataTotalSumVO> getPitcherDataTotalSum(@RequestBody PitcherDataTotalSumDTO dto) {
        return ResultVO.ok(pitcherDataService.getPitcherDataTotalSum(dto));
    }

    @PreAuthorize(permissionKey = "pitcherData:pitcherGame:day")
    @PostMapping("/pitcherGame/day")
    public ResultVO<Page<PitcherGameDataDayVO>> getPitcherGameDataDay(@RequestBody PitcherGameDataDayDTO dto) {
        return ResultVO.ok(pitcherDataService.getPitcherGameDataDay(dto));
    }

    @PreAuthorize(permissionKey = "pitcherData:pitcherGame:dayTotal")
    @PostMapping("/pitcherGame/day/total")
    public ResultVO<PitcherGameDataDayTotalVO> getPitcherGameDataDayTotal(@RequestBody PitcherGameDataDayTotalDTO dto) {
        return ResultVO.ok(pitcherDataService.getPitcherGameDataDayTotal(dto));
    }

    @PreAuthorize(permissionKey = "pitcherData:pitcherGame:total")
    @PostMapping("/pitcherGame/total")
    public ResultVO<Page<PitcherGameDataTotalVO>> getPitcherGameDataTotal(@RequestBody PitcherGameDataTotalDTO dto) {
        return ResultVO.ok(pitcherDataService.getPitcherGameDataTotal(dto));
    }

    @PreAuthorize(permissionKey = "pitcherData:pitcherGame:totalSum")
    @PostMapping("/pitcherGame/total/sum")
    public ResultVO<PitcherGameDataTotalSumVO> getPitcherGameDataTotalSum(@RequestBody PitcherGameDataTotalSumDTO dto) {
        return ResultVO.ok(pitcherDataService.getPitcherGameDataTotalSum(dto));
    }


}
