| <?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.mzl.flower.mapper.payment.OrderItemMapper"> | 
|   | 
|     <select id="getAbnormalItems" resultType="com.mzl.flower.dto.response.payment.AbnormalOrderItemDTO"> | 
|         SELECT oi.flower_name, oi.flower_unit, oi.flower_color, oi.deduct_amount | 
|         , oi.flower_cover, oi.num , oi.supplier_price, oi.price, oi.flower_level, oi.status | 
|         , (select oic.num from t_order_item_check oic | 
|             where oic.order_item_id = oi.id | 
|             and oic.type = 'replace' | 
|             and oic.audit_status = 'AGREED' | 
|         ) replaceNum | 
|         , (select oic.num from t_order_item_check oic | 
|             where oic.order_item_id = oi.id | 
|             and oic.type = 'reduce' | 
|             and oic.audit_status = 'AGREED' | 
|         ) reduceNum | 
|         , (select oic.num from t_order_item_check oic | 
|             where oic.order_item_id = oi.id | 
|             and oic.type = 'lack' | 
|             and oic.audit_status = 'AGREED' | 
|         ) lackNum | 
|         , (select oic.deduct_amount from t_order_item_check oic | 
|             where oic.order_item_id = oi.id | 
|             and oic.type = 'replace' | 
|             and oic.audit_status = 'AGREED' | 
|         ) replaceAmount | 
|         , (select oic.deduct_amount from t_order_item_check oic | 
|             where oic.order_item_id = oi.id | 
|             and oic.type = 'reduce' | 
|             and oic.audit_status = 'AGREED' | 
|         ) reduceAmount | 
|         , (select oic.deduct_amount from t_order_item_check oic | 
|             where oic.order_item_id = oi.id | 
|             and oic.type = 'lack' | 
|             and oic.audit_status = 'AGREED' | 
|         ) lackAmount | 
|         FROM t_order_item oi | 
|         WHERE oi.deleted = 0 | 
|         and oi.status = 'abnormal' | 
|         and oi.order_id = #{orderId} | 
|     </select> | 
|   | 
|     <select id="getPlatformOrderItems" resultType="com.mzl.flower.dto.response.payment.OrderItemPlatformListDTO"> | 
|         SELECT oi.*, s.name stationName, si.contact_tel supplierTel, si.contact_name supplierContact | 
|         , (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'replace') replaceNum | 
|         , (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'reduce') reduceNum | 
|         , (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'lack') lackNum | 
|         , (select oic.audit_status from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'replace') replaceStatus | 
|         , (select oic.audit_status from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'reduce') reduceStatus | 
|         , (select oic.audit_status from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'lack') lackStatus | 
|         , (select count(1) from t_order_item_check oic where oic.order_item_id = oi.id and oic.audit_status is null) unProcessCount | 
|         FROM t_order_item oi | 
|         left join t_station s on s.id = oi.station_id | 
|         left join t_supplier_info si on si.id = oi.supplier_id | 
|         WHERE oi.deleted = 0 | 
|         and oi.order_id = #{orderId} | 
|     </select> | 
| </mapper> |