package com.muyu.enterpise.controller;

import com.muyu.common.core.domain.Result;
import com.muyu.domain.FenceGroup;
import com.muyu.enterpise.service.FenceGroupService;
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.beans.factory.annotation.Autowired;
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;

import java.util.List;

/**
 * 围栏组查询
 *  * 围栏组查询
 *  * @Author：yan
 *  * @Package：com.muyu.car.controller
 *  * @Project：cars
 *  * @name：FenceGroupController
 *  * @Date：2024/9/21 20:49
 */
@RequestMapping("/fenceGroup")
@RestController
@AllArgsConstructor
@Tag(name = "围栏组查询",description = "围栏组查询")
@Log4j2
public class FenceGroupController {
    @Autowired
    private FenceGroupService fenceGroupService;

    /**
     * 围栏组查询
     * @return
     */
    @PostMapping("/fenceGroupList")
    @Operation(summary = "查询围栏组",description = "查询数据")
    public Result fenceGroupList() {

        List<FenceGroup> list =  fenceGroupService.fenceGroupList();
        return Result.success(list);
    }

    /**
     * 添加围栏组
     * @param fenceGroup
     * @return
     */
    @PostMapping("/addFenceGroup")
    @Operation(summary = "添加围栏组", description = "添加围栏组")
    public Result addFenceGroup(@RequestBody FenceGroup fenceGroup) {

        return Result.success(fenceGroupService.save(fenceGroup));
    }



}
