liyong
12 小时以前 ee359b8abc3708e9ed4796cede561685a54aafba
src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -8,17 +8,22 @@
        SELECT
        T1.*,
        t3.shipping_car_number,
        CASE
        WHEN (t2.qualitity - COALESCE(t2.locked_quantity, 0) )> T1.quantity THEN 1
        ELSE 0
        END as has_sufficient_stock,
        t3.shipping_date
        FROM
        sales_ledger_product T1
        left join shipping_info t3 on T1.id = t3.sales_ledger_product_id
        LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id
        <where>
            1=1
            <if test="salesLedgerProduct.salesLedgerId != null and salesLedgerProduct.salesLedgerId != '' ">
                AND  T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId}
                AND T1.sales_ledger_id = #{salesLedgerProduct.salesLedgerId}
            </if>
            <if test="salesLedgerProduct.type != null and salesLedgerProduct.type != '' ">
                AND  T1.type = #{salesLedgerProduct.type}
                AND T1.type = #{salesLedgerProduct.type}
            </if>
        </where>
    </select>
@@ -33,4 +38,12 @@
    </select>
    <select id="selectProduct" resultType="com.ruoyi.sales.pojo.SalesLedgerProduct">
        select
            p.product_name as product_category,
            pm.model as specification_model,
            pm.id as product_model_id
        from product_model pm
                 left join product p on pm.product_id = p.id
    </select>
</mapper>