package com.huimv.eartag.controller;


import com.huimv.eartag.entity.FeedEnvTempFlow;
import com.huimv.eartag.entity.FeedFowlRecord;
import com.huimv.eartag.service.IFeedEnvTempFlowService;
import com.huimv.eartag.service.IFeedFowlRecordService;
import com.huimv.eartag.vo.Result;
import com.huimv.eartag.vo.ResultCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 牛只档案 前端控制器
 * </p>
 *
 * @author author
 * @since 2022-06-01
 */
@RestController
@RequestMapping("/feedFowlRecord")
public class FeedFowlRecordController {
    @Autowired
    IFeedFowlRecordService feedFowlRecordService;


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


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

        feedFowlRecordService.removeById(id);

        return new Result(ResultCode.SUCCESS);
    }

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

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

    @GetMapping("/list")
    public Result list(@RequestParam(name = "bulidCode",required = false) String bulidCode) {

        return new Result(ResultCode.SUCCESS, feedFowlRecordService.listAll(bulidCode));
    }
}
