package com.muyu.controller;

import com.muyu.common.core.domain.Result;
import com.muyu.domain.FenceGroup;
import com.muyu.enterpise.service.CarAndFenceGroupMiddleService;
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.*;

import java.util.List;

/**
 * 车辆和围栏组中间表
 * @Author：yan
 * @Package：com.muyu.controller
 * @Project：plues
 * @name：CarAndFenceGroupMiddleController
 * @Date：2024/9/29 20:09
 */
@RequestMapping("/carandfencemiddle")
@RestController
@AllArgsConstructor
@Log4j2
@Tag(name = "车辆和围栏组中间表")
public class CarAndFenceGroupMiddleController {
    @Autowired
    private CarAndFenceGroupMiddleService carAndFenceGroupMiddleService;

    /**
     * 根据围栏组和车辆的id添加中间表
     */
    @PostMapping("/addFenceGroupAddCarMiddle")
    @Operation(summary = "根据围栏组和车辆的id添加中间表",description = "根据围栏组和车辆的id添加中间表")
    public Result addFenceGroupAddCarMiddle(@RequestParam("carId") Integer carId , @RequestBody List<FenceGroup> fenceGroups ){
        boolean b = carAndFenceGroupMiddleService.saveBatch(fenceGroups,carId);
        return Result.success("成功");
    }

}
