Ver código fonte

保管预警信息时间处理增加时区

欧阳劲驰 4 meses atrás
pai
commit
128f991a1d

+ 9 - 5
src/main/resources/mapper/PipeBurstWaringInfoMapper.xml

@@ -34,7 +34,7 @@
         concat('[', wi.center_lng, ',', wi.center_lat, ']') as center_gis,
         wi.center_address,
         wi.warn_range,
-        wi.warn_time,
+        (wi.warn_time at time zone 'utc')::timestamp as warn_time,
         wi.message,
         dwt.name as warn_type_name,
         wd.warn_id as wd_warn_id,
@@ -49,8 +49,10 @@
         <where>
             deleted = 0
             <if test="startTime != null and endTime != null">
-                and warn_time &gt;= #{startTime,jdbcType=TIMESTAMP}
-                and warn_time &lt;= #{endTime,jdbcType=TIMESTAMP}
+                and warn_time &gt;= (timezone('utc', #{startTime,jdbcType=TIMESTAMP} at time zone
+                current_setting('timezone')))
+                and warn_time &lt;= (timezone('utc', #{endTime,jdbcType=TIMESTAMP} at time zone
+                current_setting('timezone')))
             </if>
             <if test="warnType !=null">
                 and warn_type = #{warnType,jdbcType=SMALLINT}
@@ -68,8 +70,10 @@
         <where>
             deleted = 0
             <if test="startTime != null and endTime != null">
-                and warn_time &gt;= #{startTime,jdbcType=TIMESTAMP}
-                and warn_time &lt;= #{endTime,jdbcType=TIMESTAMP}
+                and warn_time &gt;= (timezone('utc', #{startTime,jdbcType=TIMESTAMP} at time zone
+                current_setting('timezone')))
+                and warn_time &lt;= (timezone('utc', #{endTime,jdbcType=TIMESTAMP} at time zone
+                current_setting('timezone')))
             </if>
             <if test="warnType !=null">
                 and warn_type = #{warnType,jdbcType=SMALLINT}