| | |
| | | SELECT |
| | | ROW_NUMBER() OVER (ORDER BY SUM(a.anfme) DESC) AS row, |
| | | -- 分组字段 |
| | | a.model, |
| | | a.matnr, |
| | | a.pro_type AS proType, |
| | | a.out_order_no AS outOrderNo, |
| | | a.temp2 AS temp2, |
| | | -- 非分组字段用聚合函数获取一个代表值(例如MAX或MIN) |
| | | MAX(a.matnr) AS matnr, |
| | | MAX(a.specs) AS specs, |
| | | MAX(a.temp1) AS temp1, |
| | | MAX(a.maktx) AS maktx, |
| | | -- 聚合数量 |
| | | SUM(a.anfme) AS anfme |
| | | FROM asr_loc_detl a |
| | | WHERE 1=1 |
| | | <include refid="stockOutConditionTwo"/> |
| | | GROUP BY a.model, a.pro_type, a.out_order_no, a.temp2 |
| | | GROUP BY a.matnr, a.pro_type, a.out_order_no, a.temp2 |
| | | ) t |
| | | WHERE t.row BETWEEN ((#{pageNumber}-1)*#{pageSize}+1) AND (#{pageNumber}*#{pageSize}) |
| | | </select> |
| | |
| | | select count(1) as count from |
| | | ( |
| | | select |
| | | a.model |
| | | a.matnr |
| | | from asr_loc_detl a |
| | | where 1=1 |
| | | <include refid="stockOutCondition"></include> |
| | | group by a.model |
| | | group by a.matnr |
| | | ) b |
| | | </select> |
| | | |