package com.iailab.module.data.dev.controller.admin.nvr; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.util.object.BeanUtils; import com.iailab.module.data.dev.controller.admin.nvr.vo.DevNvrPageReqVO; import com.iailab.module.data.dev.controller.admin.nvr.vo.DevNvrSaveReqVO; import com.iailab.module.data.dev.dto.DevNvrDTO; import com.iailab.module.data.dev.service.DevNvrService; 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 PanZhibao * @Description * @createTime 2024年03月07日 */ @RestController @RequestMapping("/data/dev/nvr") @Tag(name = "硬盘录像机") public class DevNvrController { @Autowired private DevNvrService devCameraService; @GetMapping("page") @Operation(summary = "分页") @PreAuthorize("@ss.hasPermission('dev:nvr:query')") public CommonResult> page(@Valid DevNvrPageReqVO pageReqVO) { PageResult pageResult = devCameraService.getPage(pageReqVO); return success(pageResult); } @GetMapping("/get") @Operation(summary = "信息") @PreAuthorize("@ss.hasPermission('dev:nvr:query')") @Parameter(name = "id", description = "编号", required = true, example = "1024") public CommonResult get(@RequestParam("id") String id) { DevNvrDTO data = devCameraService.get(id); return success(data); } @PostMapping("/create") @Operation(summary = "保存") @PreAuthorize("@ss.hasPermission('dev:nvr:save')") public CommonResult save(@RequestBody DevNvrSaveReqVO saveReqVO) { String id = UUID.randomUUID().toString(); saveReqVO.setId(id); return success(devCameraService.save(saveReqVO)); } @PutMapping("/update") @Operation(summary = "修改") @PreAuthorize("@ss.hasPermission('dev:nvr:update')") public CommonResult update(@RequestBody DevNvrSaveReqVO saveReqVO) { return success(devCameraService.update(saveReqVO)); } @DeleteMapping("/delete") @Operation(summary = "删除") @PreAuthorize("@ss.hasPermission('dev:nvr:delete')") public CommonResult delete(@RequestParam("id") Long id) { devCameraService.delete(id); return success(true); } }