From 5d5339a1b9b6f90b113ba56fd46e548556dac255 Mon Sep 17 00:00:00 2001 From: Lius <Lius2225@163.com> Date: 星期二, 16 四月 2024 10:32:22 +0800 Subject: [PATCH] 设备监控设备状态sql优化 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcHomeMapper.java | 2 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcHomeMapper.xml | 11 +++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java | 9 +++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java | 19 +++++++++++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcHomeService.java | 5 +++++ 5 files changed, 46 insertions(+), 0 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java index 0c52d3c..73557c3 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcHomeController.java @@ -10,6 +10,7 @@ import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.mdc.constant.MdcConstant; +import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcHomeService; @@ -225,4 +226,22 @@ return Result.OK(result); } + @ApiOperation(value = "MDC棣栭〉鎺ュ彛-璁惧绾ц澶囧垪琛�", notes = "MDC棣栭〉鎺ュ彛-璁惧绾ц澶囧垪琛�") + @GetMapping("/equipmentList") + public Result<?> equipmentList(String productionCode) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + String key = ""; + if (StringUtils.isNotBlank(productionCode)) { + //鍘傚尯 + MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getProductionCode, productionCode).eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString())); + key = mdcProduction.getId(); + } else { + //宸ユ 鏌ヨ鐢ㄦ埛鎷ユ湁鐨勫伐娈垫潈闄� + key = mdcProductionService.findThreeProductionId(userId); + } + List<MdcEquipment> result = mdcHomeService.getEquipmentList(key); + return Result.OK(result); + } + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcHomeMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcHomeMapper.java index 2f87dcb..233a763 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcHomeMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcHomeMapper.java @@ -2,6 +2,7 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; import org.jeecg.modules.system.entity.MdcProduction; @@ -87,4 +88,5 @@ */ List<MdcEquipmentStatisticalInfo> getEquipmentSevenUtilizationStatistics(@Param("equipmentIdList") List<String> equipmentIdList, @Param("start") String start, @Param("end") String end); + List<MdcEquipment> getEquipmentList(@Param("productionId") String productionId); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcHomeMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcHomeMapper.xml index 6dd9f0c..b809b98 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcHomeMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcHomeMapper.xml @@ -144,4 +144,15 @@ </select> + <select id="getEquipmentList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment"> + SELECT + t1.* + FROM + mdc_equipment t1 + LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id + WHERE + t2.production_id = #{productionId} + </select> + + </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcHomeService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcHomeService.java index 236c42c..fbd6fb7 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcHomeService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcHomeService.java @@ -1,5 +1,6 @@ package org.jeecg.modules.mdc.service; +import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; import org.jeecg.modules.mdc.vo.MdcCommonVo; import org.jeecg.modules.mdc.vo.MdcHomeEfficiencyVo; @@ -58,4 +59,8 @@ */ Map<String, Object> getEquipmentAnnualEfficiencyStatistics(String equipmentId); + /** + * 鏍规嵁杞﹂棿id鑾峰彇璁惧鍒楄〃 + */ + List<MdcEquipment> getEquipmentList(String key); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java index e859470..cf2aed3 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/IMdcHomeServiceImpl.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import org.jeecg.modules.mdc.entity.EquipmentLog; +import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo; import org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency; import org.jeecg.modules.mdc.mapper.MdcHomeMapper; @@ -429,4 +430,12 @@ result.put("dataList", dataList); return result; } + + /** + * 璁惧绾ц澶囧垪琛� + */ + @Override + public List<MdcEquipment> getEquipmentList(String key) { + return mdcHomeMapper.getEquipmentList(key); + } } -- Gitblit v1.9.3