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-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java | 4 ++++ jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryEquipmentController.java | 45 ++++++++++++++++++++++++++++++++------------- jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryRealTimeDataController.java | 8 ++++++++ 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java b/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java index 6ed3ba1..0270a2e 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java @@ -75,6 +75,10 @@ TENANT_TABLE.add("dry_herb_type"); TENANT_TABLE.add("dry_order"); TENANT_TABLE.add("dry_shop"); + TENANT_TABLE.add("dry_herb_formula"); + TENANT_TABLE.add("dry_herb_formula_his"); + TENANT_TABLE.add("dry_fault_record"); + } 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); + } + diff --git a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryRealTimeDataController.java b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryRealTimeDataController.java index 09ee499..dbc488d 100644 --- a/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryRealTimeDataController.java +++ b/jeecg-module-dry/jeecg-module-dry-biz/src/main/java/org/jeecg/modules/dry/controller/DryRealTimeDataController.java @@ -178,6 +178,14 @@ // return Result.error("AI璇嗗埆鏈嶅姟寮傚父"); // } // } + + /** + * 鏍规嵁璁惧鍜岀鎴锋煡璇㈣璁惧绫诲瀷鐨勫共鐕ラ厤鏂癸紝灏嗛厤鏂硅浆鎴恱ml鏍煎紡锛屼互瀛楃涓叉柟寮忚繑鍥� + * @param tenantId + * @param eqpCode + * @return + * @throws JAXBException + */ @ApiOperation(value="骞茬嚗閰嶆柟鑾峰彇", notes="骞茬嚗閰嶆柟涓嬪彂") @GetMapping(value = "/queryFormula") public Result<String> queryFormulaByEqpType(Integer tenantId, String eqpCode) throws JAXBException { -- Gitblit v1.9.3