package com.fjhx.controller.production;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.params.production.ProductionLineEx;
import com.fjhx.params.production.ProductionLineVo;
import com.fjhx.service.production.ProductionLineService;
import org.springblade.core.tool.api.R;
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;

import java.util.Map;

/**
 * <p>
 * 生产线 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-06-28
 */
@RestController
@RequestMapping("/productionLine")
public class ProductionLineController {

    @Autowired
    private ProductionLineService productionLineService;

    @PostMapping("/page")
    public R page(@RequestBody Map<String, String> condition) {
        Page<ProductionLineEx> result = productionLineService.getPage(condition);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody ProductionLineVo productionLineVo) {
        productionLineService.add(productionLineVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody ProductionLineVo productionLineVo) {
        productionLineService.edit(productionLineVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody ProductionLineVo productionLineVo) {
        productionLineService.delete(productionLineVo);
        return R.success();
    }

}

