| | |
| | | t4.phonenumber as phonenumber |
| | | from t_inspector t1 |
| | | |
| | | left join t_task t5 on t5.id = t1.task_id |
| | | left join t_location t2 on t5.location_id = t2.id |
| | | left join t_location t2 on t1.location_id = t2.id |
| | | left join t_location_type t3 on t2.location_type = t3.id |
| | | left join sys_user t4 on t5.patrol_inspector = t4.user_id |
| | | left join sys_user t4 on t2.location_leader = t4.user_id |
| | | |
| | | where 1=1 |
| | | and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | <if test="query.patrolInspectorIds != null and query.patrolInspectorIds.size()>0"> |
| | | AND t4.user_id IN |
| | | AND t2.location_leader IN |
| | | <foreach collection="query.patrolInspectorIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.taskIds != null and query.taskIds.size()>0"> |
| | | AND t1.task_id IN |
| | | <foreach collection="query.taskIds" separator="," item="id" open="(" close=")"> |
| | | |
| | | <if test="query.locationIds != null and query.locationIds.size()>0"> |
| | | AND t1.location_id IN |
| | | <foreach collection="query.locationIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.locationIds != null and query.locationIds.size()>0"> |
| | | AND t5.location_id IN |
| | | <foreach collection="query.locationIds" separator="," item="id" open="(" close=")"> |
| | | <if test="query.taskIds != null and query.taskIds.size()>0"> |
| | | AND t1.id IN |
| | | <foreach collection="query.taskIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.status != null"> |
| | | and t1.status = #{query.status} |
| | | </if> |
| | | <if test="query.clearStatus != null"> |
| | | and t1.clear_status = #{query.clearStatus} |
| | | </if> |
| | | |
| | | <if test="query.startTime != null and query.startTime != ''"> |
| | | and (t1.create_time between #{query.startTime} and #{query.endTime}) |
| | | </if> |
| | |
| | | t4.phonenumber as phonenumber |
| | | from t_inspector t1 |
| | | |
| | | left join t_task t5 on t5.id = t1.task_id |
| | | left join t_location t2 on t5.location_id = t2.id |
| | | left join t_location t2 on t1.location_id = t2.id |
| | | left join t_location_type t3 on t2.location_type = t3.id |
| | | left join sys_user t4 on t5.patrol_inspector = t4.user_id |
| | | left join sys_user t4 on t2.location_leader = t4.user_id |
| | | |
| | | where 1=1 |
| | | and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | <if test="query.patrolInspectorIds != null and query.patrolInspectorIds.size()>0"> |
| | | AND t4.user_id IN |
| | | AND t2.location_leader IN |
| | | <foreach collection="query.patrolInspectorIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.taskIds != null and query.taskIds.size()>0"> |
| | | AND t1.task_id IN |
| | | <foreach collection="query.taskIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="query.locationIds != null and query.locationIds.size()>0"> |
| | | AND t5.location_id IN |
| | | AND t1.location_id IN |
| | | <foreach collection="query.locationIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.insepectorIds != null and query.insepectorIds.size()>0"> |
| | | AND t1.id IN |
| | | <foreach collection="query.insepectorIds" separator="," item="id" open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.status != null"> |
| | | and t1.status = #{query.status} |
| | | </if> |
| | | <if test="query.startTime != null and startTime != ''"> |
| | | and (t5.implement_time between #{startTime} and #{endTime}) |
| | | <if test="query.clearStatus != null"> |
| | | and t1.clear_status = #{query.clearStatus} |
| | | </if> |
| | | <if test="query.startTime != null and query.startTime != ''"> |
| | | and (t1.create_time between #{query.startTime} and #{query.endTime}) |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |
| | | <select id="listAllInspector" resultType="com.ruoyi.system.applet.vo.TaskListAllVO"> |
| | | select t1.*,t2.location_name as locationName,t3.location_name as locationTypeName, |
| | | t2.location_address as locationAddress, |
| | | t2.location_lon as locationLon, |
| | | t2.location_lat as locationLat, |
| | | t3.location_icon as locationTypeIcon, |
| | | t4.nick_name as patrolInspectorName, |
| | | t4.phonenumber as phonenumber, |
| | | ROUND( |
| | | 6378.138 * 2 * ASIN( |
| | | SQRT( |
| | | POW( |
| | | SIN( |
| | | ( |
| | | #{query.lat} * PI() / 180 - t2.location_lat * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) + COS(#{query.lat} * PI() / 180) * COS(t2.location_lat * PI() / 180) * POW( |
| | | SIN( |
| | | ( |
| | | #{query.lon} * PI() / 180 - t2.location_lon * PI() / 180 |
| | | ) / 2 |
| | | ), |
| | | 2 |
| | | ) |
| | | ) |
| | | ) * 1000 |
| | | ) AS distance |
| | | from t_inspector t1 |
| | | left join t_location t2 on t1.location_id = t2.id |
| | | left join t_location_type t3 on t2.location_type = t3.id |
| | | left join sys_user t4 on t2.location_leader = t4.user_id |
| | | where 1=1 |
| | | <if test="query.userId != null"> |
| | | and t2.location_leader = #{query.userId} |
| | | </if> |
| | | and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | and t1.status =2 |
| | | order by distance asc |
| | | </select> |
| | | |
| | | </mapper> |