package com.fjhx.victoriatourist.controller.jd;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.jd.dto.JdSalesReturnsDto;
import com.fjhx.victoriatourist.entity.jd.dto.JdSalesReturnsSelectDto;
import com.fjhx.victoriatourist.entity.jd.vo.JdSalesReturnsVo;
import com.fjhx.victoriatourist.service.jd.JdSalesReturnsService;
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;

import java.util.List;

/**
 * <p>
 * 京东售后退货 前端控制器
 * </p>
 *
 * @author hj
 * @since 2023-12-12
 */
@RestController
@RequestMapping("/jdSalesReturns")
public class JdSalesReturnsController {

    @Autowired
    private JdSalesReturnsService jdSalesReturnsService;

    /**
     * 京东售后退货列表
     */
    @PostMapping("/list")
    public List<JdSalesReturnsVo> list(@RequestBody JdSalesReturnsSelectDto dto) {
        return jdSalesReturnsService.getList(dto);
    }

    /**
     * 京东售后退货分页
     */
    @PostMapping("/page")
    public Page<JdSalesReturnsVo> page(@RequestBody JdSalesReturnsSelectDto dto) {
        return jdSalesReturnsService.getPage(dto);
    }

    /**
     * 京东售后退货明细
     */
    @PostMapping("/detail")
    public JdSalesReturnsVo detail(@RequestBody BaseSelectDto dto) {
        return jdSalesReturnsService.detail(dto.getId());
    }

    /**
     * 京东售后退货新增
     */
    @PostMapping("/add")
    public void add(@RequestBody JdSalesReturnsDto jdSalesReturnsDto) {
        jdSalesReturnsService.add(jdSalesReturnsDto);
    }

    /**
     * 京东售后退货编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody JdSalesReturnsDto jdSalesReturnsDto) {
        jdSalesReturnsService.edit(jdSalesReturnsDto);
    }

    /**
     * 京东售后退货删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        jdSalesReturnsService.delete(dto.getId());
    }

}
