Forráskód Böngészése

投药报表,小时||天维度,时区问题fix

Davidliu 2 napja
szülő
commit
b87effbbae
1 módosított fájl, 8 hozzáadás és 8 törlés
  1. 8 8
      src/main/resources/mapper/TXlhtAddRecordMapper.xml

+ 8 - 8
src/main/resources/mapper/TXlhtAddRecordMapper.xml

@@ -164,8 +164,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                  FROM t_xlht_add_record
                 <where>
                 1 = 1
-                <if test="timeBegin != null  and timeBegin != ''"> and create_time &gt;= #{timeBegin}</if>
-                <if test="timeEnd != null  and timeEnd != ''"> and create_time &lt;= #{timeEnd}</if>
+                <if test="timeBegin != null  and timeBegin != ''"> and DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0) &gt;= #{timeBegin}</if>
+                <if test="timeEnd != null  and timeEnd != ''"> and DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0) &lt;= #{timeEnd}</if>
                 </where>
                  GROUP BY DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0)
              ) AS rec_hour
@@ -177,8 +177,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             FROM t_xlht_add_record_sec
             <where>
                 1 = 1
-                <if test="timeBegin != null  and timeBegin != ''"> and create_time &gt;= #{timeBegin}</if>
-                <if test="timeEnd != null  and timeEnd != ''"> and create_time &lt;= #{timeEnd}</if>
+                <if test="timeBegin != null  and timeBegin != ''"> and DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0) &gt;= #{timeBegin}</if>
+                <if test="timeEnd != null  and timeEnd != ''"> and DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0) &lt;= #{timeEnd}</if>
             </where>
             GROUP BY DATEADD(HOUR, DATEDIFF(HOUR, 0, create_time), 0)
         ) AS sec_hour
@@ -208,8 +208,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM t_xlht_add_record
         <where>
             1 = 1
-            <if test="timeBegin != null  and timeBegin != ''"> and create_time &gt;= #{timeBegin}</if>
-            <if test="timeEnd != null  and timeEnd != ''"> and create_time &lt;= #{timeEnd}</if>
+            <if test="timeBegin != null  and timeBegin != ''"> and CAST(create_time AS DATE) &gt;= #{timeBegin}</if>
+            <if test="timeEnd != null  and timeEnd != ''"> and CAST(create_time AS DATE) &lt;= #{timeEnd}</if>
         </where>
         GROUP BY CAST(create_time AS DATE)
         ) AS rec_day
@@ -221,8 +221,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM t_xlht_add_record_sec
         <where>
             1 = 1
-            <if test="timeBegin != null  and timeBegin != ''"> and create_time &gt;= #{timeBegin}</if>
-            <if test="timeEnd != null  and timeEnd != ''"> and create_time &lt;= #{timeEnd}</if>
+            <if test="timeBegin != null  and timeBegin != ''"> and CAST(create_time AS DATE) &gt;= #{timeBegin}</if>
+            <if test="timeEnd != null  and timeEnd != ''"> and CAST(create_time AS DATE) &lt;= #{timeEnd}</if>
         </where>
         GROUP BY CAST(create_time AS DATE)
         ) AS sec_day