| | |
| | | |
| | | <!--查询筛选后唯一的流程卡号--> |
| | | <select id="filterOrderProcess"> |
| | | select id,process,order_number,technology_number |
| | | select a.* from( select id as id,process,order_number,technology_number,b.nickname, |
| | | case b.nickname when '' then 1 |
| | | when null then 1 |
| | | when 'stepC' then 2 |
| | | when 'stepA' then 3 |
| | | when 'stepD' then 4 |
| | | when 'stepB' then 4 |
| | | end as sort |
| | | |
| | | |
| | | from order_process_detail |
| | | left join (select DISTINCT basic_name,nickname from basic_data where basic_category = 'process') as b |
| | | on b.basic_name = process |
| | | where order_id = #{orderId} |
| | | group by process |
| | | order by id |
| | | group by process) as a |
| | | left join (SELECT max(count) as count,process from (SELECT count(opd1.id) as count,opd.process |
| | | from order_process_detail as opd |
| | | LEFT JOIN (SELECT id,process_id,order_number,technology_number |
| | | from order_process_detail |
| | | where order_id = #{orderId}) as opd1 |
| | | on opd.process_id = opd1.process_id |
| | | and opd.order_number = opd1.order_number |
| | | and opd.technology_number = opd1.technology_number |
| | | and opd.id>=opd1.id |
| | | where opd.order_id =#{orderId} |
| | | group by opd.id) as a |
| | | GROUP BY process) as sort1 |
| | | on sort1.process = a.process |
| | | order by sort,sort1.count,id |
| | | |
| | | </select> |
| | | |