103 lines
3.4 KiB
Java
103 lines
3.4 KiB
Java
package com.muyu.controller;
|
||
|
||
import com.muyu.domain.FenceGroup;
|
||
import com.muyu.domain.req.CarFenceAdd;
|
||
import com.muyu.service.CarFenceServiceMybaits;
|
||
import com.muyu.service.MiddleService;
|
||
import com.muyu.common.core.domain.Result;
|
||
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.car.controller
|
||
* * @Project:plues
|
||
* * @name:MiddleController
|
||
* * @Date:2024/9/22 10:06
|
||
*/
|
||
@RequestMapping("/middle")
|
||
@RestController
|
||
@AllArgsConstructor
|
||
@Tag(name = "中间表添加",description = "添加")
|
||
@Log4j2
|
||
public class MiddleController {
|
||
@Autowired
|
||
private MiddleService middleService;
|
||
@Autowired
|
||
private CarFenceServiceMybaits carFenceServiceMybaits;
|
||
|
||
|
||
|
||
/**
|
||
* 添加围栏组 多对多
|
||
*/
|
||
@PostMapping("/addCarFence")
|
||
@Operation(summary = "添加中间",description = "添加中间")
|
||
public Result addCarFence(@RequestParam("fenceGroupId") Integer fenceGroupId, @RequestBody List<CarFenceAdd> carFences){
|
||
carFenceServiceMybaits.addFenceGroup(fenceGroupId,carFences);
|
||
System.out.println("围栏组Id"+fenceGroupId);
|
||
System.out.println("围栏Id"+carFences);
|
||
return Result.success("成功");
|
||
}
|
||
|
||
/**
|
||
* 修改围栏状态
|
||
* @param groupId
|
||
* @return
|
||
*/
|
||
@GetMapping("/updateFenceGroupById")
|
||
@Operation(summary = "修改围栏状态",description = "修改围栏状态")
|
||
public Result updateFenceGroupById(@RequestParam("groupId") Integer groupId){
|
||
|
||
return Result.success(carFenceServiceMybaits.updateFenceGroupById(groupId));
|
||
}
|
||
|
||
/**
|
||
* 启动围栏
|
||
*/
|
||
@GetMapping("/activate")
|
||
@Operation(summary = "启动围栏状态",description = "启动围栏状态")
|
||
public Result activate(@RequestParam("groupId") Integer groupId){
|
||
return Result.success(carFenceServiceMybaits.activate(groupId));
|
||
}
|
||
|
||
/**
|
||
* 根据围栏组的id查询绑定的围栏的中间表
|
||
*/
|
||
@GetMapping("/BoundFenceGroup")
|
||
@Operation(summary = "根据围栏组的id查询绑定的围栏的中间表",description = "根据围栏组的id查询绑定的围栏的中间表")
|
||
public Result BoundFenceGroup(@RequestParam("groupId") Integer groupId){
|
||
|
||
return Result.success(carFenceServiceMybaits.BoundFenceGroup(groupId));
|
||
}
|
||
|
||
/**
|
||
* 根据围栏组和车辆的id添加中间表
|
||
*/
|
||
@PostMapping("/addFenceGroupAddCarMiddle")
|
||
@Operation(summary = "根据围栏组和车辆的id添加中间表",description = "根据围栏组和车辆的id添加中间表")
|
||
public Result addFenceGroupAddCarMiddle(@RequestParam("carId") Integer carId , @RequestBody List<FenceGroup> fenceGroups ){
|
||
carFenceServiceMybaits.addFenceGroupAddCarMiddle(carId,fenceGroups);
|
||
return Result.success();
|
||
}
|
||
|
||
/**
|
||
* 获取绑定的围栏组
|
||
*/
|
||
@GetMapping("/selectBoundGFenceGroup")
|
||
@Operation(summary = "获取绑定的围栏组",description = "根据围栏组和车辆的id添加中间表")
|
||
public Result selectBoundGFenceGroup(@RequestParam("carId") Integer carId){
|
||
|
||
return Result.success(carFenceServiceMybaits.selectBoundGFenceGroup(carId));
|
||
}
|
||
|
||
|
||
}
|