houzhongjian
2024-11-14 08b6a55a3a111aaee9842999b85afa60b6d61dc3
提交 | 用户 | 时间
149dd0 1 package com.iailab.module.data.video.controller.admin.nvr;
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.nvr.vo.NvrPageReqVO;
6 import com.iailab.module.data.video.controller.admin.nvr.vo.NvrSaveReqVO;
7 import com.iailab.module.data.video.dto.NvrDTO;
8 import com.iailab.module.data.video.service.NvrService;
9
10 import io.swagger.v3.oas.annotations.Operation;
11 import io.swagger.v3.oas.annotations.Parameter;
12 import io.swagger.v3.oas.annotations.tags.Tag;
13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.security.access.prepost.PreAuthorize;
15 import org.springframework.web.bind.annotation.*;
16
17 import javax.validation.Valid;
18
19 import java.util.UUID;
20
21 import static com.iailab.framework.common.pojo.CommonResult.success;
22
23 /**
24  * @author Houzhongjian
25  * @Description
26  * @createTime 2024年11月01日
27  */
28 @RestController
29 @RequestMapping("/data/video/nvr")
30 @Tag(name = "硬盘录像机")
31 public class NvrController {
32
33     @Autowired
34     private NvrService devCameraService;
35
36     @GetMapping("page")
37     @Operation(summary = "分页")
38     @PreAuthorize("@ss.hasPermission('video:nvr:query')")
39     public CommonResult<PageResult<NvrDTO>> page(@Valid NvrPageReqVO pageReqVO) {
40         PageResult<NvrDTO> pageResult = devCameraService.getPage(pageReqVO);
41         return success(pageResult);
42     }
43
44     @GetMapping("/get")
45     @Operation(summary = "信息")
46     @PreAuthorize("@ss.hasPermission('video:nvr:query')")
47     @Parameter(name = "id", description = "编号", required = true, example = "1024")
48     public CommonResult<NvrDTO> get(@RequestParam("id") String id) {
49         NvrDTO data = devCameraService.get(id);
50         return success(data);
51     }
52
53     @PostMapping("/create")
54     @Operation(summary = "保存")
55     @PreAuthorize("@ss.hasPermission('video:nvr:save')")
56     public CommonResult<String> save(@RequestBody NvrSaveReqVO saveReqVO) {
57         String id = UUID.randomUUID().toString();
58         saveReqVO.setId(id);
59         return success(devCameraService.save(saveReqVO));
60     }
61
62     @PutMapping("/update")
63     @Operation(summary = "修改")
64     @PreAuthorize("@ss.hasPermission('video:nvr:update')")
65     public CommonResult<String> update(@RequestBody NvrSaveReqVO saveReqVO) {
66         return success(devCameraService.update(saveReqVO));
67     }
68
69     @DeleteMapping("/delete")
70     @Operation(summary = "删除")
71     @PreAuthorize("@ss.hasPermission('video:nvr:delete')")
08b6a5 72     public CommonResult<Boolean> delete(@RequestParam("id") String id) {
149dd0 73         devCameraService.delete(id);
H 74         return success(true);
75     }
76 }