package com.njzscloud.dispose.finance.controller;

import com.njzscloud.common.core.utils.R;
import com.njzscloud.common.mp.support.PageParam;
import com.njzscloud.common.mp.support.PageResult;
import com.njzscloud.dispose.finance.pojo.entity.BillEntity;
import com.njzscloud.dispose.finance.service.BillService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 对账单
 * @author ljw
 */
@Slf4j
@RestController
@RequestMapping("/bill")
@RequiredArgsConstructor
public class BillController {

    private final BillService billService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody BillEntity billEntity) {
        billService.add(billEntity);
        return R.success();
    }

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody BillEntity billEntity) {
        billService.modify(billEntity);
        return R.success();
    }

    /**
     * 删除
     */
    @PostMapping("/del")
    public R<?> del(@RequestBody List<Long> ids) {
        billService.del(ids);
        return R.success();
    }

    /**
     * 详情
     */
    @GetMapping("/detail")
    public R<BillEntity> detail(@RequestParam("id") Long id) {
        return R.success(billService.detail(id));
    }

    /**
     * 分页查询
     */
    @GetMapping("/paging")
    public R<PageResult<BillEntity>> paging(PageParam pageParam, BillEntity billEntity) {
        return R.success(billService.paging(pageParam, billEntity));
    }
}


