救援代码补正

This commit is contained in:
xiao-fajia 2024-09-07 11:06:15 +08:00
parent e535d73918
commit 49dd8c8515
4 changed files with 260 additions and 144 deletions

View File

@ -483,4 +483,16 @@ public class RescueInfoSystem extends BaseController {
rescueInfoService.returnCar(returnCarVO); rescueInfoService.returnCar(returnCarVO);
return CommonResult.ok(); return CommonResult.ok();
} }
/**
* 入库方法
* @author 小李
* @date 10:37 2024/9/7
* @param returnCarVO 订单信息
**/
@PostMapping("/inBase")
public CommonResult inBase(@RequestBody ReturnCarVO returnCarVO){
rescueInfoService.inBase(returnCarVO);
return CommonResult.ok();
}
} }

View File

@ -127,4 +127,11 @@ public interface IRescueInfoService extends IService<RescueInfo>
**/ **/
void returnCar(ReturnCarVO returnCarVO); void returnCar(ReturnCarVO returnCarVO);
/**
* 入库方法
* @author 小李
* @date 10:37 2024/9/7
* @param returnCarVO 订单信息
**/
void inBase(ReturnCarVO returnCarVO);
} }

View File

@ -1159,6 +1159,14 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
@Override @Override
@DSTransactional @DSTransactional
public void returnCar(ReturnCarVO returnCarVO){ public void returnCar(ReturnCarVO returnCarVO){
// 先判断是否存在和解扣
RescueInfo flag = baseMapper.selectOne(new LambdaQueryWrapper<RescueInfo>().eq(RescueInfo::getId, returnCarVO.getId()));
if (ObjectUtil.isEmpty(flag)){
throw exception0(500, "订单不存在");
}
if (!flag.getRescueStatus().equals("6")){
throw exception0(500, "车辆未解扣");
}
// 更新插入一条工单记录因为还车也要拍照什么的 // 更新插入一条工单记录因为还车也要拍照什么的
RescueInfoDetail detail = new RescueInfoDetail(); RescueInfoDetail detail = new RescueInfoDetail();
detail.setRescueInfoId(returnCarVO.getId()); detail.setRescueInfoId(returnCarVO.getId());
@ -1177,4 +1185,39 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
rescueInfo.setRescueStatus("8"); rescueInfo.setRescueStatus("8");
baseMapper.updateById(rescueInfo); baseMapper.updateById(rescueInfo);
} }
/**
* 入库方法
* @author 小李
* @date 10:37 2024/9/7
* @param returnCarVO 订单信息
**/
@Override
public void inBase(ReturnCarVO returnCarVO){
// 先判断是否存在和完成
RescueInfo flag = baseMapper.selectOne(new LambdaQueryWrapper<RescueInfo>().eq(RescueInfo::getId, returnCarVO.getId()));
if (ObjectUtil.isEmpty(flag)){
throw exception0(500, "订单不存在");
}
if (!flag.getRescueStatus().equals("5")){
throw exception0(500, "订单未完成");
}
// 更新插入一条工单记录因为扣车也要拍照什么的
RescueInfoDetail detail = new RescueInfoDetail();
detail.setRescueInfoId(returnCarVO.getId());
// type不知道是什么暂时先不要
// detail.setType()
detail.setTitle("入库");
detail.setRemark(returnCarVO.getRemark());
detail.setImages(returnCarVO.getImages());
Long deptId = getLoginUserDeptId();
detail.setDeptId(deptId);
rescueInfoDetailService.save(detail);
// 更新工单状态为扣车中(9)
RescueInfo rescueInfo = new RescueInfo();
rescueInfo.setId(returnCarVO.getId());
rescueInfo.setRescueStatus("9");
baseMapper.updateById(rescueInfo);
}
} }

View File

