package com.fjhx.mes.controller.production;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.fjhx.common.constant.SourceConstant;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.mes.entity.production.vo.ProductionProcessesVo;
import com.fjhx.mes.entity.production.dto.ProductionProcessesSelectDto;
import com.fjhx.mes.entity.production.dto.ProductionProcessesDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.mes.service.production.ProductionProcessesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;


/**
 * <p>
 * 工序 前端控制器
 * </p>
 *
 * @author
 * @since 2023-03-28
 */
//@DS(SourceConstant.MES)
@RestController
@RequestMapping("/productionProcesses")
public class ProductionProcessesController {

    @Autowired
    private ProductionProcessesService productionProcessesService;

    /**
     * 工序分页
     */
    @PostMapping("/page")
    public Page<ProductionProcessesVo> page(@RequestBody ProductionProcessesSelectDto dto) {
        return productionProcessesService.getPage(dto);
    }

    /**
     * 工序明细
     */
    @PostMapping("/detail")
    public ProductionProcessesVo detail(@RequestBody BaseSelectDto dto) {
        return productionProcessesService.detail(dto.getId());
    }

    /**
     * 工序新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ProductionProcessesDto productionProcessesDto) {
        productionProcessesService.add(productionProcessesDto);
    }

    /**
     * 工序编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ProductionProcessesDto productionProcessesDto) {
        productionProcessesService.edit(productionProcessesDto);
    }

    /**
     * 工序删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        productionProcessesService.delete(dto.getId());
    }

}
