cloudroam
2024-12-04 6c823dd44dbde79f008001a2a11e7bf9bc6bf8cc
src/main/resources/mapper/payment/OrderItemMapper.xml
@@ -29,21 +29,7 @@
            where oic.order_item_id = oi.id
            and oic.type = 'reduce'
            and oic.audit_status = 'AGREED'
        ) reduceAmountSELECT 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
                             , ois.lack_fee_supplier, ois.replace_fee, ois.check_fee
        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
                 left join t_order_item_settlement ois on ois.order_item_id = oi.id
        WHERE oi.deleted = 0
          and oi.order_id = #{orderId}
        ) reduceAmount
        , (select oic.deduct_amount from t_order_item_check oic
            where oic.order_item_id = oi.id
            and oic.type = 'lack'
@@ -56,7 +42,21 @@
    </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
        , ois.lack_fee_supplier, ois.replace_fee, ois.check_fee
        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
        left join t_order_item_settlement ois on ois.order_item_id = oi.id
        WHERE oi.deleted = 0
        and oi.order_id = #{orderId}
    </select>
    <select id="getOrderItems" resultType="com.mzl.flower.dto.response.payment.OrderItemListDTO">
@@ -71,4 +71,18 @@
            #{orderId}
        </foreach>
    </select>
    <select id="getFlowerSaleNum" resultType="java.lang.Integer">
        SELECT sum(oi.num)
        FROM t_order_item oi
        JOIN t_order o on oi.order_id = o.id
        WHERE o.deleted=0
        and o.status_backend not in ('PENDING','CANCEL','REFUND')
        <if test="startTime != null">
            and o.create_time &gt; #{startTime}
        </if>
        <if test="endTime != null">
            and o.create_time &lt;= #{endTime}
        </if>
    </select>
</mapper>