package com.huimv.video.video.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huimv.common.utils.Result;
import com.huimv.common.utils.ResultCode;
import com.huimv.video.video.entity.BaseFace;
import com.huimv.video.video.entity.BaseSpecificVideo;
import com.huimv.video.video.entity.Camera;
import com.huimv.video.video.service.IBaseFaceService;
import com.huimv.video.video.service.IBaseSpecificVideoService;
import com.huimv.video.video.service.ICameraService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2022-05-30
 */
@RestController
@RequestMapping("/baseFace")
public class BaseFaceController {
    @Autowired
    IBaseFaceService baseFaceService;


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


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

        baseFaceService.removeById(id);

        return new Result(ResultCode.SUCCESS);
    }

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

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

    @GetMapping("/list")
    public Result list(@RequestParam(name = "farmId") Integer farmId) {

        return new Result(ResultCode.SUCCESS, baseFaceService.list(new QueryWrapper<BaseFace>().eq("farm_id", farmId)));
    }

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

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



}
