无关风月
9 天以前 53d014edd19f57125c355abe71ec5b478500e610
ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml
@@ -288,5 +288,82 @@
            </foreach>
        </if>
    </select>
    <select id="pageListUserInspector" resultType="com.ruoyi.system.applet.vo.InspectorUserListVO">
        select t1.*,t2.location_name as locationName,t3.location_name as locationTypeName,
        t2.location_address as locationAddress,
        t2.location_address_end as locationAddressEnd,
        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
        and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        <if test="query.userId != null and query.userId != ''">
            and t2.location_leader = #{query.userId}
        </if>
        <if test="query.startTime != null and query.startTime != ''">
            and (t1.create_time between #{query.startTime} and #{query.endTime})
        </if>
        and (t1.status = 3 or t1.status = 4)
        order by t1.update_time desc
    </select>
    <select id="indexInspector" resultType="com.ruoyi.system.model.TInspector">
        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_inspector t1
        left join t_location t2 on t1.location_id = t2.id
        where 1=1
        and t1.status=2
    </select>
</mapper>