解决门店车辆查询语句的问题

This commit is contained in:
2025-08-27 20:36:35 +08:00
parent f1b4c24135
commit 7d854f187a
4 changed files with 34 additions and 8 deletions

View File

@ -3,6 +3,10 @@
<mapper namespace="com.sczx.car.mapper.CarMapper">
<select id="pageStoreCar" resultType="com.sczx.car.dto.StoreCarDTO">
select
*
from
(
select
zc.id,
zc.vin,
@ -21,7 +25,13 @@
and zom.order_status = 'RENT_ING' then 'RENTING'
when zc.brs_status = '0' then 'FREE'
when zc.brs_status = '1' then 'REMOVED'
END ) store_car_status
END ) store_car_status,
zc.brs_status,
zc.images,
zom.order_status,
zom.order_no,
zc.update_time,
zc.store_id
from
zc_car zc
left join (
@ -40,14 +50,22 @@
where
del_flag = 0
and status = 0
and store_id = #{storeCarReq.storeId}
<if test="storeCarReq.licensePlate != null and storeCarReq.licensePlate != ''">
and license_plate like concat('%', #{storeCarReq.licensePlate}, '%')
</if>
) )zom
and store_id = #{storeCarReq.storeId}) )zom
on
zc.id = zom.vehicle_id
) a
where
a.store_id = #{storeCarReq.storeId}
<if test="storeCarReq.storeCarStatusList != null and storeCarReq.storeCarStatusList.size() > 0">
and a.store_car_status
in <foreach collection="storeCarReq.storeCarStatusList" item="carStatus" open="(" separator="," close=")">
#{carStatus}
</foreach>
</if>
<if test="storeCarReq.licensePlate != null and storeCarReq.licensePlate != ''">
and a.license_plate like concat('%', #{storeCarReq.licensePlate}, '%')
</if>
order by
zc.update_time desc
a.update_time desc
</select>
</mapper>