package com.fjhx.sale.controller.purchase;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.sale.entity.purchase.dto.EhsdPurchaseProductMountingsDto;
import com.fjhx.sale.entity.purchase.dto.EhsdPurchaseProductMountingsSelectDto;
import com.fjhx.sale.entity.purchase.vo.EhsdPurchaseProductMountingsVo;
import com.fjhx.sale.service.purchase.EhsdPurchaseProductMountingsService;
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("/ehsdPurchaseProductMountings")
public class EhsdPurchaseProductMountingsController {

    @Autowired
    private EhsdPurchaseProductMountingsService ehsdPurchaseProductMountingsService;

    /**
     * ehsd采购产品配件表分页
     */
    @PostMapping("/page")
    public Page<EhsdPurchaseProductMountingsVo> page(@RequestBody EhsdPurchaseProductMountingsSelectDto dto) {
        return ehsdPurchaseProductMountingsService.getPage(dto);
    }

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

    /**
     * ehsd采购产品配件表新增
     */
    @PostMapping("/add")
    public void add(@RequestBody EhsdPurchaseProductMountingsDto ehsdPurchaseProductMountingsDto) {
        ehsdPurchaseProductMountingsService.add(ehsdPurchaseProductMountingsDto);
    }

    /**
     * ehsd采购产品配件表编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody EhsdPurchaseProductMountingsDto ehsdPurchaseProductMountingsDto) {
        ehsdPurchaseProductMountingsService.edit(ehsdPurchaseProductMountingsDto);
    }

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

}
