|
@@ -0,0 +1,93 @@
|
|
|
+package cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplateattrs;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplateattrs.vo.IotDeviceTemplateAttrsPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplateattrs.vo.IotDeviceTemplateAttrsRespVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotdevicetemplateattrs.vo.IotDeviceTemplateAttrsSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicetemplateattrs.IotDeviceTemplateAttrsDO;
|
|
|
+import cn.iocoder.yudao.module.pms.service.iotdevicetemplateattrs.IotDeviceTemplateAttrsService;
|
|
|
+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.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - PMS 功能优化 设备模板属性")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/rq/iot-device-template-attrs")
|
|
|
+@Validated
|
|
|
+public class IotDeviceTemplateAttrsController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IotDeviceTemplateAttrsService iotDeviceTemplateAttrsService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建PMS 功能优化 设备模板属性")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-device-template-attrs:create')")
|
|
|
+ public CommonResult<Long> createIotDeviceTemplateAttrs(@Valid @RequestBody IotDeviceTemplateAttrsSaveReqVO createReqVO) {
|
|
|
+ return success(iotDeviceTemplateAttrsService.createIotDeviceTemplateAttrs(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新PMS 功能优化 设备模板属性")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-device-template-attrs:update')")
|
|
|
+ public CommonResult<Boolean> updateIotDeviceTemplateAttrs(@Valid @RequestBody IotDeviceTemplateAttrsSaveReqVO updateReqVO) {
|
|
|
+ iotDeviceTemplateAttrsService.updateIotDeviceTemplateAttrs(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除PMS 功能优化 设备模板属性")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-device-template-attrs:delete')")
|
|
|
+ public CommonResult<Boolean> deleteIotDeviceTemplateAttrs(@RequestParam("id") Long id) {
|
|
|
+ iotDeviceTemplateAttrsService.deleteIotDeviceTemplateAttrs(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得PMS 功能优化 设备模板属性")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-device-template-attrs:query')")
|
|
|
+ public CommonResult<IotDeviceTemplateAttrsRespVO> getIotDeviceTemplateAttrs(@RequestParam("id") Long id) {
|
|
|
+ IotDeviceTemplateAttrsDO iotDeviceTemplateAttrs = iotDeviceTemplateAttrsService.getIotDeviceTemplateAttrs(id);
|
|
|
+ return success(BeanUtils.toBean(iotDeviceTemplateAttrs, IotDeviceTemplateAttrsRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得PMS 功能优化 设备模板属性分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-device-template-attrs:query')")
|
|
|
+ public CommonResult<PageResult<IotDeviceTemplateAttrsRespVO>> getIotDeviceTemplateAttrsPage(@Valid IotDeviceTemplateAttrsPageReqVO pageReqVO) {
|
|
|
+ PageResult<IotDeviceTemplateAttrsDO> pageResult = iotDeviceTemplateAttrsService.getIotDeviceTemplateAttrsPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, IotDeviceTemplateAttrsRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出PMS 功能优化 设备模板属性 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-device-template-attrs:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportIotDeviceTemplateAttrsExcel(@Valid IotDeviceTemplateAttrsPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<IotDeviceTemplateAttrsDO> list = iotDeviceTemplateAttrsService.getIotDeviceTemplateAttrsPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "PMS 功能优化 设备模板属性.xls", "数据", IotDeviceTemplateAttrsRespVO.class,
|
|
|
+ BeanUtils.toBean(list, IotDeviceTemplateAttrsRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|