package com.fjhx.victoriatourist.controller.jd;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.victoriatourist.entity.jd.dto.JdBackDto;
import com.fjhx.victoriatourist.entity.jd.dto.JdBackSelectDto;
import com.fjhx.victoriatourist.entity.jd.vo.JdBackVo;
import com.fjhx.victoriatourist.service.jd.JdBackService;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


/**
 * <p>
 * 京东退货 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-18
 */
@RestController
@RequestMapping("/jdBack")
public class JdBackController {

    @Autowired
    private JdBackService jdBackService;

    /**
     * 京东退货分页
     */
    @PostMapping("/page")
    public Page<JdBackVo> page(@RequestBody JdBackSelectDto dto) {
        return jdBackService.getPage(dto);
    }

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

    /**
     * 京东退货新增
     */
    @PostMapping("/add")
    public void add(@RequestBody JdBackDto jdBackDto) {
        jdBackService.add(jdBackDto);
    }

    /**
     * 京东退货编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody JdBackDto jdBackDto) {
        jdBackService.edit(jdBackDto);
    }

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

    /**
     * 京东退货Excel导入
     */
    @PostMapping("/excelImport")
    public void excelImport(@RequestParam("file") MultipartFile file, @RequestParam("warehouseId") Long warehouseId) {
        jdBackService.excelImport(file, warehouseId);
    }

}
