Commit 85857115 by 杨林龙

1.21.0 开发1.21.0功能 修改激活时间 优化激活时间范围查询

1 parent 47c1a1e6
...@@ -197,7 +197,12 @@ ...@@ -197,7 +197,12 @@
and find_in_set(tv.created_by,#{checkedUserIdsStr}) and find_in_set(tv.created_by,#{checkedUserIdsStr})
</if> </if>
<if test="activateBeginDate != null and activateBeginDate != '' and activateEndDate != null and activateEndDate != ''"> <if test="activateBeginDate != null and activateBeginDate != '' and activateEndDate != null and activateEndDate != ''">
and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate} <!-- and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}-->
AND
CASE
WHEN tw.finished_time is not null THEN DATE_FORMAT(tw.finished_time,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
ELSE DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
END
</if> </if>
<if test="gpsBeginDate != null and gpsBeginDate != '' and gpsEndDate != null and gpsEndDate != ''"> <if test="gpsBeginDate != null and gpsBeginDate != '' and gpsEndDate != null and gpsEndDate != ''">
and (DATE_FORMAT(tdl.last_gps_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate} or DATE_FORMAT(tdl.last_bs_time,'%Y-%m-%d') between #{gpsBeginDate} and and (DATE_FORMAT(tdl.last_gps_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate} or DATE_FORMAT(tdl.last_bs_time,'%Y-%m-%d') between #{gpsBeginDate} and
...@@ -242,7 +247,12 @@ ...@@ -242,7 +247,12 @@
and find_in_set(tv.created_by,#{checkedUserIdsStr}) and find_in_set(tv.created_by,#{checkedUserIdsStr})
</if> </if>
<if test="activateBeginDate != null and activateBeginDate != '' and activateEndDate != null and activateEndDate != ''"> <if test="activateBeginDate != null and activateBeginDate != '' and activateEndDate != null and activateEndDate != ''">
and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate} <!-- and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}-->
AND
CASE
WHEN tw.finished_time is not null THEN DATE_FORMAT(tw.finished_time,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
ELSE DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
END
</if> </if>
<if test="gpsBeginDate != null and gpsBeginDate != '' and gpsEndDate != null and gpsEndDate != ''"> <if test="gpsBeginDate != null and gpsBeginDate != '' and gpsEndDate != null and gpsEndDate != ''">
and (DATE_FORMAT(tdl.last_gps_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate} or DATE_FORMAT(tdl.last_bs_time,'%Y-%m-%d') between #{gpsBeginDate} and and (DATE_FORMAT(tdl.last_gps_time,'%Y-%m-%d') between #{gpsBeginDate} and #{gpsEndDate} or DATE_FORMAT(tdl.last_bs_time,'%Y-%m-%d') between #{gpsBeginDate} and
......
...@@ -541,10 +541,20 @@ ...@@ -541,10 +541,20 @@
) )
</if> </if>
<if test="activateTimeStart != null and activateTimeStart !=''"> <if test="activateTimeStart != null and activateTimeStart !=''">
and left(tv.created_date,10) &gt;= #{activateTimeStart} <!-- and left(tv.created_date,10) &gt;= #{activateTimeStart}-->
AND
CASE
WHEN tw.finished_time is not null THEN left(tw.finished_time,10) &gt;= #{activateTimeStart}
ELSE left(tv.created_date,10) &gt;= #{activateTimeStart}
END
</if> </if>
<if test="activateTimeEnd != null and activateTimeEnd !=''"> <if test="activateTimeEnd != null and activateTimeEnd !=''">
and left(tv.created_date,10) &lt;= #{activateTimeEnd} <!-- and left(tv.created_date,10) &lt;= #{activateTimeEnd}-->
AND
CASE
WHEN tw.finished_time is not null THEN left(tw.finished_time,10) &lt;= #{activateTimeEnd}
ELSE LEFT(tv.created_date,10) &lt;= #{activateTimeEnd}
END
</if> </if>
<if test="deviceType != null"> <if test="deviceType != null">
and td.source = #{deviceType} and td.source = #{deviceType}
...@@ -647,10 +657,20 @@ ...@@ -647,10 +657,20 @@
) )
</if> </if>
<if test="activateTimeStart != null and activateTimeStart !=''"> <if test="activateTimeStart != null and activateTimeStart !=''">
and left(tv.created_date,10) &gt;= #{activateTimeStart} <!-- and left(tv.created_date,10) &gt;= #{activateTimeStart}-->
AND
CASE
WHEN tw.finished_time is not null THEN left(tw.finished_time,10) &gt;= #{activateTimeStart}
ELSE left(tv.created_date,10) &gt;= #{activateTimeStart}
END
</if> </if>
<if test="activateTimeEnd != null and activateTimeEnd !=''"> <if test="activateTimeEnd != null and activateTimeEnd !=''">
and left(tv.created_date,10) &lt;= #{activateTimeEnd} <!-- and left(tv.created_date,10) &lt;= #{activateTimeEnd}-->
AND
CASE
WHEN tw.finished_time is not null THEN left(tw.finished_time,10) &lt;= #{activateTimeEnd}
ELSE left(tv.created_date,10) &lt;= #{activateTimeEnd}
END
</if> </if>
<if test="deviceType != null"> <if test="deviceType != null">
and td.source = #{deviceType} and td.source = #{deviceType}
...@@ -793,10 +813,20 @@ ...@@ -793,10 +813,20 @@
</choose> </choose>
</if> </if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
and tvd.created_date &gt;= #{startTime} <!-- and tvd.created_date &gt;= #{startTime}-->
AND
CASE
WHEN tw.finished_time is not null THEN left(tw.finished_time,10) &gt;= #{startTime}
ELSE left(tv.created_date,10) &gt;= #{startTime}
END
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and tvd.created_date &lt;= #{endTime} <!-- and tvd.created_date &lt;= #{endTime}-->
AND
CASE
WHEN tw.finished_time is not null THEN left(tw.finished_time,10) &lt;= #{endTime}
ELSE LEFT(tv.created_date,10) &lt;= #{endTime}
END
</if> </if>
<if test="keywords != null and keywords !=''"> <if test="keywords != null and keywords !=''">
and( and(
...@@ -830,10 +860,20 @@ ...@@ -830,10 +860,20 @@
and tvd.bind_status = 1 and tvd.bind_status = 1
and tvd.del_flag = 0 and tvd.del_flag = 0
<if test="activeDateStart != null and activeDateStart != ''"> <if test="activeDateStart != null and activeDateStart != ''">
and tvd.created_date &gt;= #{activeDateStart} <!-- and tvd.created_date &gt;= #{activeDateStart}-->
AND
CASE
WHEN tw.finished_time is not null THEN left(tw.finished_time,10) &gt;= #{activeDateStart}
ELSE left(tv.created_date,10) &gt;= #{activeDateStart}
END
</if> </if>
<if test="activeDateEnd != null and activeDateEnd != ''"> <if test="activeDateEnd != null and activeDateEnd != ''">
and tvd.created_date &lt;= #{activeDateEnd} <!-- and tvd.created_date &lt;= #{activeDateEnd}-->
AND
CASE
WHEN tw.finished_time is not null THEN left(tw.finished_time,10) &lt;= #{activeDateEnd}
ELSE LEFT(tv.created_date,10) &lt;= #{activeDateEnd}
END
</if> </if>
<if test="finalGpsTimeStart != null and finalGpsTimeStart != ''"> <if test="finalGpsTimeStart != null and finalGpsTimeStart != ''">
and tdl.last_gps_time &gt;= #{finalGpsTimeStart} and tdl.last_gps_time &gt;= #{finalGpsTimeStart}
...@@ -1337,7 +1377,12 @@ ...@@ -1337,7 +1377,12 @@
and find_in_set(tv.created_by,#{checkedUserIdsStr}) and find_in_set(tv.created_by,#{checkedUserIdsStr})
</if> </if>
<if test="activateBeginDate != null and activateBeginDate != '' and activateEndDate != null and activateEndDate != ''"> <if test="activateBeginDate != null and activateBeginDate != '' and activateEndDate != null and activateEndDate != ''">
and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate} <!-- and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}-->
AND
CASE
WHEN tw.finished_time is not null THEN DATE_FORMAT(tw.finished_time,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
ELSE DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
END
</if> </if>
<if test="orderBeginDate != null and orderBeginDate != '' and orderEndDate != null and orderEndDate != ''"> <if test="orderBeginDate != null and orderBeginDate != '' and orderEndDate != null and orderEndDate != ''">
and DATE_FORMAT(tw.created_date,'%Y-%m-%d') between #{orderBeginDate} and #{orderEndDate} and DATE_FORMAT(tw.created_date,'%Y-%m-%d') between #{orderBeginDate} and #{orderEndDate}
...@@ -1391,7 +1436,12 @@ ...@@ -1391,7 +1436,12 @@
and find_in_set(tv.created_by,#{checkedUserIdsStr}) and find_in_set(tv.created_by,#{checkedUserIdsStr})
</if> </if>
<if test="activateBeginDate != null and activateBeginDate != '' and activateEndDate != null and activateEndDate != ''"> <if test="activateBeginDate != null and activateBeginDate != '' and activateEndDate != null and activateEndDate != ''">
and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate} <!-- and DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}-->
AND
CASE
WHEN tw.finished_time is not null THEN DATE_FORMAT(tw.finished_time,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
ELSE DATE_FORMAT(tv.created_date,'%Y-%m-%d') between #{activateBeginDate} and #{activateEndDate}
END
</if> </if>
<if test="orderBeginDate != null and orderBeginDate != '' and orderEndDate != null and orderEndDate != ''"> <if test="orderBeginDate != null and orderBeginDate != '' and orderEndDate != null and orderEndDate != ''">
and DATE_FORMAT(tw.created_date,'%Y-%m-%d') between #{orderBeginDate} and #{orderEndDate} and DATE_FORMAT(tw.created_date,'%Y-%m-%d') between #{orderBeginDate} and #{orderEndDate}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!