package com.fjhx.controller.working;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.params.working.WorkingRouteEx;
import com.fjhx.params.working.WorkingRouteVo;
import com.fjhx.service.working.WorkingRouteService;
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-07-14
 */
@RestController
@RequestMapping("/workingRoute")
public class WorkingRouteController {

    @Autowired
    private WorkingRouteService workingRouteService;

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

    @PostMapping("/add")
    public R add(@RequestBody WorkingRouteVo workingRouteVo) {
        workingRouteService.add(workingRouteVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody WorkingRouteVo workingRouteVo) {
        workingRouteService.edit(workingRouteVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody WorkingRouteVo workingRouteVo) {
        workingRouteService.delete(workingRouteVo);
        return R.success();
    }

    @PostMapping("/details")
    public R details(@RequestBody WorkingRouteVo workingRouteVo) {
        WorkingRouteEx result = workingRouteService.details(workingRouteVo);
        return R.success(result);
    }

}

