package com.huimv.eartag.controller;


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

/**
 * <p>
 * 栋舍管理 前端控制器
 * </p>
 *
 * @author author
 * @since 2022-06-01
 */
@RestController
@RequestMapping("/feedBuild")
public class FeedBuildController {
    @Autowired
    IFeedBuildService feedBuildService;


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


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

        feedBuildService.removeById(id);

        return new Result(ResultCode.SUCCESS);
    }

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

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

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

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