2025-07-30 22:35:51 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.sczx.car.mapper.CarMapper">
|
|
|
|
|
|
2025-08-27 01:48:16 +08:00
|
|
|
<select id="pageStoreCar" resultType="com.sczx.car.dto.StoreCarDTO">
|
|
|
|
|
select
|
|
|
|
|
zc.id,
|
|
|
|
|
zc.vin,
|
|
|
|
|
zc.license_plate,
|
|
|
|
|
zc.brand_name,
|
|
|
|
|
zc.model_name,
|
|
|
|
|
zc.battery_type ,
|
|
|
|
|
ifnull(zom.overdue_days, 0) overdue_days,
|
|
|
|
|
(case
|
|
|
|
|
when ifnull(zc.package_id, 0)>0 then 'NON_PACKAGE'
|
|
|
|
|
when zc.brs_status = '9'
|
|
|
|
|
and ifnull(zom.overdue_days, 0) > 0
|
|
|
|
|
and zom.order_status = 'RENT_OVERDUE' then 'OVERDUE'
|
|
|
|
|
when zc.brs_status = '9'
|
|
|
|
|
and ifnull(zom.overdue_days, 0) = 0
|
|
|
|
|
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
|
|
|
|
|
from
|
|
|
|
|
zc_car zc
|
|
|
|
|
left join (
|
|
|
|
|
select
|
|
|
|
|
*
|
|
|
|
|
from
|
|
|
|
|
zc_order_main
|
|
|
|
|
where
|
|
|
|
|
del_flag = 0
|
|
|
|
|
AND order_status not in ('AUTO_END', 'MANUAL_END')
|
|
|
|
|
and vehicle_id in (
|
|
|
|
|
select
|
|
|
|
|
id
|
|
|
|
|
from
|
|
|
|
|
zc_car
|
|
|
|
|
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
|
|
|
|
|
on
|
|
|
|
|
zc.id = zom.vehicle_id
|
|
|
|
|
order by
|
|
|
|
|
zc.update_time desc
|
|
|
|
|
</select>
|
2025-07-30 22:35:51 +08:00
|
|
|
</mapper>
|