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 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
 **/
@RestController
@RequestMapping("/miPay/sum")
public class MiPaySumController {

    @Autowired
    private IMiPaySumService miPaySumService;

    @PostMapping("/list")
    @PreAuthorize(permissionKey = "manage:miPaySum:list")
    public ResultVO<IPage<MiPaySumListVO>> list(@RequestBody MiPaySumListParam param) {
        return ResultVO.ok(miPaySumService.pageList(param));
    }

    @PatchMapping("/status/update")
    @PreAuthorize(permissionKey = "manage:miPaySum:statusUpdate")
    public ResultVO<Boolean> statusUpdate(@RequestParam Long id, @RequestParam Integer status) {
        return ResultVO.ok(miPaySumService.statusUpdate(id, status));
    }

    @PatchMapping("/maxPayCount/update")
    @PreAuthorize(permissionKey = "manage:miPaySum:maxPayCountUpdate")
    public ResultVO<Boolean> maxPayCountUpdate(@RequestParam Long id, @RequestParam BigDecimal maxPayCount) {
        return ResultVO.ok(miPaySumService.maxPayCountUpdate(id, maxPayCount));
    }


}
