package com.iailab.module.data.video.controller.admin.camera; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.module.data.video.controller.admin.camera.vo.CameraPageReqVO; import com.iailab.module.data.video.dto.CameraDTO; import com.iailab.module.data.video.service.CameraService; 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.security.access.prepost.PreAuthorize; 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 Houzhongjian * @Description * @createTime 2024年11月01日 */ @RestController @RequestMapping("/data/video/camera") @Tag(name = "摄像头管理") public class CameraController { @Autowired private CameraService cameraService; @GetMapping("page") @Operation(summary = "分页") @PreAuthorize("@ss.hasPermission('video:camera:query')") public CommonResult> page(@Valid CameraPageReqVO cameraPageReqVO) { return success(cameraService.getPage(cameraPageReqVO)); } @GetMapping("list") @PreAuthorize("@ss.hasPermission('video:camera:query')") public CommonResult> list(@Valid CameraPageReqVO cameraPageReqVO) { List list = cameraService.list(cameraPageReqVO); return success(list); } @GetMapping("/get") @Operation(summary = "信息") @PreAuthorize("@ss.hasPermission('video:camera:query')") @Parameter(name = "id", description = "编号", required = true, example = "1024") public CommonResult get(@RequestParam("id") String id) { CameraDTO data = cameraService.get(id); return success(data); } @PostMapping("/create") @Operation(summary = "保存") @PreAuthorize("@ss.hasPermission('video:camera:save')") public CommonResult save(@RequestBody CameraDTO dto) { if (cameraService.cheack(dto) > 0) { return error(405,"内容重复!"); } cameraService.save(dto); return success(); } @PutMapping("/update") @Operation(summary = "修改") @PreAuthorize("@ss.hasPermission('video:camera:update')") public CommonResult update(@RequestBody CameraDTO dto) { if (cameraService.cheack(dto) > 0) { return error(405,"内容重复!"); } cameraService.update(dto); return success(); } @DeleteMapping("/delete") @Operation(summary = "删除") @PreAuthorize("@ss.hasPermission('video:camera:delete')") public CommonResult delete(@RequestParam("id") String id) { cameraService.delete(id); return success(); } // @PostMapping("/DHCaptureCallback") // @Operation(summary = "大华摄像头截图成功后回调存储处理图片") // @PermitAll // public CommonResult DHCaptureCallback(@RequestBody Map params) { // cameraService.dealCapture(params); // return success(); // } }