package vip.xiaonuo.money.controller;


import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.hr.modular.baseemployeeinfo.entity.HrBaseEmployeeInfo;
import vip.xiaonuo.hr.modular.baseemployeeinfo.param.HrBaseEmployeeInfoPageParam;
import vip.xiaonuo.money.entity.MoneyBusiness;
import vip.xiaonuo.money.param.MoneyBusinessPageParam;
import vip.xiaonuo.money.param.MoneyBusinessParam;
import vip.xiaonuo.money.service.IMoneyBusinessService;

import java.util.Map;

/**
 * <p>
 * 财务营业情况 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-19
 */
@Api(tags = "财务指标卡控制器")
@ApiSupport(author = "wang", order = 1)
@RestController
@Validated
public class MoneyBusinessController {
    @Autowired
    private IMoneyBusinessService businessService;


    @ApiOperationSupport(order = 1)
    @ApiOperation("指标卡")
    @PostMapping("/money/listBusiness")
    public CommonResult<JSONArray> listBusiness(@RequestBody  MoneyBusinessParam moneyBusinessParam) {
        return CommonResult.data(businessService.listBusiness(moneyBusinessParam));
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation("指标卡列表")
    @PostMapping("/money/getPage")
    public CommonResult<Page<MoneyBusiness>> getPage(@RequestBody MoneyBusinessPageParam pageParam) {
        return CommonResult.data(businessService.getPage(pageParam));
    }

    @ApiOperationSupport(order = 3)
    @ApiOperation("财务指标卡填报")
    @PostMapping("/money/addBusiness")
    public CommonResult<String> addBusiness(@RequestBody  MoneyBusiness business) {
        businessService.addBusiness(business);
        return CommonResult.ok();
    }

    @ApiOperationSupport(order = 4)
    @ApiOperation("财务指标卡修改")
    @PostMapping("/money/updateBusiness")
    public CommonResult<String> updateBusiness(@RequestBody  MoneyBusiness business) {
        businessService.updateBusiness(business);
        return CommonResult.ok();
    }

    @ApiOperationSupport(order = 5)
    @ApiOperation("财务指标卡删除")
    @PostMapping("/money/deleteBusiness")
    public CommonResult<String> deleteBusiness(@RequestBody  MoneyBusiness business) {
        businessService.deleteBusiness(business);
        return CommonResult.ok();
    }
}
