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