Переглянути джерело

不显示温度为零的记录。

tomatozq 5 роки тому
батько
коміт
352bfe686d

+ 58 - 46
common/src/main/resources/mapper/base/PersonDeviceLog.xml

@@ -199,71 +199,83 @@
             limit 1
         ]]>
     </select>
-
     <select id="getDayCheckedVistorNumByDeviceNoList" resultType="Integer">
-        select count(*) from base_person_device_log where person_id = 0
-        and record_time >=#{startTime}
-        and record_time &lt;= #{endTime}
-
-        <foreach collection="list" index="index" item="item" open="and device_no in(" separator="," close=")">   #{item}
+        <![CDATA[
+            select count(*) from base_person_device_log where person_id = 0
+            and record_time >=#{startTime}
+            and record_time <= #{endTime}
+        ]]>
+        <foreach collection="list" index="index" item="item" open="and device_no in(" separator="," close=")">
+            #{item}
         </foreach>
     </select>
-
     <select id="findLastPersonLogByCompanyList" resultMap="PersonDeviceLogMap">
-
+        <![CDATA[
         SELECT * from
-        (SELECT m.*,n.company_id as company_id
-        from base_person_device_log m LEFT JOIN base_person_info n
-        ON m.person_id = n.id_
-        where record_time>=#{startTime}
-        and record_time &lt;= #{endTime}
-        and company_id in
-        <foreach collection="list" index="index" item="item" open="(" separator="," close=")">   #{item.id}
+        (
+            SELECT m.*,n.company_id as company_id
+            from base_person_device_log m LEFT JOIN base_person_info n
+            ON m.person_id = n.id_
+            where m.record_time>=#{startTime}
+            and m.record_time <=#{endTime}
+        ]]>
+        <foreach collection="list" index="index" item="item" open=" and company_id in (" separator="," close=")">
+            #{item.id}
         </foreach>
-        ORDER BY record_time DESC) a
-        where person_id != 0  GROUP BY a.person_id ORDER BY record_time desc
-
-
+        <![CDATA[
+        ) a
+        where person_id <> 0 and temperature_>0   GROUP BY a.person_id ORDER BY record_time desc
+        ]]>
     </select>
-
     <select id="findVisitorLogByDeviceNoList" resultMap="PersonDeviceLogMap">
-        select * from base_person_device_log
-        where person_id = 0
-        and record_time>=#{startTime}
-        and record_time &lt;= #{endTime}
-
+        <![CDATA[
+            select * from base_person_device_log
+            where person_id = 0
+            and record_time >= #{startTime}
+            and record_time <= #{endTime}
+            and temperature_>0
+        ]]>
         <foreach collection="list" index="index" item="item" open="and device_no in(" separator="," close=")">   #{item}
         </foreach>
         ORDER BY record_time DESC
     </select>
-
     <select id="findLastTeacherLogByCompanyList" resultMap="PersonDeviceLogMap">
+        <![CDATA[
         SELECT * from
-        (SELECT m.*,n.company_id as company_id,n.popedom_ as popedom_
-        from base_person_device_log m LEFT JOIN base_person_info n
-        ON m.person_id = n.id_
-        where record_time>=#{startTime}
-        and record_time &lt;= #{endTime}
-        and popedom_ like '%2%'
-
-        <foreach collection="list" index="index" item="item" open="and company_id in(" separator="," close=")">   #{item.id}
-        </foreach>
-        ORDER BY record_time DESC) a
-        where person_id != 0  GROUP BY a.person_id ORDER BY record_time desc
+        (
+            SELECT m.*,n.company_id as company_id,n.popedom_ as popedom_
+            from base_person_device_log m LEFT JOIN base_person_info n
+            ON m.person_id = n.id_
+            where m.record_time>=#{startTime}
+            and m.record_time &lt;= #{endTime}
+            and m.popedom_ like '%2%'
+            and m.temperature_>0
+        ]]>
+            <foreach collection="list" index="index" item="item" open="and company_id in(" separator="," close=")">
+                #{item.id}
+            </foreach>
+        ) a
+        <![CDATA[
+        where person_id<>0 and temperature_>0  GROUP BY a.person_id ORDER BY record_time desc
+        ]]>
     </select>
 
     <select id="findLastStudentLogByCompanyList" resultMap="PersonDeviceLogMap">
+        <![CDATA[
         SELECT * from
-        (SELECT m.*,n.company_id as company_id,n.popedom_ as popedom_
-        from base_person_device_log m LEFT JOIN base_person_info n
-        ON m.person_id = n.id_
-        where record_time>=#{startTime}
-        and record_time &lt;= #{endTime}
-        and popedom_ = '1'
-
+        (
+            SELECT m.*,n.company_id as company_id,n.popedom_ as popedom_
+            from base_person_device_log m LEFT JOIN base_person_info n
+            ON m.person_id = n.id_
+            where record_time>=#{startTime}
+            and record_time &lt;= #{endTime}
+            and popedom_ = '1'
+        ]]>
         <foreach collection="list" index="index" item="item" open="and company_id in(" separator="," close=")">   #{item.id}
         </foreach>
-        ORDER BY record_time DESC) a
-        where person_id != 0  GROUP BY a.person_id ORDER BY record_time desc
+        <![CDATA[
+        ) a
+        where person_id <> 0 and temperature_>0  GROUP BY a.person_id ORDER BY record_time desc
+        ]]>
     </select>
 </mapper>

+ 3 - 5
web/src/main/java/com/jpsoft/smart/modules/mobile/controller/HealthShowApiController.java

@@ -204,9 +204,8 @@ public class HealthShowApiController {
             }
 
             if (list.size() > 0) {
-
-
                 List<String> deviceNoList = new ArrayList<>();
+
                 for (CompanyInfo companyInfo1 : list) {
                     List<DeviceInfo> deviceInfoList = companyDeviceRelationService.findDeviceByCompanyId(companyInfo1.getId());
                     for (DeviceInfo deviceInfo : deviceInfoList) {
@@ -215,7 +214,9 @@ public class HealthShowApiController {
                         }
                     }
                 }
+
                 Page<PersonDeviceLog> personDeviceLogList = new Page<>();
+
                 if ("all".equals(type)) {
                     personDeviceLogList = personDeviceLogService.findAllPersonLogByCompanyListAndDeviceNoList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), list, pageIndex, pageSize);
                 } else if ("person".equals(type)) {
@@ -224,11 +225,8 @@ public class HealthShowApiController {
                     if (deviceNoList.size()>0){
                         personDeviceLogList = personDeviceLogService.findVisitorLogByDeviceNoList(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), deviceNoList, pageIndex, pageSize);
                     }
-
-
                 }
 
-
                 msgResult.setData(PojoUtils.pageWrapper(personDeviceLogList));
 
             } else {