Преглед на файлове

fix首页设备运行数及总数

LLL преди 1 година
родител
ревизия
06c6f2f8f2

+ 8 - 2
module_tpm/src/main/java/org/jeecg/modules/Statistics/controller/StatisticsController.java

@@ -11,6 +11,7 @@ import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.modules.Statistics.entity.Statistics;
 import org.jeecg.modules.Statistics.service.IStatisticsService;
+import org.jeecg.modules.Statistics.vo.MachineSum;
 import org.jeecg.modules.Statistics.vo.StatisticsVo;
 import org.jeecg.modules.equipmentOnoffSection.entity.EquipmentOnoffSection;
 import org.jeecg.modules.tpmTag.entity.TpmTag;
@@ -46,11 +47,16 @@ public class StatisticsController extends JeecgController<Statistics, IStatistic
      */
     @ApiOperation("今日开机数")
     @GetMapping("/machineSum")
-    public Result<List<StatisticsVo>> firstLoad()
+    public Result<MachineSum> firstLoad()
     {
+        MachineSum machineSum = new MachineSum();
         // 今日开机数
         List<StatisticsVo> list = statisticsService.selectEquipmentStatus();
-        return Result.OK(list);
+        for (StatisticsVo vo : list){
+            if(vo.getType().equals("run")) machineSum.setRunSum(vo.getHowManyTimes());
+            else if(vo.getType().equals("all")) machineSum.setAllSum(vo.getHowManyTimes());
+        }
+        return Result.OK(machineSum);
     }
 
     /**

+ 0 - 12
module_tpm/src/main/java/org/jeecg/modules/Statistics/mapper/xml/StatisticsMapper.xml

@@ -35,22 +35,10 @@
 
     <!--分类查询设备状态-->
     <select id="selectEquipmentStatus" resultMap="TpmStatisticsResult">
-        select 'normal' as type, count(*) as howManyTimes
-        from tpm_equipment_status
-        where status in ('0')
-        union
         select 'run' as type, count(*) as howManyTimes
         from tpm_equipment_status
         where status in ('1')
         union
-        select 'standby' as type, count(*) as howManyTimes
-        from tpm_equipment_status
-        where status in ('2')
-        union
-        select 'stop' as type, count(*) as howManyTimes
-        from tpm_equipment_status
-        where status in ('3')
-        union
         select 'all' as type, count(*) as howManyTimes
         from tpm_equipment_status
     </select>

+ 14 - 0
module_tpm/src/main/java/org/jeecg/modules/Statistics/vo/MachineSum.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.Statistics.vo;
+
+
+import lombok.Data;
+
+@Data
+public class MachineSum {
+
+    /** 运行中设备数量 */
+    private Long runSum;
+    /** 设备总数 */
+    private Long allSum;
+
+}