package com.njzscloud.dispose.cst.order.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.cst.order.pojo.entity.OrderPaymentRecordEntity;
import com.njzscloud.dispose.cst.order.pojo.param.SearchOrderPaymentRecordParam;
import com.njzscloud.dispose.cst.order.service.OrderPaymentRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 付费记录
 *
 * @author ljw
 */
@Slf4j
@RestController
@RequestMapping("/orderPaymentRecord")
@RequiredArgsConstructor
public class OrderPaymentRecordController {

    private final OrderPaymentRecordService orderPaymentRecordService;

    /**
     * 新增
     */
    @PostMapping("/add")
    public R<?> add(@RequestBody OrderPaymentRecordEntity orderPaymentRecordEntity) {
        orderPaymentRecordService.add(orderPaymentRecordEntity);
        return R.success();
    }

    /**
     * 修改
     */
    @PostMapping("/modify")
    public R<?> modify(@RequestBody OrderPaymentRecordEntity orderPaymentRecordEntity) {
        orderPaymentRecordService.modify(orderPaymentRecordEntity);
        return R.success();
    }

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

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

    /**
     * 分页查询
     */
    @GetMapping("/paging")
    public R<PageResult<OrderPaymentRecordEntity>> paging(PageParam pageParam, SearchOrderPaymentRecordParam param) {
        return R.success(orderPaymentRecordService.paging(pageParam, param));
    }

}
