|
@@ -24,6 +24,7 @@
|
|
|
<result property="planCount" column="planCount"/>
|
|
|
<result property="recordCount" column="recordCount"/>
|
|
|
<result property="patrolTrajectory" column="patrol_trajectory"/>
|
|
|
+ <result property="distance" column="distance"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<resultMap type="SysUserBody" id="SysUserBody">
|
|
@@ -41,9 +42,11 @@
|
|
|
|
|
|
<select id="selectCenterdataTHydraulicPatrolTaskList" parameterType="CenterdataTHydraulicPatrolTask"
|
|
|
resultMap="CenterdataTHydraulicPatrolTaskResult">
|
|
|
- SELECT t1.*,IFNULL(Round( t2.length / 1000,2),0) realLength FROM (
|
|
|
- <include refid="selectCenterdataTHydraulicPatrolTaskVo"/>
|
|
|
+ select a.id, a.task_name, a.plan_id, a.plan_name,a.user_id,a.status, a.dept_id, a.dept_name, a.create_by, a.create_name,
|
|
|
+ a.create_time, a.update_by, a.update_name, a.update_time, a.data_status, a.type,a.patrol_trajectory,sum( b.distance ) distance
|
|
|
+ from centerdata_t_hydraulic_patrol_task a
|
|
|
left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
|
|
|
+ LEFT JOIN centerdata_t_hydraulic_patrol_plan_record b ON a.id = b.task_id
|
|
|
<where>
|
|
|
<if test="planId != null and planId != ''">and a.plan_id = #{planId}</if>
|
|
|
<if test="planName != null and planName != ''">and a.plan_name like concat('%', #{planName}, '%')</if>
|
|
@@ -58,29 +61,8 @@
|
|
|
<if test="type != null and type != ''">and a.type = #{type}</if>
|
|
|
${params.dataScope}
|
|
|
</where>
|
|
|
- ) t1
|
|
|
- LEFT JOIN (
|
|
|
- SELECT task_id, sum( c.juli ) length FROM (
|
|
|
- SELECT a.task_id,
|
|
|
- IFNULL( st_distance_sphere ( point ( a.longitude, a.latitude ), point ( b.longitude, b.latitude ) ), 0 ) AS juli
|
|
|
- FROM (
|
|
|
- SELECT a.*,(@i := @i + 1) AS xh FROM (
|
|
|
- SELECT a.task_id,b.longitude,b.latitude
|
|
|
- FROM centerdata_t_hydraulic_patrol_plan_record a
|
|
|
- LEFT JOIN centerdata_t_hydraulic_patrol_track b ON b.record_id = a.id
|
|
|
- ORDER BY b.create_time) a,(SELECT @i := 1) AS itable
|
|
|
- ) a
|
|
|
- LEFT JOIN (
|
|
|
- SELECT a.*,(@j := @j + 1) AS xh FROM(
|
|
|
- SELECT a.task_id,b.longitude,b.latitude
|
|
|
- FROM centerdata_t_hydraulic_patrol_plan_record a
|
|
|
- LEFT JOIN centerdata_t_hydraulic_patrol_track b ON b.record_id = a.id
|
|
|
- ORDER BY b.create_time) a,(SELECT @j := 0) AS itable
|
|
|
- ) b ON a.xh = b.xh AND a.task_id = b.task_id
|
|
|
- ) c
|
|
|
- GROUP BY task_id
|
|
|
- ) t2 ON t2.task_id = t1.id
|
|
|
- ORDER BY t1.create_time DESC
|
|
|
+ GROUP BY a.id
|
|
|
+ ORDER BY a.create_time DESC
|
|
|
</select>
|
|
|
|
|
|
<select id="selectCenterdataTHydraulicPatrolTaskById" parameterType="String"
|