package com.fjhx.sale.controller.purchase;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.purchase.dto.EhsdPurchaseProductDto;
import com.fjhx.sale.entity.purchase.dto.EhsdPurchaseProductSelectDto;
import com.fjhx.sale.entity.purchase.vo.EhsdPurchaseProductVo;
import com.fjhx.sale.service.purchase.EhsdPurchaseProductService;
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>
 * ehsd采购产品表 前端控制器
 * </p>
 *
 * @author
 * @since 2023-05-17
 */
@RestController
@RequestMapping("/ehsdPurchaseProduct")
public class EhsdPurchaseProductController {

    @Autowired
    private EhsdPurchaseProductService ehsdPurchaseProductService;

    /**
     * ehsd采购产品表分页
     */
    @PostMapping("/page")
    public Page<EhsdPurchaseProductVo> page(@RequestBody EhsdPurchaseProductSelectDto dto) {
        return ehsdPurchaseProductService.getPage(dto);
    }

    /**
     * ehsd采购产品表明细
     */
    @PostMapping("/detail")
    public EhsdPurchaseProductVo detail(@RequestBody BaseSelectDto dto) {
        return ehsdPurchaseProductService.detail(dto.getId());
    }

    /**
     * ehsd采购产品表新增
     */
    @PostMapping("/add")
    public void add(@RequestBody EhsdPurchaseProductDto ehsdPurchaseProductDto) {
        ehsdPurchaseProductService.add(ehsdPurchaseProductDto);
    }

    /**
     * ehsd采购产品表编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody EhsdPurchaseProductDto ehsdPurchaseProductDto) {
        ehsdPurchaseProductService.edit(ehsdPurchaseProductDto);
    }

    /**
     * ehsd采购产品表删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        ehsdPurchaseProductService.delete(dto.getId());
    }

}
