|
|
@@ -0,0 +1,98 @@
|
|
|
+package cn.iocoder.yudao.module.pms.controller.admin.qhse.measure;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.measure.vo.IotMeasureDetectPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.measure.vo.IotMeasureDetectRespVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.qhse.measure.vo.IotMeasureDetectSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.measure.IotMeasureDetectDO;
|
|
|
+import cn.iocoder.yudao.module.pms.service.qhse.measure.IotMeasureDetectService;
|
|
|
+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-measure-detect")
|
|
|
+@Validated
|
|
|
+public class IotMeasureDetectController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IotMeasureDetectService iotMeasureDetectService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建计量器具-检测校准明细")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-measure-detect:create')")
|
|
|
+ public CommonResult<Long> createIotMeasureDetect(@Valid @RequestBody IotMeasureDetectSaveReqVO createReqVO) {
|
|
|
+ return success(iotMeasureDetectService.createIotMeasureDetect(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新计量器具-检测校准明细")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-measure-detect:update')")
|
|
|
+ public CommonResult<Boolean> updateIotMeasureDetect(@Valid @RequestBody IotMeasureDetectSaveReqVO updateReqVO) {
|
|
|
+ iotMeasureDetectService.updateIotMeasureDetect(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除计量器具-检测校准明细")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-measure-detect:delete')")
|
|
|
+ public CommonResult<Boolean> deleteIotMeasureDetect(@RequestParam("id") Long id) {
|
|
|
+ iotMeasureDetectService.deleteIotMeasureDetect(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得计量器具-检测校准明细")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-measure-detect:query')")
|
|
|
+ public CommonResult<IotMeasureDetectRespVO> getIotMeasureDetect(@RequestParam("id") Long id) {
|
|
|
+ IotMeasureDetectDO iotMeasureDetect = iotMeasureDetectService.getIotMeasureDetect(id);
|
|
|
+ return success(BeanUtils.toBean(iotMeasureDetect, IotMeasureDetectRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得计量器具-检测校准明细分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-measure-detect:query')")
|
|
|
+ public CommonResult<PageResult<IotMeasureDetectRespVO>> getIotMeasureDetectPage(@Valid IotMeasureDetectPageReqVO pageReqVO) {
|
|
|
+ PageResult<IotMeasureDetectDO> pageResult = iotMeasureDetectService.getIotMeasureDetectPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, IotMeasureDetectRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出计量器具-检测校准明细 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-measure-detect:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportIotMeasureDetectExcel(@Valid IotMeasureDetectPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<IotMeasureDetectDO> list = iotMeasureDetectService.getIotMeasureDetectPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "计量器具-检测校准明细.xls", "数据", IotMeasureDetectRespVO.class,
|
|
|
+ BeanUtils.toBean(list, IotMeasureDetectRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|