|
@@ -0,0 +1,93 @@
|
|
|
+package cn.iocoder.yudao.module.pms.controller.admin.iotcommonbommaterial;
|
|
|
+
|
|
|
+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.iotcommonbommaterial.vo.IotCommonBomMaterialPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotcommonbommaterial.vo.IotCommonBomMaterialRespVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotcommonbommaterial.vo.IotCommonBomMaterialSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotcommonbommaterial.IotCommonBomMaterialDO;
|
|
|
+import cn.iocoder.yudao.module.pms.service.iotcommonbommaterial.IotCommonBomMaterialService;
|
|
|
+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 设备分类公共BOM挂载物料关联")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/pms/iot-common-bom-material")
|
|
|
+@Validated
|
|
|
+public class IotCommonBomMaterialController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private IotCommonBomMaterialService iotCommonBomMaterialService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建PMS 设备分类公共BOM挂载物料关联")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-common-bom-material:create')")
|
|
|
+ public CommonResult<Long> createIotCommonBomMaterial(@Valid @RequestBody IotCommonBomMaterialSaveReqVO createReqVO) {
|
|
|
+ return success(iotCommonBomMaterialService.createIotCommonBomMaterial(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新PMS 设备分类公共BOM挂载物料关联")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-common-bom-material:update')")
|
|
|
+ public CommonResult<Boolean> updateIotCommonBomMaterial(@Valid @RequestBody IotCommonBomMaterialSaveReqVO updateReqVO) {
|
|
|
+ iotCommonBomMaterialService.updateIotCommonBomMaterial(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除PMS 设备分类公共BOM挂载物料关联")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-common-bom-material:delete')")
|
|
|
+ public CommonResult<Boolean> deleteIotCommonBomMaterial(@RequestParam("id") Long id) {
|
|
|
+ iotCommonBomMaterialService.deleteIotCommonBomMaterial(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得PMS 设备分类公共BOM挂载物料关联")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-common-bom-material:query')")
|
|
|
+ public CommonResult<IotCommonBomMaterialRespVO> getIotCommonBomMaterial(@RequestParam("id") Long id) {
|
|
|
+ IotCommonBomMaterialDO iotCommonBomMaterial = iotCommonBomMaterialService.getIotCommonBomMaterial(id);
|
|
|
+ return success(BeanUtils.toBean(iotCommonBomMaterial, IotCommonBomMaterialRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得PMS 设备分类公共BOM挂载物料关联分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-common-bom-material:query')")
|
|
|
+ public CommonResult<PageResult<IotCommonBomMaterialRespVO>> getIotCommonBomMaterialPage(@Valid IotCommonBomMaterialPageReqVO pageReqVO) {
|
|
|
+ PageResult<IotCommonBomMaterialDO> pageResult = iotCommonBomMaterialService.getIotCommonBomMaterialPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, IotCommonBomMaterialRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出PMS 设备分类公共BOM挂载物料关联 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('pms:iot-common-bom-material:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportIotCommonBomMaterialExcel(@Valid IotCommonBomMaterialPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<IotCommonBomMaterialDO> list = iotCommonBomMaterialService.getIotCommonBomMaterialPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "PMS 设备分类公共BOM挂载物料关联.xls", "数据", IotCommonBomMaterialRespVO.class,
|
|
|
+ BeanUtils.toBean(list, IotCommonBomMaterialRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|