package com.fjhx.mes.controller.applicable;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.mes.entity.applicable.vo.ApplicableProductsVo;
import com.fjhx.mes.entity.applicable.dto.ApplicableProductsSelectDto;
import com.fjhx.mes.entity.applicable.dto.ApplicableProductsDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.mes.service.applicable.ApplicableProductsService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 工艺适用产品明细 前端控制器
 * </p>
 *
 * @author
 * @since 2023-03-28
 */
@RestController
@RequestMapping("/applicableProducts")
public class ApplicableProductsController {

    @Autowired
    private ApplicableProductsService applicableProductsService;

    /**
     * 工艺适用产品明细分页
     */
    @PostMapping("/page")
    public Page<ApplicableProductsVo> page(@RequestBody ApplicableProductsSelectDto dto) {
        return applicableProductsService.getPage(dto);
    }

    /**
     * 工艺适用产品明细明细
     */
    @PostMapping("/detail")
    public ApplicableProductsVo detail(@RequestBody BaseSelectDto dto) {
        return applicableProductsService.detail(dto.getId());
    }

    /**
     * 工艺适用产品明细新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ApplicableProductsDto applicableProductsDto) {
        applicableProductsService.add(applicableProductsDto);
    }

    /**
     * 工艺适用产品明细编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ApplicableProductsDto applicableProductsDto) {
        applicableProductsService.edit(applicableProductsDto);
    }

    /**
     * 工艺适用产品明细删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        applicableProductsService.delete(dto.getId());
    }

}
