package com.fjhx.purchase.controller.refund;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.purchase.entity.refund.vo.RefundDetailVo;
import com.fjhx.purchase.entity.refund.dto.RefundDetailSelectDto;
import com.fjhx.purchase.entity.refund.dto.RefundDetailDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.purchase.service.refund.RefundDetailService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 退款明细 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-13
 */
@RestController
@RequestMapping("/refundDetail")
public class RefundDetailController {

    @Autowired
    private RefundDetailService refundDetailService;

    /**
     * 退款明细分页
     */
    @PostMapping("/page")
    public Page<RefundDetailVo> page(@RequestBody RefundDetailSelectDto dto) {
        return refundDetailService.getPage(dto);
    }

    /**
     * 退款明细明细
     */
    @PostMapping("/detail")
    public RefundDetailVo detail(@RequestBody BaseSelectDto dto) {
        return refundDetailService.detail(dto.getId());
    }

    /**
     * 退款明细新增
     */
    @PostMapping("/add")
    public void add(@RequestBody RefundDetailDto refundDetailDto) {
        refundDetailService.add(refundDetailDto);
    }

    /**
     * 退款明细编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody RefundDetailDto refundDetailDto) {
        refundDetailService.edit(refundDetailDto);
    }

    /**
     * 退款明细删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        refundDetailService.delete(dto.getId());
    }

}
