|
@@ -0,0 +1,94 @@
|
|
|
|
+package cn.iocoder.yudao.module.pms.controller.admin.inspect.order;
|
|
|
|
+
|
|
|
|
+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.inspect.order.vo.IotInspectOrderDetailPageReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.inspect.order.vo.IotInspectOrderDetailRespVO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.inspect.order.vo.IotInspectOrderDetailSaveReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.inspect.IotInspectOrderDetailDO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderDetailService;
|
|
|
|
+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 = "管理后台 - 巡检工单巡检明细")
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/rq/iot-inspect-order-detail")
|
|
|
|
+@Validated
|
|
|
|
+public class IotInspectOrderDetailController {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private IotInspectOrderDetailService iotInspectOrderDetailService;
|
|
|
|
+
|
|
|
|
+ @PostMapping("/create")
|
|
|
|
+ @Operation(summary = "创建巡检工单巡检明细")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-inspect-order-detail:create')")
|
|
|
|
+ public CommonResult<Long> createIotInspectOrderDetail(@Valid @RequestBody IotInspectOrderDetailSaveReqVO createReqVO) {
|
|
|
|
+ return success(iotInspectOrderDetailService.createIotInspectOrderDetail(createReqVO));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PutMapping("/update")
|
|
|
|
+ @Operation(summary = "更新巡检工单巡检明细")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-inspect-order-detail:update')")
|
|
|
|
+ public CommonResult<Boolean> updateIotInspectOrderDetail(@Valid @RequestBody IotInspectOrderDetailSaveReqVO updateReqVO) {
|
|
|
|
+ iotInspectOrderDetailService.updateIotInspectOrderDetail(updateReqVO);
|
|
|
|
+ return success(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @DeleteMapping("/delete")
|
|
|
|
+ @Operation(summary = "删除巡检工单巡检明细")
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-inspect-order-detail:delete')")
|
|
|
|
+ public CommonResult<Boolean> deleteIotInspectOrderDetail(@RequestParam("id") Long id) {
|
|
|
|
+ iotInspectOrderDetailService.deleteIotInspectOrderDetail(id);
|
|
|
|
+ return success(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
+ @Operation(summary = "获得巡检工单巡检明细")
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-inspect-order-detail:query')")
|
|
|
|
+ public CommonResult<IotInspectOrderDetailRespVO> getIotInspectOrderDetail(@RequestParam("id") Long id) {
|
|
|
|
+ IotInspectOrderDetailDO iotInspectOrderDetail = iotInspectOrderDetailService.getIotInspectOrderDetail(id);
|
|
|
|
+ return success(BeanUtils.toBean(iotInspectOrderDetail, IotInspectOrderDetailRespVO.class));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/page")
|
|
|
|
+ @Operation(summary = "获得巡检工单巡检明细分页")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-inspect-order-detail:query')")
|
|
|
|
+ public CommonResult<PageResult<IotInspectOrderDetailRespVO>> getIotInspectOrderDetailPage(@Valid IotInspectOrderDetailPageReqVO pageReqVO) {
|
|
|
|
+ PageResult<IotInspectOrderDetailDO> pageResult = iotInspectOrderDetailService.getIotInspectOrderDetailPage(pageReqVO);
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, IotInspectOrderDetailRespVO.class));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/export-excel")
|
|
|
|
+ @Operation(summary = "导出巡检工单巡检明细 Excel")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('rq:iot-inspect-order-detail:export')")
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
+ public void exportIotInspectOrderDetailExcel(@Valid IotInspectOrderDetailPageReqVO pageReqVO,
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
+ List<IotInspectOrderDetailDO> list = iotInspectOrderDetailService.getIotInspectOrderDetailPage(pageReqVO).getList();
|
|
|
|
+ // 导出 Excel
|
|
|
|
+ ExcelUtils.write(response, "巡检工单巡检明细.xls", "数据", IotInspectOrderDetailRespVO.class,
|
|
|
|
+ BeanUtils.toBean(list, IotInspectOrderDetailRespVO.class));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|