|
@@ -0,0 +1,98 @@
|
|
|
|
|
+package cn.iocoder.yudao.module.pms.controller.admin.alarm;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.alarm.vo.IotVideoAlarmPageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.alarm.vo.IotVideoAlarmRespVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.alarm.vo.IotVideoAlarmSaveReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.alarm.IotVideoAlarmDO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.service.alarm.IotVideoAlarmService;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.*;
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
|
|
+
|
|
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
|
|
+
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
|
+
|
|
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+@Tag(name = "管理后台 - 资料")
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/rq/iot-video-alarm")
|
|
|
|
|
+@Validated
|
|
|
|
|
+public class IotVideoAlarmController {
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private IotVideoAlarmService iotVideoAlarmService;
|
|
|
|
|
+
|
|
|
|
|
+ @PostMapping("/create")
|
|
|
|
|
+ @Operation(summary = "创建资料")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-video-alarm:create')")
|
|
|
|
|
+ public CommonResult<Long> createIotVideoAlarm(@Valid @RequestBody IotVideoAlarmSaveReqVO createReqVO) {
|
|
|
|
|
+ return success(iotVideoAlarmService.createIotVideoAlarm(createReqVO));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @PutMapping("/update")
|
|
|
|
|
+ @Operation(summary = "更新资料")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-video-alarm:update')")
|
|
|
|
|
+ public CommonResult<Boolean> updateIotVideoAlarm(@Valid @RequestBody IotVideoAlarmSaveReqVO updateReqVO) {
|
|
|
|
|
+ iotVideoAlarmService.updateIotVideoAlarm(updateReqVO);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @DeleteMapping("/delete")
|
|
|
|
|
+ @Operation(summary = "删除资料")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-video-alarm:delete')")
|
|
|
|
|
+ public CommonResult<Boolean> deleteIotVideoAlarm(@RequestParam("id") Long id) {
|
|
|
|
|
+ iotVideoAlarmService.deleteIotVideoAlarm(id);
|
|
|
|
|
+ return success(true);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
|
+ @Operation(summary = "获得资料")
|
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-video-alarm:query')")
|
|
|
|
|
+ public CommonResult<IotVideoAlarmRespVO> getIotVideoAlarm(@RequestParam("id") Long id) {
|
|
|
|
|
+ IotVideoAlarmDO iotVideoAlarm = iotVideoAlarmService.getIotVideoAlarm(id);
|
|
|
|
|
+ return success(BeanUtils.toBean(iotVideoAlarm, IotVideoAlarmRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/page")
|
|
|
|
|
+ @Operation(summary = "获得资料分页")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-video-alarm:query')")
|
|
|
|
|
+ public CommonResult<PageResult<IotVideoAlarmRespVO>> getIotVideoAlarmPage(@Valid IotVideoAlarmPageReqVO pageReqVO) {
|
|
|
|
|
+ PageResult<IotVideoAlarmDO> pageResult = iotVideoAlarmService.getIotVideoAlarmPage(pageReqVO);
|
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, IotVideoAlarmRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/export-excel")
|
|
|
|
|
+ @Operation(summary = "导出资料 Excel")
|
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-video-alarm:export')")
|
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
|
+ public void exportIotVideoAlarmExcel(@Valid IotVideoAlarmPageReqVO pageReqVO,
|
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ List<IotVideoAlarmDO> list = iotVideoAlarmService.getIotVideoAlarmPage(pageReqVO).getList();
|
|
|
|
|
+ // 导出 Excel
|
|
|
|
|
+ ExcelUtils.write(response, "资料.xls", "数据", IotVideoAlarmRespVO.class,
|
|
|
|
|
+ BeanUtils.toBean(list, IotVideoAlarmRespVO.class));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|