package com.fjhx.sale.controller.after;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.after.dto.AfterSalesDto;
import com.fjhx.sale.entity.after.dto.AfterSalesSelectDto;
import com.fjhx.sale.entity.after.vo.AfterSalesVo;
import com.fjhx.sale.service.after.AfterSalesService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * <p>
 * sale_售后管理 前端控制器
 * </p>
 *
 * @author
 * @since 2024-01-31
 */
@RestController
@RequestMapping("/afterSales")
public class AfterSalesController {

    @Autowired
    private AfterSalesService afterSalesService;

    /**
     * 售后管理分页
     */
    @PostMapping("/page")
    public Page<AfterSalesVo> page(@RequestBody AfterSalesSelectDto dto) {
        return afterSalesService.getPage(dto);
    }

    /**
     * 售后管理明细
     */
    @PostMapping("/detail")
    public AfterSalesVo detail(@RequestBody BaseSelectDto dto) {
        return afterSalesService.detail(dto.getId());
    }

    /**
     * 售后管理新增
     */
    @PostMapping("/add")
    public void add(@RequestBody AfterSalesDto afterSalesDto) {
        afterSalesService.add(afterSalesDto);
    }

    /**
     * sale_售后管理编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody AfterSalesDto afterSalesDto) {
        afterSalesService.edit(afterSalesDto);
    }

    /**
     * sale_售后管理删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        afterSalesService.delete(dto.getId());
    }

}
