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