fix(purchase): 修正采购退货相关SQL查询
| | |
| | | </resultMap> |
| | | <select id="getReturnOrderGroupListByProductIds" resultType="com.ruoyi.purchase.dto.SimpleReturnOrderGroupDto" |
| | | parameterType="java.util.List"> |
| | | select t1.product_model_id, |
| | | select t1.sales_ledger_product_id, |
| | | sum(t1.return_quantity) as sum_return_quantity |
| | | from purchase_return_order_products as t1 |
| | | inner join purchase_return_orders as t2 on t1.purchase_return_order_id = t2.id |
| | | WHERE t1.product_model_id IN |
| | | WHERE t1.sales_ledger_product_id IN |
| | | <foreach item="id" collection="productIds" separator="," open="(" close=")"> |
| | | #{id} |
| | | </foreach> |
| | | group by t1.product_model_id |
| | | group by t1.sales_ledger_product_id |
| | | </select> |
| | | </mapper> |
| | |
| | | resultType="com.ruoyi.account.bean.vo.PurchaseReturnVo"> |
| | | select pro.id, |
| | | pro.no returnNo, |
| | | t.inboundBatches, |
| | | sm.supplier_name, |
| | | pro.prepared_at, |
| | | pro.total_amount, |
| | | CASE pro.return_type WHEN 0 THEN '退货退款' WHEN 1 THEN '拒收' END AS returnType, |
| | | pl.purchase_contract_number |
| | | from purchase_return_orders pro |
| | | left join supplier_manage sm on pro.supplier_id = sm.id |
| | | left join purchase_ledger pl on pro.purchase_ledger_id = pl.id |
| | | left join |
| | | (select prop.purchase_return_order_id, |
| | | GROUP_CONCAT(sir.inbound_batches SEPARATOR ',') AS inboundBatches |
| | | from purchase_return_order_products prop |
| | | left join stock_in_record sir on prop.stock_in_record_id = sir.id |
| | | GROUP BY prop.purchase_return_order_id) t on t.purchase_return_order_id = pro.id |
| | | left join supplier_manage sm on pro.supplier_id = sm.id |
| | | left join purchase_ledger pl on pro.purchase_ledger_id = pl.id |
| | | where 1=1 |
| | | <if test="req.returnNo != null and req.returnNo != ''"> |
| | | and pro.no like concat('%',#{req.returnNo},'%') |