| | |
| | | product_id, |
| | | 'combined' as stockType, |
| | | ( |
| | | select sir.tank_no |
| | | from stock_in_record sir |
| | | where sir.product_model_id = combined.product_model_id |
| | | order by sir.id desc |
| | | limit 1 |
| | | ) as tank_no, |
| | | ( |
| | | select sir.oil_product |
| | | from stock_in_record sir |
| | | where sir.product_model_id = combined.product_model_id |
| | |
| | | unit, |
| | | product_name, |
| | | product_id, |
| | | 'combined' as stockType |
| | | 'combined' as stockType, |
| | | ( |
| | | select sir.tank_no |
| | | from stock_in_record sir |
| | | where sir.product_model_id = combined.product_model_id |
| | | and (sir.batch_no = combined.batch_no or (combined.batch_no is null and sir.batch_no is null)) |
| | | order by sir.id desc |
| | | limit 1 |
| | | ) as tank_no |
| | | from ( |
| | | select |
| | | si.batch_no, |
| | |
| | | product_name, |
| | | product_id |
| | | order by |
| | | batch_no |
| | | MAX(update_time) desc |
| | | </select> |
| | | |
| | | </mapper> |