|
@@ -667,21 +667,32 @@
|
|
|
|
|
|
<!--查询派单时的用户状态-->
|
|
|
<select id="selectOrderUserStatus" parameterType="java.lang.String" resultType="map">
|
|
|
- select X, Y, CASE WHEN S IS NULL THEN '空闲' WHEN S='0' THEN '空闲' ELSE '执行中' END S ,
|
|
|
- case when offlinetime is null then '离线' when offlinetime>10 then '离线' when offlinetime <= 10 THEN '在线' END L FROM
|
|
|
- (
|
|
|
- select order_user_id,longtitude X, latitude Y, TIMESTAMPDIFF(second,upload_date, now()) offlinetime from sc_work_order_manage t1 left join sc_gps_data t2
|
|
|
- on t1.order_user_id = t2.user_id
|
|
|
- group by order_user_id,longtitude, latitude,upload_date
|
|
|
- ) a
|
|
|
+ SELECT X, Y,
|
|
|
+ CASE WHEN S IS NULL THEN '空闲' WHEN S='0' THEN '空闲' ELSE '执行中' END S ,
|
|
|
+ CASE WHEN Z IS NULL THEN '空闲' WHEN Z='0' THEN '空闲' ELSE '执行中' END Z ,
|
|
|
+ CASE WHEN S IS NULL AND Z IS NULL THEN '空闲' WHEN Z='0' AND Z='0' THEN '空闲' ELSE '执行中' END W ,
|
|
|
+ CASE WHEN offlinetime IS NULL THEN '离线' WHEN offlinetime>10 THEN '离线' WHEN offlinetime <= 10 THEN '在线' END L
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ select order_user_id,longtitude X, latitude Y, TIMESTAMPDIFF(second,upload_date, now()) offlinetime from sc_work_order_manage t1 left join sc_gps_data t2
|
|
|
+ on t1.order_user_id = t2.user_id
|
|
|
+ group by order_user_id,longtitude, latitude,upload_date
|
|
|
+ ) a
|
|
|
+ left join
|
|
|
+ (
|
|
|
+ select count(*) S,order_user_id from sc_work_order_manage
|
|
|
+ where order_status = 1
|
|
|
+ group by order_user_id
|
|
|
+ ) b
|
|
|
+ on a.order_user_id=b.order_user_id
|
|
|
left join
|
|
|
- (
|
|
|
- select count(*) S,order_user_id from sc_work_order_manage
|
|
|
- where order_status = 1
|
|
|
- group by order_user_id
|
|
|
- ) b
|
|
|
- on a.order_user_id=b.order_user_id
|
|
|
- where a.order_user_id= #{userId,jdbcType=INTEGER}
|
|
|
+ (
|
|
|
+ select count(*) Z,user_id from sc_plan_manage
|
|
|
+ where plan_status = 1
|
|
|
+ group by user_id
|
|
|
+ ) c
|
|
|
+ on c.user_id=a.order_user_id
|
|
|
+ where a.order_user_id= #{userId,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
|
|
|
<!--查询维修列表的用户状态-->
|