2024-08-16 13:32:42 +08:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
|
<!DOCTYPE mapper
|
2024-08-20 18:56:50 +08:00
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<mapper namespace="cn.iocoder.yudao.module.rescue.mapper.RescueInfoMapper">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
<select id="selectRescueInfoList" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"
|
|
|
|
|
|
resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
SELECT ri.*,
|
|
|
|
|
|
roi.order_status,
|
|
|
|
|
|
roi.set_money
|
|
|
|
|
|
FROM rescue_info ri
|
|
|
|
|
|
left join rescue_order_info roi on roi.rescue_info_id = ri.id
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<where>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
1 = 1
|
|
|
|
|
|
and ri.deleted = '0'
|
|
|
|
|
|
<if test="map.rescueStatus != null">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<choose>
|
2024-08-22 15:42:58 +08:00
|
|
|
|
<when test="map.rescueStatus == '1'.toString()">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<!-- 救援中 -->
|
|
|
|
|
|
and (ri.rescue_status = '1' or ri.rescue_status = '2' or ri.rescue_status = '3')
|
|
|
|
|
|
</when>
|
2024-08-22 15:42:58 +08:00
|
|
|
|
<when test="map.rescueStatus == '2'.toString()">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<!--待支付 -->
|
2024-09-07 11:06:15 +08:00
|
|
|
|
and roi.order_status = '1'
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</when>
|
2024-08-22 15:42:58 +08:00
|
|
|
|
<when test="map.rescueStatus == '3'.toString()">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<!-- 待取车 -->
|
2024-09-07 11:06:15 +08:00
|
|
|
|
and ri.rescue_status = '6'
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</when>
|
2024-08-22 15:42:58 +08:00
|
|
|
|
<when test="map.rescueStatus == '4'.toString()">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<!-- 评价 -->
|
2024-09-07 11:06:15 +08:00
|
|
|
|
and roi.order_status = '2'
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</when>
|
2024-08-22 15:42:58 +08:00
|
|
|
|
<when test="map.rescueStatus == '5'.toString()">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<!-- 评价 -->
|
2024-09-07 11:06:15 +08:00
|
|
|
|
and roi.order_status = '3'
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</when>
|
2024-08-22 15:42:58 +08:00
|
|
|
|
<when test="map.rescueStatus == '8'.toString()">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<!-- 已还车 -->
|
2024-09-07 11:06:15 +08:00
|
|
|
|
and ri.rescue_status = '8'
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</when>
|
2024-08-22 15:42:58 +08:00
|
|
|
|
<when test="map.rescueStatus == '9'.toString()">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<!-- 扣车中未解扣 -->
|
2024-09-07 11:06:15 +08:00
|
|
|
|
and (ri.rescue_type = '5' and ri.rescue_status <![CDATA[<]]> '6')
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</when>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.licenseNum != null">
|
|
|
|
|
|
and ri.license_num like concat('%', #{map.licenseNum}, '%')
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</if>
|
2024-09-21 17:36:52 +08:00
|
|
|
|
<if test="map.deptList != null and map.deptList.size()>0">
|
|
|
|
|
|
and ri.dept_id in <foreach collection="map.deptList" separator="," item="item" open="(" close=")">
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</where>
|
|
|
|
|
|
order by ri.create_time desc
|
|
|
|
|
|
</select>
|
2024-08-22 21:17:58 +08:00
|
|
|
|
|
|
|
|
|
|
<select id="selectRescueListSystem2" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
SELECT ri.*,
|
|
|
|
|
|
roi.order_status,
|
|
|
|
|
|
roi.set_money,
|
|
|
|
|
|
roi.id as rescueOrderId,
|
|
|
|
|
|
roi.pay_money,
|
|
|
|
|
|
roi.pay_time
|
|
|
|
|
|
FROM rescue_info ri
|
|
|
|
|
|
left join rescue_order_info roi on roi.rescue_info_id = ri.id
|
2024-08-22 21:17:58 +08:00
|
|
|
|
where ri.deleted = '0'
|
|
|
|
|
|
<if test="map.orderStatus != null and map.orderStatus != ''">
|
|
|
|
|
|
and roi.order_status = #{map.orderStatus}
|
|
|
|
|
|
</if>
|
|
|
|
|
|
<if test="map.rescueStatus != null and map.rescueStatus != ''">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
and if(#{map.rescueStatus} = 0, ri.rescue_status not in(6,8,9), ri.rescue_status = #{map.rescueStatus})
|
2024-08-22 21:17:58 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.licenseNum != null">
|
|
|
|
|
|
and ri.license_num like concat('%', #{map.licenseNum}, '%')
|
2024-08-22 21:17:58 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.connectionName != null">
|
|
|
|
|
|
and ri.connection_name like concat('%', #{map.connectionName}, '%')
|
2024-08-22 21:17:58 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.driverName != null">
|
|
|
|
|
|
and ri.driver_name like concat('%', #{map.driverName}, '%')
|
2024-08-22 21:17:58 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.driverCarNum != null">
|
|
|
|
|
|
and ri.driver_car_num like concat('%', #{map.driverCarNum}, '%')
|
2024-08-22 21:17:58 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.rescueType != null">
|
2024-08-22 21:17:58 +08:00
|
|
|
|
and ri.rescue_type = #{map.rescueType}
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.feeType != null">
|
2024-08-22 21:17:58 +08:00
|
|
|
|
and ri.fee_type = #{map.feeType}
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.flag != null">
|
2024-08-22 21:17:58 +08:00
|
|
|
|
and ri.driver_id is not null
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.rescueStart != null and map.rescueEnd != null">
|
|
|
|
|
|
and rescue_time between
|
|
|
|
|
|
concat(#{map.rescueStart}, ' 00:00:00') and concat(#{map.rescueEnd}, ' 23:59:59')
|
2024-08-22 21:17:58 +08:00
|
|
|
|
</if>
|
2024-09-05 18:09:48 +08:00
|
|
|
|
<if test="map.deptId != null">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
and if(#{map.deptId} = 0, ri.dept_id is null, ri.dept_id = #{map.deptId})
|
2024-09-05 18:09:48 +08:00
|
|
|
|
</if>
|
2024-08-16 13:32:42 +08:00
|
|
|
|
order by ri.create_time desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="listData" resultType="com.alibaba.fastjson.JSONObject">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
SELECT sum(set_money / 100) as allMoney,
|
|
|
|
|
|
count(1) as allNum,
|
|
|
|
|
|
sum(case
|
|
|
|
|
|
when ri.car_type = '1' then (set_money / 100) *
|
|
|
|
|
|
${rescueTcBig}
|
|
|
|
|
|
when ri.car_type = '2' then (set_money / 100) * ${rescueTcMid}
|
|
|
|
|
|
when ri.car_type = '3' then (set_money / 100) * ${rescueTcSmall}
|
|
|
|
|
|
else 0 end) as tcAll
|
|
|
|
|
|
FROM rescue_info ri
|
|
|
|
|
|
left join rescue_order_info roi on roi.rescue_info_id = ri.id
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<where>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="driverName != null">
|
|
|
|
|
|
and ri.driver_name like concat('%', #{driverName}, '%')
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="driverCarNum != null">
|
|
|
|
|
|
and ri.driver_car_num like concat('%', #{driverCarNum}, '%')
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="flag != null">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
and ri.driver_id is not null
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="rescueStart != null">
|
|
|
|
|
|
and rescue_time like concat(#{rescueStart}, '%')
|
|
|
|
|
|
</if>
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</where>
|
|
|
|
|
|
</select>
|
2024-08-22 15:42:58 +08:00
|
|
|
|
|
2024-08-20 18:56:50 +08:00
|
|
|
|
<select id="selectRescueInfoListApp" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"
|
|
|
|
|
|
resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
SELECT ri.*,
|
|
|
|
|
|
roi.order_status,
|
|
|
|
|
|
roi.set_money
|
|
|
|
|
|
FROM rescue_info ri
|
|
|
|
|
|
left join rescue_order_info roi on roi.rescue_info_id = ri.id
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<where>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
(ri.user_id = #{map.userId} or connection_phone = #{map.connectionPhone})
|
|
|
|
|
|
<if test="map.rescueStatus != null">
|
|
|
|
|
|
<!-- <choose>-->
|
|
|
|
|
|
<!-- <when test="map.rescueStatus == '1'.toString()">-->
|
|
|
|
|
|
<!-- <!– 救援中 –>-->
|
|
|
|
|
|
<!-- and (ri.rescue_status = '1' or ri.rescue_status = '2' or ri.rescue_status = '3')-->
|
|
|
|
|
|
<!-- </when>-->
|
|
|
|
|
|
<!-- <when test="map.rescueStatus == '2'.toString()">-->
|
|
|
|
|
|
<!-- <!–待支付 –>-->
|
|
|
|
|
|
<!-- and roi.order_status ='1'-->
|
|
|
|
|
|
<!-- </when>-->
|
|
|
|
|
|
<!-- <when test="map.rescueStatus == '3'.toString()">-->
|
|
|
|
|
|
<!-- <!– 待取车 –>-->
|
|
|
|
|
|
<!-- and ri.rescue_status ='6'-->
|
|
|
|
|
|
<!-- </when>-->
|
|
|
|
|
|
<!-- <when test="map.rescueStatus == '4'.toString()">-->
|
|
|
|
|
|
<!-- <!– 评价 –>-->
|
|
|
|
|
|
<!-- and roi.order_status ='2'-->
|
|
|
|
|
|
<!-- </when>-->
|
|
|
|
|
|
<!-- <when test="map.rescueStatus == '5'.toString()">-->
|
|
|
|
|
|
<!-- <!– 评价 –>-->
|
|
|
|
|
|
<!-- and roi.order_status ='3'-->
|
|
|
|
|
|
<!-- </when>-->
|
|
|
|
|
|
<!-- <when test="map.rescueStatus == '8'.toString()">-->
|
|
|
|
|
|
<!-- <!– 已还车 –>-->
|
|
|
|
|
|
<!-- and ri.rescue_status ='8'-->
|
|
|
|
|
|
<!-- </when>-->
|
|
|
|
|
|
<!-- </choose>-->
|
|
|
|
|
|
<!--
|
|
|
|
|
|
目前数据库有救援状态:2、3、4、5、6、8、9,订单状态:0,1,2,3几个状态
|
|
|
|
|
|
救援状态:
|
|
|
|
|
|
2:待救援
|
|
|
|
|
|
3:救援中
|
|
|
|
|
|
5:已完成
|
|
|
|
|
|
6:待取车/已解扣
|
|
|
|
|
|
8:已取走/已还车
|
|
|
|
|
|
9:扣车中
|
|
|
|
|
|
订单状态:
|
|
|
|
|
|
0:已成单
|
|
|
|
|
|
1:待支付
|
|
|
|
|
|
2:待评价
|
|
|
|
|
|
3:已完成
|
|
|
|
|
|
字典:救援状态:jy_status:记A,扣车状态:rescue_status:记B,救援订单状态:jy_order_status:记C
|
|
|
|
|
|
2、3、5独在A
|
|
|
|
|
|
6、8在A、B都有,使用地方不一样
|
|
|
|
|
|
9独在B
|
|
|
|
|
|
订单状态只在C
|
|
|
|
|
|
-->
|
2024-08-20 18:56:50 +08:00
|
|
|
|
<choose>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<!-- 首页查询:待救援和救援中 -->
|
|
|
|
|
|
<when test="map.rescueStatus == '1'.toString() ">
|
|
|
|
|
|
and (ri.rescue_status = '2' or ri.rescue_status = '3')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</when>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<!-- 待支付 -->
|
|
|
|
|
|
<when test="map.rescueStatus == '2'.toString() ">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and roi.order_status ='1'
|
|
|
|
|
|
</when>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<!-- 待取车 -->
|
|
|
|
|
|
<when test="map.rescueStatus == '3'.toString() ">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and ri.rescue_status ='6'
|
|
|
|
|
|
</when>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<!-- 待评价 -->
|
|
|
|
|
|
<when test="map.rescueStatus == '4'.toString() ">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and roi.order_status ='2'
|
|
|
|
|
|
</when>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<!-- 已完成 -->
|
|
|
|
|
|
<when test="map.rescueStatus == '5'.toString() ">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and roi.order_status ='3'
|
|
|
|
|
|
</when>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.licenseNum != null">
|
|
|
|
|
|
and ri.license_num like concat('%', #{map.licenseNum}, '%')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
</where>
|
|
|
|
|
|
order by ri.create_time desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getKcList" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"
|
|
|
|
|
|
resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
select *
|
|
|
|
|
|
from rescue_info ri
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<where>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
dept_id = #{map.deptId}
|
|
|
|
|
|
and rescue_type = '5'
|
2024-08-24 08:56:38 +08:00
|
|
|
|
<if test="map.connectionName != null and map.connectionName != ''">
|
|
|
|
|
|
and (connection_name like concat('%', #{map.connectionName}, '%') or connection_phone like concat('%',
|
2024-09-07 11:06:15 +08:00
|
|
|
|
#{map.connectionPhone},
|
|
|
|
|
|
'%') or
|
|
|
|
|
|
license_num like concat('%', #{map.licenseNum}, '%'))
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.rescueStatus != null">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
<choose>
|
2024-08-24 08:56:38 +08:00
|
|
|
|
<when test="map.rescueStatus == '1'.toString()">
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<!-- 扣车中 -->
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and rescue_status <![CDATA[<]]> '6'
|
|
|
|
|
|
</when>
|
2024-08-24 08:56:38 +08:00
|
|
|
|
<when test="map.rescueStatus == '2'.toString()">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
<!-- 已解 -->
|
|
|
|
|
|
and rescue_status <![CDATA[>=]]> '6'
|
|
|
|
|
|
</when>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</if>
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</where>
|
|
|
|
|
|
order by create_time desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2024-08-20 18:56:50 +08:00
|
|
|
|
<select id="driverList" resultType="cn.iocoder.yudao.module.rescue.domain.DriverInfo">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
SELECT su.id AS userId,
|
|
|
|
|
|
su.nickname AS nickName,
|
|
|
|
|
|
su.mobile AS phonenumber,
|
|
|
|
|
|
su.sex as sex,
|
|
|
|
|
|
su.avatar as avatar,
|
|
|
|
|
|
di.*
|
|
|
|
|
|
FROM driver_info di
|
|
|
|
|
|
INNER JOIN system_users su ON di.user_id = su.id
|
|
|
|
|
|
AND su.deleted = '0'
|
|
|
|
|
|
WHERE 1 = 1
|
|
|
|
|
|
<if test="map.nickName != null and map.nickName != ''">
|
|
|
|
|
|
and su.nickname like concat('%', #{map.nickName}, '%')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.phonenumber != null and map.phonenumber != ''">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and su.mobile like concat('%', #{map.phonenumber}, '%')
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.driveStatus != null and map.driveStatus != ''">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and di.driver_status = #{map.driveStatus}
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.authStatus != null and map.authStatus != ''">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and di.auth_status = #{map.authStatus}
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.carType != null and map.carType != ''">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and di.car_type = #{map.carType}
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.carLicenseNum != null and map.carLicenseNum != ''">
|
|
|
|
|
|
and di.car_license_num like concat('%', #{map.carLicenseNum}, '%')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
order by di.create_time desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="driverListApp" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
SELECT di.*,
|
|
|
|
|
|
su.nickname as real_name,
|
|
|
|
|
|
rci.rescue_car_num
|
|
|
|
|
|
FROM driver_info di
|
|
|
|
|
|
INNER JOIN system_users su ON di.user_id = su.id AND su.deleted = '0'
|
|
|
|
|
|
left join system_dept sd on sd.id = di.dept_id
|
|
|
|
|
|
inner join rescue_car_info rci on rci.possessor_id = di.id
|
|
|
|
|
|
WHERE di.auth_status = '2'
|
|
|
|
|
|
<if test="searchValue != null and searchValue != ''">
|
|
|
|
|
|
and (su.nickname like concat('%', #{searchValue}, '%') or
|
|
|
|
|
|
di.phonenumber like concat('%', #{searchValue}, '%')
|
|
|
|
|
|
or rci.rescue_car_num like concat('%', #{searchValue}, '%'))
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
order by di.create_time desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="driverInMap2" resultType="java.util.Map">
|
|
|
|
|
|
SELECT IFNULL(sum(di.driver_status = '1'), 0) as kxNum,
|
|
|
|
|
|
IFNULL(sum(di.driver_status = '2'), 0) as ztNum,
|
|
|
|
|
|
IFNULL(sum(di.driver_status = '3'), 0) as mlNum,
|
|
|
|
|
|
IFNULL(sum(di.driver_status = '4'), 0) as lxNum
|
|
|
|
|
|
FROM driver_info di
|
2024-08-23 11:58:09 +08:00
|
|
|
|
INNER JOIN system_users su ON di.user_id = su.id
|
|
|
|
|
|
AND su.deleted = '0'
|
|
|
|
|
|
LEFT JOIN system_dept sd ON sd.id = di.dept_id
|
2024-08-20 18:56:50 +08:00
|
|
|
|
INNER JOIN rescue_car_info rci ON rci.possessor_id = di.id
|
|
|
|
|
|
WHERE di.auth_status = '2'
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</select>
|
2024-08-20 18:56:50 +08:00
|
|
|
|
<update id="dealOverTimeRescue">
|
|
|
|
|
|
UPDATE rescue_info
|
|
|
|
|
|
SET need_system = '1'
|
|
|
|
|
|
WHERE need_system = '0'
|
|
|
|
|
|
AND driver_id IS NULL
|
|
|
|
|
|
AND TIMESTAMPDIFF(
|
2024-09-07 11:06:15 +08:00
|
|
|
|
MINUTE, rescue_time,
|
|
|
|
|
|
NOW()) > 5
|
2024-08-20 18:56:50 +08:00
|
|
|
|
AND rescue_status = '2'
|
|
|
|
|
|
</update>
|
2024-08-16 13:32:42 +08:00
|
|
|
|
<select id="getOverTimeRescue" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
SELECT ri.*,
|
|
|
|
|
|
MAX(rdi.driver_level) as driverLevel
|
|
|
|
|
|
FROM rescue_info ri
|
|
|
|
|
|
INNER JOIN rescue_driver_info rdi ON ri.id = rdi.rescue_id
|
|
|
|
|
|
WHERE ri.driver_id IS NULL
|
|
|
|
|
|
AND ri.rescue_status = '2'
|
2024-08-16 13:32:42 +08:00
|
|
|
|
GROUP BY ri.id
|
2024-08-20 18:56:50 +08:00
|
|
|
|
HAVING TIMESTAMPDIFF(
|
2024-09-07 11:06:15 +08:00
|
|
|
|
MINUTE, MAX(rdi.create_time),
|
|
|
|
|
|
NOW()) <![CDATA[>]]> 3
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getRescueStatistics" resultType="java.util.Map">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
SELECT IFNULL(sum(ri.rescue_status = '2' or ri.rescue_status = '3'), 0) as jyzNum,
|
|
|
|
|
|
IFNULL(sum(roi.order_status = '1'), 0) as dzfNum,
|
|
|
|
|
|
IFNULL(sum(ri.rescue_status = '6'), 0) as dqcNum,
|
|
|
|
|
|
IFNULL(sum(ri.rescue_status <![CDATA[>=]]> '5'), 0) as ywcNum
|
|
|
|
|
|
FROM rescue_info ri
|
|
|
|
|
|
left join rescue_order_info roi on roi.rescue_info_id = ri.id
|
|
|
|
|
|
where ri.user_id = #{userId}
|
|
|
|
|
|
or connection_phone = #{connectionPhone}
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getRescueStatisticsByAdmin" resultType="java.util.Map">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
SELECT IFNULL(sum(ri.rescue_status = '2' or ri.rescue_status = '3'), 0) as jyzNum,
|
|
|
|
|
|
IFNULL(sum(roi.order_status = '1'), 0) as dzfNum,
|
|
|
|
|
|
IFNULL(sum(ri.rescue_status = '6'), 0) as dqcNum,
|
|
|
|
|
|
IFNULL(sum(ri.rescue_status <![CDATA[>=]]> '5'), 0) as ywcNum
|
|
|
|
|
|
FROM rescue_info ri
|
|
|
|
|
|
left join rescue_order_info roi on roi.rescue_info_id = ri.id
|
|
|
|
|
|
where 1 = 1
|
2024-09-21 17:36:52 +08:00
|
|
|
|
<if test="map.deptList != null and map.deptList.size()>0">
|
|
|
|
|
|
and ri.dept_id in <foreach collection="map.deptList" separator="," item="item" open="(" close=")">
|
|
|
|
|
|
#{item}
|
|
|
|
|
|
</foreach>
|
|
|
|
|
|
</if>
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
<delete id="deleteOtherInfo1">
|
|
|
|
|
|
DELETE
|
2024-08-20 18:56:50 +08:00
|
|
|
|
FROM rescue_info_detail
|
|
|
|
|
|
WHERE rescue_info_id = #{rescueId};
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteOtherInfo2">
|
|
|
|
|
|
DELETE
|
2024-08-20 18:56:50 +08:00
|
|
|
|
FROM rescue_driver_info
|
|
|
|
|
|
WHERE rescue_id = #{rescueId};
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</delete>
|
|
|
|
|
|
|
2024-08-20 18:56:50 +08:00
|
|
|
|
<select id="getDriverCarNum" resultType="com.alibaba.fastjson.JSONObject">
|
|
|
|
|
|
SELECT count(1) as allNum,
|
|
|
|
|
|
ifnull(sum(case
|
|
|
|
|
|
when start_scale is null then 0
|
|
|
|
|
|
when end_scale is null then 0
|
|
|
|
|
|
else end_scale - start_scale end), 0) as allDistance
|
|
|
|
|
|
FROM rescue_info
|
|
|
|
|
|
where driver_id = #{driverId}
|
|
|
|
|
|
and driver_car_num = #{carNum}
|
|
|
|
|
|
and rescue_time like concat(#{time}, '%')
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getRescueInfoByDriver" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
SELECT ri.*,
|
|
|
|
|
|
roi.order_status,
|
|
|
|
|
|
roi.set_money,
|
|
|
|
|
|
roi.id as rescueOrderId,
|
|
|
|
|
|
roi.pay_money,
|
|
|
|
|
|
roi.pay_time
|
|
|
|
|
|
FROM rescue_info ri
|
|
|
|
|
|
left join rescue_order_info roi on roi.rescue_info_id = ri.id
|
|
|
|
|
|
where driver_id is not null
|
|
|
|
|
|
<if test="map.rescueStart != null and map.rescueEnd != null">
|
|
|
|
|
|
and rescue_time between concat(#{map.rescueStart}, ' 00:00:00')
|
|
|
|
|
|
and concat(#{map.rescueEnd}, ' 23:59:59')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.licenseNum != null">
|
|
|
|
|
|
and ri.license_num like concat('%', #{map.licenseNum}, '%')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.feeType != null">
|
2024-08-23 11:58:09 +08:00
|
|
|
|
and ri.fee_type = #{map.feeType}
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.flag != null">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
and ri.driver_id is not null
|
|
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.rescueStart != null and map.rescueEnd != null">
|
|
|
|
|
|
and rescue_time between concat(#{map.rescueStart}, ' 00:00:00')
|
|
|
|
|
|
and concat(#{map.rescueEnd}, ' 23:59:59')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
2024-08-16 13:32:42 +08:00
|
|
|
|
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.driverName != null">
|
|
|
|
|
|
and ri.driver_name like concat('%', #{map.driverName}, '%')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
2024-09-07 11:06:15 +08:00
|
|
|
|
<if test="map.driverCarNum != null">
|
|
|
|
|
|
and ri.driver_car_num like concat('%', #{map.driverCarNum}, '%')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
2024-08-23 11:58:09 +08:00
|
|
|
|
<if test="map.rescueStartMonth != null">
|
2024-09-07 11:06:15 +08:00
|
|
|
|
and rescue_time like concat(#{map.rescueStartMonth}, '%')
|
2024-08-20 18:56:50 +08:00
|
|
|
|
</if>
|
2024-08-16 13:32:42 +08:00
|
|
|
|
order by ri.driver_name desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="statisticsInfo" resultType="com.alibaba.fastjson.JSONObject">
|
2024-08-20 18:56:50 +08:00
|
|
|
|
SELECT IFNULL(sum(roi.set_money), 0) / 100 as money,
|
|
|
|
|
|
count(ri.id) as rescueNum,
|
2024-09-07 11:06:15 +08:00
|
|
|
|
su.nickname as driverName
|
2024-08-20 18:56:50 +08:00
|
|
|
|
FROM driver_info di
|
|
|
|
|
|
LEFT JOIN rescue_info ri on ri.driver_id = di.id and ri.rescue_time <![CDATA[>=]]> #{startTime} and
|
|
|
|
|
|
ri.rescue_time <![CDATA[<=]]> #{endTime}
|
|
|
|
|
|
LEFT JOIN rescue_order_info roi on ri.id = roi.rescue_info_id
|
2024-08-23 11:58:09 +08:00
|
|
|
|
INNER JOIN system_users su on di.user_id = su.id
|
2024-08-16 13:32:42 +08:00
|
|
|
|
GROUP BY di.id
|
|
|
|
|
|
ORDER BY rescueNum desc
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
2024-09-05 18:09:48 +08:00
|
|
|
|
<select id="listBuckle" resultType="cn.iocoder.yudao.module.rescue.vo.BuckleVO">
|
|
|
|
|
|
SELECT sd.id,
|
|
|
|
|
|
sd.name AS buckle_name,
|
|
|
|
|
|
t1.buckle_count
|
2024-09-07 11:06:15 +08:00
|
|
|
|
FROM (SELECT dept_id,
|
|
|
|
|
|
count(*) AS buckle_count
|
|
|
|
|
|
FROM rescue_info
|
|
|
|
|
|
WHERE rescue_type = '5'
|
|
|
|
|
|
AND deleted = '0'
|
|
|
|
|
|
GROUP BY dept_id) t1
|
|
|
|
|
|
LEFT JOIN system_dept sd ON t1.dept_id = sd.id
|
2024-09-05 18:09:48 +08:00
|
|
|
|
ORDER BY sd.id desc
|
|
|
|
|
|
</select>
|
2024-08-16 13:32:42 +08:00
|
|
|
|
</mapper>
|