src/main/resources/mapper/stock/StockInRecordMapper.xml
@@ -70,4 +70,31 @@
        </where>
        order by sir.id desc
    </select>
    <select id="listPageAccountPurchase" resultType="com.ruoyi.account.bean.vo.PurchaseInboundVo">
        SELECT
        sir.id,
        sir.inbound_batches,
        pl.supplier_name,
        DATE(sir.create_time) AS inboundDate,
        p.product_name,
        slp.specification_model,
        sor.stock_in_num * slp.tax_inclusive_unit_price as InboundAmount,
        pl.purchase_contract_number
        FROM stock_in_record sir
        LEFT JOIN purchase_ledger pl ON sir.record_id = pl.id
        LEFT JOIN sales_ledger_product slp ON s.sales_ledger_product_id = pl.id and slp.type = 2
        left join product_model pm on slp.product_model_id = pm.id
        left join product p on pm.product_id = p.id
        WHERE sir.approval_status=1 and sir.record_type='7'
        <if test="req.inboundBatches != null and req.inboundBatches != ''">
            AND sir.inbound_batches LIKE CONCAT('%',#{req.inboundBatches},'%')
        </if>
        <if test="req.supplierName != null and req.supplierName != ''">
            AND pl.supplier_name LIKE CONCAT('%',#{req.supplierName},'%')
        </if>
        <if test="req.startDate != null and req.endDate != null">
            AND DATE(sir.create_time) BETWEEN #{startDate} AND #{endDate}
        </if>
        order by sir.id DESC
    </select>
</mapper>