| | |
| | | UNION ALL |
| | | SELECT |
| | | o.id, |
| | | NULL as sales_ledger_id, |
| | | o.sales_ledger_id, |
| | | o.out_date as shipping_date, |
| | | o.truck_plate_no as shipping_car_number, |
| | | NULL as express_number, |
| | |
| | | o.create_user, |
| | | o.update_user, |
| | | NULL as tenant_id, |
| | | NULL as sales_contract_no, |
| | | sl2.sales_contract_no, |
| | | pm2.model as specification_model, |
| | | pm2.unit, |
| | | p2.product_name, |
| | |
| | | FROM stock_out_record o |
| | | left join product_model pm2 on pm2.id = o.product_model_id |
| | | left join product p2 on p2.id = pm2.product_id |
| | | <!-- 绑定了销售台账的油品出库带出合同号;没绑的行该列仍为空 --> |
| | | left join sales_ledger sl2 on sl2.id = o.sales_ledger_id |
| | | WHERE o.out_category = '销售' AND o.approval_status = 1 |
| | | <!-- 油品出库没有合同号/快递单,按这两项筛选时不应返回任何油品行 --> |
| | | <if test="req.salesContractNo != null and req.salesContractNo != ''"> |
| | | AND 1=0 |
| | | AND sl2.sales_contract_no LIKE CONCAT('%',#{req.salesContractNo},'%') |
| | | </if> |
| | | <!-- 油品出库没有快递单,按快递单号筛选时不应返回任何油品行 --> |
| | | <if test="req.expressNumber != null and req.expressNumber != ''"> |
| | | AND 1=0 |
| | | </if> |