houzhongjian
2024-11-14 08b6a55a3a111aaee9842999b85afa60b6d61dc3
提交 | 用户 | 时间
149dd0 1 package com.iailab.module.data.video.controller.admin.camera;
H 2
3 import com.iailab.framework.common.pojo.CommonResult;
4 import com.iailab.framework.common.pojo.PageResult;
5 import com.iailab.module.data.video.controller.admin.camera.vo.CameraPageReqVO;
6 import com.iailab.module.data.video.dto.CameraDTO;
7 import com.iailab.module.data.video.service.CameraService;
8 import io.swagger.v3.oas.annotations.Operation;
9 import io.swagger.v3.oas.annotations.Parameter;
10 import io.swagger.v3.oas.annotations.tags.Tag;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.security.access.prepost.PreAuthorize;
13 import org.springframework.web.bind.annotation.*;
14
15 import javax.validation.Valid;
16 import java.util.List;
17
18 import static com.iailab.framework.common.pojo.CommonResult.error;
19 import static com.iailab.framework.common.pojo.CommonResult.success;
20
21 /**
22  * @author Houzhongjian
23  * @Description
24  * @createTime 2024年11月01日
25  */
26 @RestController
27 @RequestMapping("/data/video/camera")
28 @Tag(name = "摄像头管理")
29 public class CameraController {
30
31     @Autowired
32     private CameraService cameraService;
33
34     @GetMapping("page")
35     @Operation(summary = "分页")
36     @PreAuthorize("@ss.hasPermission('video:camera:query')")
37     public CommonResult<PageResult<CameraDTO>> page(@Valid CameraPageReqVO cameraPageReqVO) {
38         return success(cameraService.getPage(cameraPageReqVO));
39     }
40
41     @GetMapping("list")
42     @PreAuthorize("@ss.hasPermission('video:camera:query')")
43     public CommonResult<List<CameraDTO>> list(@Valid CameraPageReqVO cameraPageReqVO) {
44         List<CameraDTO> list = cameraService.list(cameraPageReqVO);
45         return success(list);
46     }
47
48     @GetMapping("/get")
49     @Operation(summary = "信息")
50     @PreAuthorize("@ss.hasPermission('video:camera:query')")
51     @Parameter(name = "id", description = "编号", required = true, example = "1024")
52     public CommonResult<CameraDTO> get(@RequestParam("id") String id) {
53         CameraDTO data = cameraService.get(id);
54         return success(data);
55     }
56
57     @PostMapping("/create")
58     @Operation(summary = "保存")
59     @PreAuthorize("@ss.hasPermission('video:camera:save')")
60     public CommonResult save(@RequestBody CameraDTO dto) {
61         if (cameraService.cheack(dto) > 0) {
62             return error(405,"内容重复!");
63         }
64         cameraService.save(dto);
65         return success();
66     }
67
68     @PutMapping("/update")
69     @Operation(summary = "修改")
70     @PreAuthorize("@ss.hasPermission('video:camera:update')")
71     public CommonResult update(@RequestBody CameraDTO dto) {
72         if (cameraService.cheack(dto) > 0) {
73             return error(405,"内容重复!");
74         }
75         cameraService.update(dto);
76         return success();
77     }
78
79     @DeleteMapping("/delete")
80     @Operation(summary = "删除")
81     @PreAuthorize("@ss.hasPermission('video:camera:delete')")
08b6a5 82     public CommonResult delete(@RequestParam("id") String id) {
H 83         cameraService.delete(id);
149dd0 84         return success();
H 85     }
86
08b6a5 87 //    @PostMapping("/DHCaptureCallback")
H 88 //    @Operation(summary = "大华摄像头截图成功后回调存储处理图片")
89 //    @PermitAll
90 //    public CommonResult DHCaptureCallback(@RequestBody Map<String, String> params) {
91 //        cameraService.dealCapture(params);
92 //        return success();
93 //    }
149dd0 94 }