package com.ycwl.basic.controller.pc;

import com.github.pagehelper.PageInfo;
import com.ycwl.basic.model.pc.face.entity.FaceEntity;
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
import com.ycwl.basic.service.pc.FaceService;
import com.ycwl.basic.utils.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：longbinbin
 * @Date：2024/12/2 16:33
 */
@RestController
@RequestMapping("/api/face/v1")
// 用户人脸管理
public class FaceController {
    @Autowired
    private FaceService faceService;

    // 分页查询用户人脸
    @PostMapping("/page")
    public ApiResponse<PageInfo<FaceRespVO>> pageQuery(@RequestBody FaceReqQuery faceReqQuery) {
        return faceService.pageQuery(faceReqQuery);
    }
    // 用户人脸列表查询
    @PostMapping("/list")
    public ApiResponse<List<FaceRespVO>> list(@RequestBody FaceReqQuery faceReqQuery) {
        return faceService.list(faceReqQuery);
    }
    // 用户人脸详情查询
    @GetMapping("/getDetail/{id}")
    public ApiResponse<FaceRespVO> getDetail(@PathVariable("id") Long id) {
        return faceService.getById(id);
    }
    // 添加用户人脸信息
    @PostMapping("/add")
    public ApiResponse<Integer> add(@RequestBody FaceEntity face) {
        return faceService.add(face);
    }
    // 删除用户人脸信息
    @PostMapping("/deleteById/{id}")
    public ApiResponse<Integer> deleteById(@PathVariable Long id) {
        return faceService.deleteById(id);
    }
    // 批量删除用户人脸
    @PostMapping("/deleteByIds")
    public ApiResponse<Integer> deleteByIds(@RequestBody List<Long> ids) {
        return faceService.deleteByIds(ids);
    }

}
