package vip.xiaonuo.money.controller;


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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.money.entity.MoneyCost;
import vip.xiaonuo.money.param.MoneyInOutPageParam;
import vip.xiaonuo.money.param.MoneyInOutParam;
import vip.xiaonuo.money.service.IMoneyCostService;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 财务费用分析 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-21
 */
@Api(tags = "费用分析控制器")
@ApiSupport(author = "SNOWY_TEAM", order = 1)
@RestController
@Validated
public class MoneyCostController {
    @Autowired
    private IMoneyCostService costService;

    @ApiOperationSupport(order = 1)
    @ApiOperation("费用分析")
    @PostMapping("/money-cost/listCost")
    public CommonResult<List<MoneyCost>> listCost(@RequestBody MoneyInOutParam outParam) {
        return CommonResult.data(costService.listCost(outParam));
    }

    @ApiOperationSupport(order = 2)
    @ApiOperation("费用分析添加")
    @PostMapping("/money-cost/add")
    public CommonResult add(@RequestBody MoneyCost moneyCost) {
        return costService.add(moneyCost);
    }

    @ApiOperationSupport(order = 3)
    @ApiOperation("费用分析修改")
    @PostMapping("/money-cost/update")
    public CommonResult update(@RequestBody MoneyCost moneyCost) {
        return costService.update(moneyCost);
    }

    @ApiOperationSupport(order = 4)
    @ApiOperation("费用分析删除")
    @PostMapping("/money-cost/delete")
    public CommonResult delete(@RequestBody Map<String,String> paramsMap) {
        return costService.delete(paramsMap);
    }

    @ApiOperationSupport(order = 5)
    @ApiOperation("费用分析分页")
    @PostMapping("/money-cost/page")
    public CommonResult page(@RequestBody MoneyInOutPageParam pageParam) {
        return costService.page(pageParam);
    }

}
