xuhy
23 小时以前 1dfb91db022f6cfa4bcb9d953ca9aa8a503e1ca5
ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml
@@ -242,5 +242,34 @@
        </where>
         order by t1.implement_time desc
    </select>
    <select id="indexTask" resultType="com.ruoyi.system.model.TTask">
        select t1.*,
               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_task t1
        left join t_location t2 on t1.location_id = t2.id
        where t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
       and t1.patrol_inspector = #{query.userId}
    </select>
</mapper>