package com.fjhx.mes.controller.assembly;

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.assembly.vo.AssemblyLineVo;
import com.fjhx.mes.entity.assembly.dto.AssemblyLineSelectDto;
import com.fjhx.mes.entity.assembly.dto.AssemblyLineDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.mes.service.assembly.AssemblyLineService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 产线 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-03-23
 */
@DS(SourceConstant.MES)
@RestController
@RequestMapping("/assemblyLine")
public class AssemblyLineController {

    @Autowired
    private AssemblyLineService assemblyLineService;

    /**
     * 产线分页
     */
    @PostMapping("/page")
    public Page<AssemblyLineVo> page(@RequestBody AssemblyLineSelectDto dto) {
        return assemblyLineService.getPage(dto);
    }

    /**
     * 产线明细
     */
    @PostMapping("/detail")
    public AssemblyLineVo detail(@RequestBody BaseSelectDto dto) {
        return assemblyLineService.detail(dto.getId());
    }

    /**
     * 产线新增
     */
    @PostMapping("/add")
    public void add(@RequestBody AssemblyLineDto assemblyLineDto) {
        assemblyLineService.add(assemblyLineDto);
    }

    /**
     * 产线编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody AssemblyLineDto assemblyLineDto) {
        assemblyLineService.edit(assemblyLineDto);
    }

    /**
     * 产线删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        assemblyLineService.delete(dto.getId());
    }

}
