瀏覽代碼

Merge remote-tracking branch 'origin/V1' into V1

zhengqiang 5 年之前
父節點
當前提交
70251d0517
共有 1 個文件被更改,包括 49 次插入13 次删除
  1. 49 13
      common/src/main/resources/mapper/base/PersonDeviceLog.xml

+ 49 - 13
common/src/main/resources/mapper/base/PersonDeviceLog.xml

@@ -301,28 +301,64 @@
         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_
+        select * from base_person_device_log
+        where rownum_ in (
+            SELECT max(m.rownum_)
+            from base_person_device_log m inner join base_person_info n ON m.person_id = n.id_
             where m.record_time>=#{startTime}
-            and m.record_time <= #{endTime}
+            and m.record_time <=#{endTime}
             and 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
+        <foreach collection="list" index="index" item="item" open=" and n.company_id in (" separator="," close=")">
+            #{item.id}
+        </foreach>
         <![CDATA[
-        where person_id<>0 and temperature_>0  GROUP BY a.person_id ORDER BY record_time desc
+            and m.temperature_>0 GROUP BY m.person_id
+        )
         ]]>
+        order by record_time desc
+<!--       &lt;!&ndash; <![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 m.record_time>=#{startTime}-->
+<!--            and m.record_time <= #{endTime}-->
+<!--            and 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-->
+<!--        ]]>&ndash;&gt;-->
     </select>
 
     <select id="findLastStudentLogByCompanyList" resultMap="PersonDeviceLogMap">
         <![CDATA[
+        select * from base_person_device_log
+        where rownum_ in (
+            SELECT max(m.rownum_)
+            from base_person_device_log m inner join base_person_info n ON m.person_id = n.id_
+            where m.record_time>=#{startTime}
+            and m.record_time <=#{endTime}
+            and popedom_ = '1'
+        ]]>
+        <foreach collection="list" index="index" item="item" open=" and n.company_id in (" separator="," close=")">
+            #{item.id}
+        </foreach>
+        <![CDATA[
+            and m.temperature_>0 GROUP BY m.person_id
+        )
+        ]]>
+        order by record_time desc
+
+        <!--<![CDATA[
         SELECT * from
         (
             SELECT m.*,n.company_id as company_id,n.popedom_ as popedom_
@@ -337,7 +373,7 @@
         <![CDATA[
         ) a
         where person_id <> 0 and temperature_>0  GROUP BY a.person_id ORDER BY record_time desc
-        ]]>
+        ]]>-->
     </select>
     <select id="getDayCheckedPersonNumByCompanyList" resultType="Integer">
         select count(*) from base_person_device_log a left join base_person_info b