package com.muyu.enterpise.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.muyu.common.core.domain.Result;
import com.muyu.domain.CarFence;
import com.muyu.domain.req.CarFenceReq;
import com.muyu.domain.resp.CarFenceResq;
import com.muyu.enterpise.service.CarFenceService;
import com.muyu.enterpise.service.CarFenceServiceMybaits;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 从围栏信息表中查询数据
 *  * @Author：yang
 *  * @Package：com.muyu.server.controller
 *  * @Project：cloud-electronic
 *  * @name：CarFenceController
 *  * @Date：2024/9/17 16:46
 *  * @Description：从围栏信息表中查询数据
 */
@RequestMapping("/carFence")
@RestController
@AllArgsConstructor
@Tag(name = "从围栏信息表中查询数据",description = "从围栏信息表中查询数据")
@Log4j2
public class CarFenceController {

    private final CarFenceService carFenceService;
    private final CarFenceServiceMybaits carFenceServiceMybaits;

    /**
     * 查询围栏信息
     */
    @PostMapping("/selectConnect")
    @Operation(summary = "查询数据",description = "查询数据")
    public Result<Page<CarFenceResq>> selectConnect(
            @Validated @RequestBody CarFenceReq req){
        Page<CarFenceResq> connects = carFenceService.selectCarFence(req);

        return Result.success(
                connects, "操作成功"
        );
    }

    /**
     * add围栏
     */
    @PostMapping("/addCarFence")
    @Operation(summary = "查询数据",description = "查询数据")
    public Result addCarFence(@RequestBody CarFence carFence){
        carFenceService.save(carFence);


        return Result.success("成功");
    }






}
