package com.zanxiang.game.module.manage.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zanxiang.erp.security.annotation.PreAuthorize;
import com.zanxiang.game.module.manage.pojo.params.MiPaySumListParam;
import com.zanxiang.game.module.manage.pojo.vo.MiPaySumListVO;
import com.zanxiang.game.module.manage.service.IMiPaySumService;
import com.zanxiang.module.util.pojo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

/**
 * @Description 米大师支付统计
 * @Author tianhua
 * @Date 2023/6/27  11:10
 **/
@Api(tags = "米大师支付管理")
@RestController
@RequestMapping("/miPay/sum")
public class MiPaySumController {

    @Autowired
    private IMiPaySumService miPaySumService;

    @ApiOperation(value = "米大师支付统计列表查询")
    @PostMapping("/list")
    @PreAuthorize(permissionKey = "manage:miPaySum:list")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = MiPaySumListVO.class)})
    public ResultVO<IPage<MiPaySumListVO>> list(@RequestBody MiPaySumListParam param) {
        return ResultVO.ok(miPaySumService.pageList(param));
    }

    @ApiOperation(value = "米大师支付状态变更")
    @PatchMapping("/status/update")
    @PreAuthorize(permissionKey = "manage:miPaySum:statusUpdate")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
    public ResultVO<Boolean> statusUpdate(@RequestParam Long id, @RequestParam Integer status) {
        return ResultVO.ok(miPaySumService.statusUpdate(id, status));
    }

    @ApiOperation(value = "米大师支付最大支付额度修改")
    @PatchMapping("/maxPayCount/update")
    @PreAuthorize(permissionKey = "manage:miPaySum:maxPayCountUpdate")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "成功", response = Boolean.class)})
    public ResultVO<Boolean> maxPayCountUpdate(@RequestParam Long id, @RequestParam BigDecimal maxPayCount) {
        return ResultVO.ok(miPaySumService.maxPayCountUpdate(id, maxPayCount));
    }


}
