package com.iailab.module.data.dev.controller.admin.camera;
|
|
import com.iailab.framework.common.pojo.CommonResult;
|
import com.iailab.framework.common.pojo.PageResult;
|
import com.iailab.module.data.dev.controller.admin.camera.vo.DevCameraPageReqVO;
|
import com.iailab.module.data.dev.dto.DevCameraDTO;
|
import com.iailab.module.data.dev.service.DevCameraService;
|
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.validation.Valid;
|
import java.util.List;
|
|
import static com.iailab.framework.common.pojo.CommonResult.error;
|
import static com.iailab.framework.common.pojo.CommonResult.success;
|
|
/**
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年02月27日
|
*/
|
@RestController
|
@RequestMapping("/data/dev/camera")
|
@Tag(name = "摄像头管理")
|
public class DevCameraController {
|
|
@Autowired
|
private DevCameraService devCameraService;
|
|
@GetMapping("page")
|
@Operation(summary = "分页")
|
public CommonResult<PageResult<DevCameraDTO>> page(@Valid DevCameraPageReqVO cameraPageReqVO) {
|
return success(devCameraService.getPage(cameraPageReqVO));
|
}
|
|
@GetMapping("list")
|
public CommonResult<List<DevCameraDTO>> list(@Valid DevCameraPageReqVO cameraPageReqVO) {
|
List<DevCameraDTO> list = devCameraService.list(cameraPageReqVO);
|
return success(list);
|
}
|
|
@GetMapping("/get")
|
@Operation(summary = "信息")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
public CommonResult<DevCameraDTO> get(@RequestParam("id") String id) {
|
DevCameraDTO data = devCameraService.get(id);
|
return success(data);
|
}
|
|
@PostMapping("/create")
|
@Operation(summary = "保存")
|
public CommonResult save(@RequestBody DevCameraDTO dto) {
|
if (devCameraService.cheack(dto) > 0) {
|
return error(405,"内容重复!");
|
}
|
devCameraService.save(dto);
|
return success();
|
}
|
|
@PutMapping("/update")
|
@Operation(summary = "修改")
|
public CommonResult update(@RequestBody DevCameraDTO dto) {
|
if (devCameraService.cheack(dto) > 0) {
|
return error(405,"内容重复!");
|
}
|
devCameraService.update(dto);
|
return success();
|
}
|
|
@DeleteMapping("/delete")
|
@Operation(summary = "删除")
|
public CommonResult delete(@RequestBody String[] ids) {
|
devCameraService.delete(ids);
|
return success();
|
}
|
|
@PostMapping("/getLocation")
|
@Operation(summary = "获取摄像头监控区域")
|
public CommonResult<List<String>> getLocation() {
|
List<String> locations = devCameraService.getLocation();
|
return success(locations);
|
}
|
}
|