@ -3,17 +3,17 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.rescue.mapper.RescueInfoMapper"> <mapper namespace="cn.iocoder.yudao.module.rescue.mapper.RescueInfoMapper">
<select id="selectRescueInfoList" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo" <select id="selectRescueInfoList" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"
resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"> resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT SELECT ri.*,
ri.*,roi.order_status,roi.set_money roi.order_status,
FROM roi.set_money
rescue_info ri FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id left join rescue_order_info roi on roi.rescue_info_id = ri.id
<where> <where>
1=1 and ri.deleted = '0' 1 = 1
<if test="map.rescueStatus != null "> and ri.deleted = '0'
<if test="map.rescueStatus != null">
<choose> <choose>
<when test="map.rescueStatus == '1'.toString()"> <when test="map.rescueStatus == '1'.toString()">
<!-- 救援中 --> <!-- 救援中 -->
@ -21,158 +21,211 @@
</when> </when>
<when test="map.rescueStatus == '2'.toString()"> <when test="map.rescueStatus == '2'.toString()">
<!--待支付 --> <!--待支付 -->
and roi.order_status ='1' and roi.order_status = '1'
</when> </when>
<when test="map.rescueStatus == '3'.toString()"> <when test="map.rescueStatus == '3'.toString()">
<!-- 待取车 --> <!-- 待取车 -->
and ri.rescue_status ='6' and ri.rescue_status = '6'
</when> </when>
<when test="map.rescueStatus == '4'.toString()"> <when test="map.rescueStatus == '4'.toString()">
<!-- 评价 --> <!-- 评价 -->
and roi.order_status ='2' and roi.order_status = '2'
</when> </when>
<when test="map.rescueStatus == '5'.toString()"> <when test="map.rescueStatus == '5'.toString()">
<!-- 评价 --> <!-- 评价 -->
and roi.order_status ='3' and roi.order_status = '3'
</when> </when>
<when test="map.rescueStatus == '8'.toString()"> <when test="map.rescueStatus == '8'.toString()">
<!-- 已还车 --> <!-- 已还车 -->
and ri.rescue_status ='8' and ri.rescue_status = '8'
</when> </when>
<when test="map.rescueStatus == '9'.toString()"> <when test="map.rescueStatus == '9'.toString()">
<!-- 扣车中未解扣 --> <!-- 扣车中未解扣 -->
and (ri.rescue_type ='5' and ri.rescue_status <![CDATA[<]]> '6') and (ri.rescue_type = '5' and ri.rescue_status <![CDATA[<]]> '6')
</when> </when>
</choose> </choose>
</if> </if>
<if test="map.licenseNum != null "> <if test="map.licenseNum != null">
and ri.license_num like concat('%',#{map.licenseNum},'%') and ri.license_num like concat('%', #{map.licenseNum}, '%')
</if> </if>
</where> </where>
order by ri.create_time desc order by ri.create_time desc
</select> </select>
<select id="selectRescueListSystem2" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"> <select id="selectRescueListSystem2" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT SELECT ri.*,
ri.*,roi.order_status,roi.set_money,roi.id as rescueOrderId,roi.pay_money,roi.pay_time roi.order_status,
FROM roi.set_money,
rescue_info ri 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 left join rescue_order_info roi on roi.rescue_info_id = ri.id
where ri.deleted = '0' where ri.deleted = '0'
<if test="map.orderStatus != null and map.orderStatus != ''"> <if test="map.orderStatus != null and map.orderStatus != ''">
and roi.order_status = #{map.orderStatus} and roi.order_status = #{map.orderStatus}
</if> </if>
<if test="map.rescueStatus != null and map.rescueStatus != ''"> <if test="map.rescueStatus != null and map.rescueStatus != ''">
and ri.rescue_status = #{map.rescueStatus} and if(#{map.rescueStatus} = 0, ri.rescue_status not in(6,8,9), ri.rescue_status = #{map.rescueStatus})
</if> </if>
<if test="map.licenseNum != null "> <if test="map.licenseNum != null">
and ri.license_num like concat('%',#{map.licenseNum},'%') and ri.license_num like concat('%', #{map.licenseNum}, '%')
</if> </if>
<if test="map.connectionName != null "> <if test="map.connectionName != null">
and ri.connection_name like concat('%',#{map.connectionName},'%') and ri.connection_name like concat('%', #{map.connectionName}, '%')
</if> </if>
<if test="map.driverName != null "> <if test="map.driverName != null">
and ri.driver_name like concat('%',#{map.driverName},'%') and ri.driver_name like concat('%', #{map.driverName}, '%')
</if> </if>
<if test="map.driverCarNum != null "> <if test="map.driverCarNum != null">
and ri.driver_car_num like concat('%',#{map.driverCarNum},'%') and ri.driver_car_num like concat('%', #{map.driverCarNum}, '%')
</if> </if>
<if test="map.rescueType != null "> <if test="map.rescueType != null">
and ri.rescue_type = #{map.rescueType} and ri.rescue_type = #{map.rescueType}
</if> </if>
<if test="map.feeType != null "> <if test="map.feeType != null">
and ri.fee_type = #{map.feeType} and ri.fee_type = #{map.feeType}
</if> </if>
<if test="map.flag != null "> <if test="map.flag != null">
and ri.driver_id is not null and ri.driver_id is not null
</if> </if>
<if test="map.rescueStart != null and map.rescueEnd != null">and rescue_time between <if test="map.rescueStart != null and map.rescueEnd != null">
concat(#{map.rescueStart},' 00:00:00') and concat(#{map.rescueEnd},' 23:59:59') and rescue_time between
concat(#{map.rescueStart}, ' 00:00:00') and concat(#{map.rescueEnd}, ' 23:59:59')
</if> </if>
<if test="map.deptId != null"> <if test="map.deptId != null">
and if(#{map.deptId} = 0,ri.dept_id is null, ri.dept_id = #{map.deptId} ) and if(#{map.deptId} = 0, ri.dept_id is null, ri.dept_id = #{map.deptId})
</if> </if>
order by ri.create_time desc order by ri.create_time desc
</select> </select>
<select id="listData" resultType="com.alibaba.fastjson.JSONObject"> <select id="listData" resultType="com.alibaba.fastjson.JSONObject">
SELECT SELECT sum(set_money / 100) as allMoney,
sum(set_money/100) as allMoney,count(1) as allNum,sum(case when ri.car_type ='1' then (set_money/100)* count(1) as allNum,
sum(case
when ri.car_type = '1' then (set_money / 100) *
${rescueTcBig} ${rescueTcBig}
when ri.car_type ='2' then (set_money/100)* ${rescueTcMid} 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 when ri.car_type = '3' then (set_money / 100) * ${rescueTcSmall}
FROM else 0 end) as tcAll
rescue_info ri FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id left join rescue_order_info roi on roi.rescue_info_id = ri.id
<where> <where>
<if test="driverName != null "> <if test="driverName != null">
and ri.driver_name like concat('%',#{driverName},'%') and ri.driver_name like concat('%', #{driverName}, '%')
</if> </if>
<if test="driverCarNum != null "> <if test="driverCarNum != null">
and ri.driver_car_num like concat('%',#{driverCarNum},'%') and ri.driver_car_num like concat('%', #{driverCarNum}, '%')
</if> </if>
<if test="flag != null "> <if test="flag != null">
and ri.driver_id is not null and ri.driver_id is not null
</if> </if>
<if test="rescueStart != null ">and rescue_time like concat(#{rescueStart},'%')</if> <if test="rescueStart != null">
and rescue_time like concat(#{rescueStart}, '%')
</if>
</where> </where>
</select> </select>
<select id="selectRescueInfoListApp" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo" <select id="selectRescueInfoListApp" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"
resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"> resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT SELECT ri.*,
ri.*,roi.order_status,roi.set_money roi.order_status,
FROM roi.set_money
rescue_info ri FROM rescue_info ri
left join rescue_order_info roi on roi.rescue_info_id = ri.id left join rescue_order_info roi on roi.rescue_info_id = ri.id
<where> <where>
(ri.user_id = #{map.userId} or connection_phone =#{map.connectionPhone}) (ri.user_id = #{map.userId} or connection_phone = #{map.connectionPhone})
<if test="map.rescueStatus != null "> <if test="map.rescueStatus != null">
<!-- <choose>-->
<!-- <when test="map.rescueStatus == '1'.toString()">-->
<!-- &lt;!&ndash; 救援中 &ndash;&gt;-->
<!-- and (ri.rescue_status = '1' or ri.rescue_status = '2' or ri.rescue_status = '3')-->
<!-- </when>-->
<!-- <when test="map.rescueStatus == '2'.toString()">-->
<!-- &lt;!&ndash;待支付 &ndash;&gt;-->
<!-- and roi.order_status ='1'-->
<!-- </when>-->
<!-- <when test="map.rescueStatus == '3'.toString()">-->
<!-- &lt;!&ndash; 待取车 &ndash;&gt;-->
<!-- and ri.rescue_status ='6'-->
<!-- </when>-->
<!-- <when test="map.rescueStatus == '4'.toString()">-->
<!-- &lt;!&ndash; 评价 &ndash;&gt;-->
<!-- and roi.order_status ='2'-->
<!-- </when>-->
<!-- <when test="map.rescueStatus == '5'.toString()">-->
<!-- &lt;!&ndash; 评价 &ndash;&gt;-->
<!-- and roi.order_status ='3'-->
<!-- </when>-->
<!-- <when test="map.rescueStatus == '8'.toString()">-->
<!-- &lt;!&ndash; 已还车 &ndash;&gt;-->
<!-- and ri.rescue_status ='8'-->
<!-- </when>-->
<!-- </choose>-->
<!--
目前数据库有救援状态2、3、4、5、6、8、9订单状态0123几个状态
救援状态:
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
-->
<choose> <choose>
<when test="map.rescueStatus == '1'.toString()"> <!-- 首页查询:待救援和救援中 -->
<!-- 救援中 --> <when test="map.rescueStatus == '1'.toString() ">
and (ri.rescue_status = '1' or ri.rescue_status = '2' or ri.rescue_status = '3') and (ri.rescue_status = '2' or ri.rescue_status = '3')
</when> </when>
<when test="map.rescueStatus == '2'.toString()"> <!-- 待支付 -->
<!--待支付 --> <when test="map.rescueStatus == '2'.toString() ">
and roi.order_status ='1' and roi.order_status ='1'
</when> </when>
<when test="map.rescueStatus == '3'.toString()">
<!-- 待取车 --> <!-- 待取车 -->
<when test="map.rescueStatus == '3'.toString() ">
and ri.rescue_status ='6' and ri.rescue_status ='6'
</when> </when>
<when test="map.rescueStatus == '4'.toString()"> <!-- 待评价 -->
<!-- 评价 --> <when test="map.rescueStatus == '4'.toString() ">
and roi.order_status ='2' and roi.order_status ='2'
</when> </when>
<when test="map.rescueStatus == '5'.toString()"> <!-- 已完成 -->
<!-- 评价 --> <when test="map.rescueStatus == '5'.toString() ">
and roi.order_status ='3' and roi.order_status ='3'
</when> </when>
<when test="map.rescueStatus == '8'.toString()">
<!-- 已还车 -->
and ri.rescue_status ='8'
</when>
</choose> </choose>
</if> </if>
<if test="map.licenseNum != null "> <if test="map.licenseNum != null">
and ri.license_num like concat('%',#{map.licenseNum},'%') and ri.license_num like concat('%', #{map.licenseNum}, '%')
</if> </if>
</where> </where>
order by ri.create_time desc order by ri.create_time desc
</select> </select>
<select id="getKcList" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo" <select id="getKcList" parameterType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"
resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"> resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
select * from rescue_info ri select *
from rescue_info ri
<where> <where>
dept_id = #{map.deptId} and rescue_type = '5' dept_id = #{map.deptId}
and rescue_type = '5'
<if test="map.connectionName != null and map.connectionName != ''"> <if test="map.connectionName != null and map.connectionName != ''">
and (connection_name like concat('%', #{map.connectionName}, '%') or connection_phone like concat('%', and (connection_name like concat('%', #{map.connectionName}, '%') or connection_phone like concat('%',
#{map.connectionPhone}, '%') or license_num like concat('%',#{map.licenseNum}, '%')) #{map.connectionPhone},
'%') or
license_num like concat('%', #{map.licenseNum}, '%'))
</if> </if>
<if test="map.rescueStatus != null "> <if test="map.rescueStatus != null">
<choose> <choose>
<when test="map.rescueStatus == '1'.toString()"> <when test="map.rescueStatus == '1'.toString()">
<!-- 扣车中 --> <!-- 扣车中 -->
@ -189,51 +242,50 @@
</select> </select>
<select id="driverList" resultType="cn.iocoder.yudao.module.rescue.domain.DriverInfo"> <select id="driverList" resultType="cn.iocoder.yudao.module.rescue.domain.DriverInfo">
SELECT SELECT su.id AS userId,
su.id AS userId,
su.nickname AS nickName, su.nickname AS nickName,
su.mobile AS phonenumber, su.mobile AS phonenumber,
su.sex as sex, su.sex as sex,
su.avatar as avatar, su.avatar as avatar,
di.* di.*
FROM FROM driver_info di
driver_info di
INNER JOIN system_users su ON di.user_id = su.id INNER JOIN system_users su ON di.user_id = su.id
AND su.deleted = '0' AND su.deleted = '0'
WHERE 1=1 WHERE 1 = 1
<if test="map.nickName !=null and map.nickName !=''"> <if test="map.nickName != null and map.nickName != ''">
and su.nickname like concat('%',#{map.nickName},'%') and su.nickname like concat('%', #{map.nickName}, '%')
</if> </if>
<if test="map.phonenumber!=null and map.phonenumber!=''"> <if test="map.phonenumber != null and map.phonenumber != ''">
and su.mobile like concat('%', #{map.phonenumber}, '%') and su.mobile like concat('%', #{map.phonenumber}, '%')
</if> </if>
<if test="map.driveStatus!=null and map.driveStatus!=''"> <if test="map.driveStatus != null and map.driveStatus != ''">
and di.driver_status = #{map.driveStatus} and di.driver_status = #{map.driveStatus}
</if> </if>
<if test="map.authStatus!=null and map.authStatus!=''"> <if test="map.authStatus != null and map.authStatus != ''">
and di.auth_status = #{map.authStatus} and di.auth_status = #{map.authStatus}
</if> </if>
<if test="map.carType!=null and map.carType!=''"> <if test="map.carType != null and map.carType != ''">
and di.car_type = #{map.carType} and di.car_type = #{map.carType}
</if> </if>
<if test="map.carLicenseNum!=null and map.carLicenseNum!=''"> <if test="map.carLicenseNum != null and map.carLicenseNum != ''">
and di.car_license_num like concat('%',#{map.carLicenseNum},'%') and di.car_license_num like concat('%', #{map.carLicenseNum}, '%')
</if> </if>
order by di.create_time desc order by di.create_time desc
</select> </select>
<select id="driverListApp" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto"> <select id="driverListApp" resultType="cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto">
SELECT SELECT di.*,
di.*,su.nickname as real_name,rci.rescue_car_num su.nickname as real_name,
FROM rci.rescue_car_num
driver_info di FROM driver_info di
INNER JOIN system_users su ON di.user_id = su.id AND su.deleted = '0' 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 left join system_dept sd on sd.id = di.dept_id
inner join rescue_car_info rci on rci.possessor_id = di.id inner join rescue_car_info rci on rci.possessor_id = di.id
WHERE di.auth_status='2' WHERE di.auth_status = '2'
<if test="searchValue!=null and searchValue!=''"> <if test="searchValue != null and searchValue != ''">
and (su.nickname like concat('%',#{searchValue},'%') or di.phonenumber like concat('%',#{searchValue},'%') and (su.nickname like concat('%', #{searchValue}, '%') or
or rci.rescue_car_num like concat('%',#{searchValue},'%')) di.phonenumber like concat('%', #{searchValue}, '%')
or rci.rescue_car_num like concat('%', #{searchValue}, '%'))
</if> </if>
order by di.create_time desc order by di.create_time desc
</select> </select>
@ -294,8 +346,6 @@
DELETE DELETE
FROM rescue_info_detail FROM rescue_info_detail
WHERE rescue_info_id = #{rescueId}; WHERE rescue_info_id = #{rescueId};
</delete> </delete>
<delete id="deleteOtherInfo2"> <delete id="deleteOtherInfo2">
DELETE DELETE
@ -315,37 +365,41 @@
and rescue_time like concat(#{time}, '%') and rescue_time like concat(#{time}, '%')
</select> </select>
<select id="getRescueInfoByDriver" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo"> <select id="getRescueInfoByDriver" resultType="cn.iocoder.yudao.module.rescue.domain.RescueInfo">
SELECT SELECT ri.*,
ri.*,roi.order_status,roi.set_money,roi.id as rescueOrderId,roi.pay_money,roi.pay_time roi.order_status,
FROM roi.set_money,
rescue_info ri 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 left join rescue_order_info roi on roi.rescue_info_id = ri.id
where where driver_id is not null
driver_id is not null <if test="map.rescueStart != null and map.rescueEnd != null">
<if test="map.rescueStart != null and map.rescueEnd != null">and rescue_time between concat(#{map.rescueStart},' 00:00:00') and rescue_time between concat(#{map.rescueStart}, ' 00:00:00')
and concat(#{map.rescueEnd},' 23:59:59') and concat(#{map.rescueEnd}, ' 23:59:59')
</if> </if>
<if test="map.licenseNum != null "> <if test="map.licenseNum != null">
and ri.license_num like concat('%',#{map.licenseNum},'%') and ri.license_num like concat('%', #{map.licenseNum}, '%')
</if> </if>
<if test="map.feeType != null "> <if test="map.feeType != null">
and ri.fee_type = #{map.feeType} and ri.fee_type = #{map.feeType}
</if> </if>
<if test="map.flag != null "> <if test="map.flag != null">
and ri.driver_id is not null and ri.driver_id is not null
</if> </if>
<if test="map.rescueStart != null and map.rescueEnd != null">and rescue_time between concat(#{map.rescueStart},' 00:00:00') <if test="map.rescueStart != null and map.rescueEnd != null">
and concat(#{map.rescueEnd},' 23:59:59') and rescue_time between concat(#{map.rescueStart}, ' 00:00:00')
and concat(#{map.rescueEnd}, ' 23:59:59')
</if> </if>
<if test="map.driverName != null "> <if test="map.driverName != null">
and ri.driver_name like concat('%',#{map.driverName},'%') and ri.driver_name like concat('%', #{map.driverName}, '%')
</if> </if>
<if test="map.driverCarNum != null "> <if test="map.driverCarNum != null">
and ri.driver_car_num like concat('%',#{map.driverCarNum},'%') and ri.driver_car_num like concat('%', #{map.driverCarNum}, '%')
</if> </if>
<if test="map.rescueStartMonth != null"> <if test="map.rescueStartMonth != null">
and rescue_time like concat(#{map.rescueStartMonth},'%') and rescue_time like concat(#{map.rescueStartMonth}, '%')
</if> </if>
order by ri.driver_name desc order by ri.driver_name desc
</select> </select>
@ -366,11 +420,11 @@
SELECT sd.id, SELECT sd.id,
sd.name AS buckle_name, sd.name AS buckle_name,
t1.buckle_count t1.buckle_count
FROM FROM (SELECT dept_id,
(SELECT dept_id,
count(*) AS buckle_count count(*) AS buckle_count
FROM rescue_info FROM rescue_info
WHERE rescue_type = '5' AND deleted = '0' WHERE rescue_type = '5'
AND deleted = '0'
GROUP BY dept_id) t1 GROUP BY dept_id) t1
LEFT JOIN system_dept sd ON t1.dept_id = sd.id LEFT JOIN system_dept sd ON t1.dept_id = sd.id
ORDER BY sd.id desc ORDER BY sd.id desc