查询车辆改成or

This commit is contained in:
2025-09-13 22:41:21 +08:00
parent ed03d3c52d
commit 538fdd8552

View File

@ -28,11 +28,20 @@
zc_rent_car_rule r ON mp.car_rule_id = r.id AND r.del_flag = '0' AND r.status = '0'
<where>
s.id = #{storeCarModelReq.storeId}
<if test="storeCarModelReq.depositFree != null and storeCarModelReq.depositFree != ''">
AND r.deposit_free = #{storeCarModelReq.depositFree}
</if>
<if test="storeCarModelReq.autoDeduct != null and storeCarModelReq.autoDeduct != ''">
AND r.auto_deduct = #{storeCarModelReq.autoDeduct}
<if test="(storeCarModelReq.depositFree != null and storeCarModelReq.depositFree != '') or (storeCarModelReq.autoDeduct != null and storeCarModelReq.autoDeduct != '')">
AND (
<choose>
<when test="storeCarModelReq.depositFree != null and storeCarModelReq.depositFree != '' and storeCarModelReq.autoDeduct != null and storeCarModelReq.autoDeduct != ''">
r.deposit_free = #{storeCarModelReq.depositFree} OR r.auto_deduct = #{storeCarModelReq.autoDeduct}
</when>
<when test="storeCarModelReq.depositFree != null and storeCarModelReq.depositFree != ''">
r.deposit_free = #{storeCarModelReq.depositFree}
</when>
<otherwise>
r.auto_deduct = #{storeCarModelReq.autoDeduct}
</otherwise>
</choose>
)
</if>
AND cm.del_flag = '0' AND cm.status = '0'
</where>