<iftest="storageId != null and storageId != ''"> and storage_id = #{storageId}</if>
<iftest="storageId != null and storageId != ''"> and storage_id = #{storageId}</if>
<iftest="whCode != null and whCode != ''"> and wh_code = #{whCode}</if>
<iftest="whCode != null and whCode != ''"> and wh_code = #{whCode}</if>
<iftest="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if>
<iftest="regionCode != null and regionCode != ''"> and region_code = #{regionCode}</if>
<iftest="waCode != null and waCode != ''"> and wa_code = #{waCode}</if>
<iftest="waCode != null and waCode != ''"> and wa_code = #{waCode}</if>
<iftest="storageType != null and storageType != ''"> and storage_type = #{storageType}</if>
<iftest="storageType != null and storageType != ''"> and storage_type = #{storageType}</if>
<iftest="wlCode != null and wlCode != ''"> and wl_code = #{wlCode}</if>
<iftest="wlCode != null and wlCode != ''"> and wl_code = #{wlCode}</if>
<iftest="materialCode != null and materialCode != ''"> and material_code like concat('%', #{materialCode}, '%')</if>
<iftest="materialCode != null and materialCode != ''"> and( material_code like concat('%', #{materialCode}, '%') OR material_desc like concat('%', #{materialCode}, '%') )</if>
<iftest="materialDesc != null and materialDesc != ''"> and material_desc like concat('%', #{materialDesc}, '%')</if>
<iftest="materialDesc != null and materialDesc != ''"> and material_desc like concat('%', #{materialDesc}, '%')</if>
<iftest="amount != null "> and amount = #{amount}</if>
<iftest="amount != null "> and amount = #{amount}</if>
<iftest="storageAmount != null "> and storage_amount = #{storageAmount}</if>
<iftest="storageAmount != null "> and storage_amount = #{storageAmount}</if>
@ -142,7 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<iftest="ownEquipmentName != null and ownEquipmentName != ''"> and own_equipment_name like concat('%', #{ownEquipmentName}, '%')</if>
<iftest="ownEquipmentName != null and ownEquipmentName != ''"> and own_equipment_name like concat('%', #{ownEquipmentName}, '%')</if>
<iftest='isLow == "0"'>and TRY_CAST(safe_stock AS DECIMAL(18,2)) > amount</if>
<iftest='isLow == "0"'>and TRY_CAST(safe_stock AS DECIMAL(18,2)) > amount</if>
<iftest='isLow == "1"'>and TRY_CAST(safe_stock AS DECIMAL(18,2)) <= amount</if>
<iftest='isLow == "1"'>and TRY_CAST(safe_stock AS DECIMAL(18,2)) <= amount</if>
and del_flag = '0'
<iftest="spareCategory != null and spareCategory != ''"> and spare_category = #{spareCategory}</if>
</where>
</where>
ORDER BY
ORDER BY
CASE WHEN TRY_CONVERT(numeric(18,2), safe_stock) > amount THEN 0 ELSE 1 END,
CASE WHEN TRY_CONVERT(numeric(18,2), safe_stock) > amount THEN 0 ELSE 1 END,
@ -222,6 +227,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"