无关风月
1 天以前 581a4811fb62fcfef4e6a19cc67e095a167f139d
ruoyi-system/src/main/resources/mapper/system/TTaskMapper.xml
@@ -66,7 +66,6 @@
               t2.location_address as locationAddress,
        t2.location_address_end as locationAddressEnd,
        t3.location_icon as locationTypeIcon,
        t5.clear_status as clearStatus,
        t4.nick_name as patrolInspectorName,
        t4.phonenumber as phonenumber,
@@ -95,34 +94,19 @@
        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 t1.patrol_inspector = t4.user_id
        inner JOIN (
        SELECT t1.*
        FROM t_task_detail t1
        left join (SELECT task_id, MAX(create_time) AS max_time
        FROM t_task_detail
        GROUP BY task_id
        order by create_time desc
        ) AS t2 ON t1.task_id = t2.task_id AND t1.create_time = t2.max_time
        ) t5 on t1.id = t5.task_id
        where 1=1
        and t1.`disabled` = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        <if test="query.userId != null and query.userId != ''">
            and t1.patrol_inspector = #{query.userId}
        </if>
        <if test="query.clearStatus != null and query.clearStatus == 1">
            and (t1.status = 5 or t1.status = 6)
        </if>
        <if test="query.clearStatus != null and query.clearStatus == 2">
            and (t1.status = 4 )
        </if>
        <if test="query.clearStatus == null">
            and (t1.status = 4 or t1.status = 5 or t1.status = 6 )
        </if>
        <if test="query.startTime != null and query.startTime != ''">
            and (t1.implement_time between #{query.startTime} and #{query.endTime})
        </if>
        and (t1.status = 5 or t1.status = 6)
        order by t1.update_time desc
    </select>
    <select id="exportList" resultType="com.ruoyi.system.vo.system.TaskListVO">
@@ -271,5 +255,38 @@
       and t1.patrol_inspector = #{query.userId}
    </select>
    <select id="getTaskByIds" resultType="com.ruoyi.system.model.TTask">
        select t1.*,
        ROUND(
        6378.138 * 2 * ASIN(
        SQRT(
        POW(
        SIN(
        (
        #{lat} * PI() / 180 - t2.location_lat * PI() / 180
        ) / 2
        ),
        2
        ) + COS(#{lat} * PI() / 180) * COS(t2.location_lat * PI() / 180) * POW(
        SIN(
        (
        #{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 1=1
        <if test="ids != null and ids.size()>0">
            and t1.id IN
            <foreach collection="ids" separator="," item="id" open="(" close=")">
                #{id}
            </foreach>
        </if>
    </select>
</mapper>