package com.huimv.eartag.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huimv.common.utils.Result;
import com.huimv.common.utils.ResultCode;
import com.huimv.eartag.entity.FeedAncestry;
import com.huimv.eartag.service.IFeedAncestryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 谱系管理 前端控制器
 * </p>
 *
 * @author author
 * @since 2022-06-01
 */
@RestController
@RequestMapping("/feedAncestry")
public class FeedAncestryController {
    @Autowired
    IFeedAncestryService feedAncestryService;


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


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

        feedAncestryService.removeById(id);

        return new Result(ResultCode.SUCCESS);
    }

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

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

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

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


}
