package com.huimv.eartag.controller;


import com.huimv.common.utils.Result;
import com.huimv.common.utils.ResultCode;
import com.huimv.eartag.entity.FeedBuild;
import com.huimv.eartag.entity.FeedStage;
import com.huimv.eartag.service.IFeedBuildService;
import com.huimv.eartag.service.IFeedStageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 阶段管理 前端控制器
 * </p>
 *
 * @author author
 * @since 2022-06-01
 */
@RestController
@RequestMapping("/feedStage")
public class FeedStageController {
    @Autowired
    IFeedStageService feedStageService;


    @PostMapping("/add")
    public Result add(@RequestBody FeedStage baseFace) {
        feedStageService.save(baseFace);
        return new Result(ResultCode.SUCCESS);
    }


    @GetMapping("/remove")
    public Result remove(@RequestParam(name = "id") String id) {

        feedStageService.removeById(id);

        return new Result(ResultCode.SUCCESS);
    }

    @PostMapping("/update")
    public Result update(@RequestBody  FeedStage baseFace) {

        feedStageService.updateById(baseFace);
        return new Result(ResultCode.SUCCESS);
    }

    @GetMapping("/list")
    public Result list( ) {

        return new Result(ResultCode.SUCCESS, feedStageService.list());
    }
}
