Przeglądaj źródła

首页右下角温湿度

LLL 1 rok temu
rodzic
commit
60434e2613

+ 39 - 0
module_tpm/src/main/java/org/jeecg/modules/hsmsStatistics/controller/HsmsStatisticsController.java

@@ -0,0 +1,39 @@
+package org.jeecg.modules.hsmsStatistics.controller;
+
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.Statistics.vo.StatisticsVo;
+import org.jeecg.modules.hsmsStatistics.service.IHsmsStatisticsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 环境监测数据统计汇总Controller
+ *
+ * @author ruoyi
+ * @date 2023-06-05
+ */
+@Api(tags = "环境安全 - 环境监测数据统计汇总")
+@RestController
+@RequestMapping("/hsms/statistics")
+public class HsmsStatisticsController {
+    @Autowired
+    private IHsmsStatisticsService hsmsStatisticsService;
+
+
+    /**
+     * 查询环境信息(仪表盘使用,按设备汇总)
+     */
+    @ApiOperation("查询环境监测数据")
+    @GetMapping("/envirinfo")
+    public Result<List<StatisticsVo>> envirInfo(Long spaceId)
+    {
+        return Result.ok(hsmsStatisticsService.selectEnvirInfo());
+    }
+}

+ 14 - 0
module_tpm/src/main/java/org/jeecg/modules/hsmsStatistics/mapper/HsmsStatisticsMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.hsmsStatistics.mapper;
+
+import org.jeecg.modules.Statistics.vo.StatisticsVo;
+
+import java.util.List;
+
+public interface HsmsStatisticsMapper {
+    /**
+     * 查询环境信息(仪表盘使用,按设备汇总)
+     *
+     * @return 环境信息汇总
+     */
+    public List<StatisticsVo> selectEnvirInfo();
+}

+ 29 - 0
module_tpm/src/main/java/org/jeecg/modules/hsmsStatistics/mapper/xml/HsmsStatisticsMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.hsmsStatistics.mapper.HsmsStatisticsMapper">
+
+    <resultMap type="org.jeecg.modules.Statistics.vo.StatisticsVo" id="HsmsStatisticsResult">
+        <result property="equipmentid"    column="equipmentid"    />
+        <result property="equipmentname"    column="equipmentname"    />
+        <result property="year"    column="year"    />
+        <result property="month"    column="month"    />
+        <result property="week"    column="week"    />
+        <result property="day"    column="day"    />
+        <result property="dayofweek"    column="dayofweek"    />
+        <result property="howManyTimes"    column="howManyTimes"    />
+        <result property="howManyTimes2"    column="howManyTimes2"    />
+        <result property="type"    column="type"    />
+    </resultMap>
+
+    <!--查询环境信息(仪表盘使用,按设备汇总)-->
+    <select id="selectEnvirInfo" resultMap="HsmsStatisticsResult">
+        select t.id,t.equipmentname,
+            (select tagvalue from tpm_tag where equipmentid=t.id and tagtype in ('0') order by id desc limit 1) as howManyTimes, <!--温度-->
+            (select tagvalue from tpm_tag where equipmentid=t.id and tagtype in ('1') order by id desc limit 1) as howManyTimes2 <!--湿度-->
+        from tpm_equipment as t
+        where t.id in (
+            select equipmentid from tpm_tag where tagtype in ('0','1')
+        )
+    </select>
+
+</mapper>

+ 15 - 0
module_tpm/src/main/java/org/jeecg/modules/hsmsStatistics/service/IHsmsStatisticsService.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.hsmsStatistics.service;
+
+
+import org.jeecg.modules.Statistics.vo.StatisticsVo;
+
+import java.util.List;
+
+public interface IHsmsStatisticsService {
+    /**
+     * 查询环境信息(仪表盘使用,按设备汇总)
+     *
+     * @return 环境信息汇总
+     */
+    public List<StatisticsVo> selectEnvirInfo();
+}

+ 25 - 0
module_tpm/src/main/java/org/jeecg/modules/hsmsStatistics/service/impl/HsmsStatisticsServiceImpl.java

@@ -0,0 +1,25 @@
+package org.jeecg.modules.hsmsStatistics.service.impl;
+
+import org.jeecg.modules.Statistics.vo.StatisticsVo;
+import org.jeecg.modules.hsmsStatistics.mapper.HsmsStatisticsMapper;
+import org.jeecg.modules.hsmsStatistics.service.IHsmsStatisticsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class HsmsStatisticsServiceImpl implements IHsmsStatisticsService {
+    @Autowired
+    private HsmsStatisticsMapper statisticsMapper;
+
+    /**
+     * 查询环境信息(仪表盘使用,按设备汇总)
+     *
+     * @return 环境信息汇总
+     */
+    @Override
+    public List<StatisticsVo> selectEnvirInfo() {
+        return statisticsMapper.selectEnvirInfo();
+    }
+}