From bdfce3674b99e3bb494f1a8a479834f842968ef2 Mon Sep 17 00:00:00 2001
From: bsw215583320 <baoshiwei121@163.com>
Date: 星期五, 22 十一月 2024 11:11:57 +0800
Subject: [PATCH] feat(dry): 添加租户设备查询功能并优化代码

---
 jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java |   45 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 32 insertions(+), 13 deletions(-)

diff --git a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java
index 550479b..0bf2aac 100644
--- a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java
+++ b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java
@@ -36,6 +36,7 @@
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
 import org.jeecg.common.system.base.controller.JeecgController;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -106,21 +107,39 @@
 		//------------------------------------------------------------------------------------------------
 		QueryWrapper<DryEquipment> queryWrapper = QueryGenerator.initQueryWrapper(dryEquipment, req.getParameterMap());
 
-		queryWrapper.orderByAsc("code");
-		List<DryEquipment> eqps = dryEquipmentService.list(queryWrapper);
-		List<DryEquipmentVo> equipmentVos = new ArrayList<>();
-		eqps.stream().forEach(item -> {
-			DryEquipmentVo dryEquipmentVo = BeanUtil.toBean(item, DryEquipmentVo.class);
-			DryEqpType dryEqpType = dryEqpTypeService.getById(item.getType());
-			dryEquipmentVo.setType(dryEqpType.getName());
-			dryEquipmentVo.setDryEfficiency(dryEqpType.getDryEfficiency());
-			dryEquipmentVo.setSteamConsumption(dryEqpType.getSteamConsumption());
-			dryEquipmentVo.setPowerConsumption(dryEqpType.getPowerConsumption());
-			equipmentVos.add(dryEquipmentVo);
-		});
-		return Result.OK(equipmentVos);
+		 List<DryEquipmentVo> equipmentVos = getDryEquipmentVos(queryWrapper);
+		 return Result.OK(equipmentVos);
 	}
 
+	 @NotNull
+	 private List<DryEquipmentVo> getDryEquipmentVos(QueryWrapper<DryEquipment> queryWrapper) {
+		 queryWrapper.orderByAsc("code");
+		 List<DryEquipment> eqps = dryEquipmentService.list(queryWrapper);
+		 List<DryEquipmentVo> equipmentVos = new ArrayList<>();
+		 eqps.stream().forEach(item -> {
+			 DryEquipmentVo dryEquipmentVo = BeanUtil.toBean(item, DryEquipmentVo.class);
+			 DryEqpType dryEqpType = dryEqpTypeService.getById(item.getType());
+			 dryEquipmentVo.setType(dryEqpType.getName());
+			 dryEquipmentVo.setDryEfficiency(dryEqpType.getDryEfficiency());
+			 dryEquipmentVo.setSteamConsumption(dryEqpType.getSteamConsumption());
+			 dryEquipmentVo.setPowerConsumption(dryEqpType.getPowerConsumption());
+			 equipmentVos.add(dryEquipmentVo);
+		 });
+		 return equipmentVos;
+	 }
+
+
+	 @ApiOperation(value="鏌ヨ绉熸埛鎵�鏈夊共鐕ユ満", notes="鏌ヨ绉熸埛鎵�鏈夊共鐕ユ満")
+	 @GetMapping(value = "/listTenantEqp")
+	 public Result<List<DryEquipmentVo>> queryTenantAllEquipment(DryEquipment dryEquipment, HttpServletRequest req) {
+		TenantContext.setTenant(dryEquipment.getTenantId()+"");
+
+		 QueryWrapper<DryEquipment> queryWrapper = QueryGenerator.initQueryWrapper(dryEquipment, req.getParameterMap());
+
+		 List<DryEquipmentVo> equipmentVos = getDryEquipmentVos(queryWrapper);
+		 return Result.OK(equipmentVos);
+	 }
+
 
 
 

--
Gitblit v1.9.3