| | |
| | | b.UPDATE_DATE |
| | | </select> |
| | | <select id="getStatist" resultType="com.example.server.progressTrack.Dto.StatistDismantDto"> |
| | | select a.*, |
| | | sum(case when c.status=1 then 1 else 0 end) as sbcxsl |
| | | from ( |
| | | select a.id, |
| | | case when a.pid=0 then a.NAME else ' '|| a.NAME end as name, |
| | | case when a.pid=0 then '' || a.id else ''|| a.pid || a.SORT end as sort, |
| | | count(DISTINCT b.LEVEL3_NETWORK_ID) as sbsl, |
| | | count(DISTINCT b.dismant_id) as zbjsl, |
| | | sum(case when b.status=1 then 1 else 0 end) as zbjcxsl, |
| | | sum( CASE WHEN dismant_time IS NULL THEN 0 ELSE 1 END ) AS dismantsl, |
| | | sum( CASE WHEN exit_time IS NULL THEN 0 ELSE 1 END ) AS exitsl, |
| | | sum( CASE WHEN return_weight_time IS NULL THEN 0 ELSE 1 END ) AS returnsl, |
| | | sum( CASE WHEN warehouse_time IS NULL THEN 0 ELSE 1 END ) AS warehousesl |
| | | from dj_sys_teamgroup_class a |
| | | left join ( |
| | | select a.id as id2 ,a.pid as pid2 ,c.LEVEL3_NETWORK_ID, |
| | | c.id as dismant_id,c.status, |
| | | c.dismant_time, |
| | | c.exit_time, |
| | | c.return_weight_time, |
| | | c.warehouse_time |
| | | from dj_sys_teamgroup_class a,dj_jdgz_network_level3 b,dj_jdgz_dismant_track c |
| | | where a.IS_DELETE= 0 and b.IS_DELETE = 0 and c.is_delete = 0 |
| | | and a.AREA = 'hld' |
| | | and b.TEAMGROUP_ID = a.id |
| | | and c.LEVEL3_NETWORK_ID = b.id |
| | | and b.LEVEL1_NETWORK_ID = ${level1Id} |
| | | ) b on a.id=b.id2 or a.id = b.pid2 |
| | | where a.AREA = 'hld' and a.IS_DELETE = 0 |
| | | group by a.id,a.NAME |
| | | ) a |
| | | select a.id, |
| | | case when a.pid=0 then a.NAME else ' '|| a.NAME end as name, |
| | | case when a.pid=0 then '' || a.id else ''|| a.pid || a.SORT end as sort, |
| | | sum(case when b.LEVEL3_NETWORK_ID is not null then 1 else 0 end) as sbsl, |
| | | sum(case when sbStatus = 1 then 1 else 0 end) as sbcxsl, |
| | | sum(case when zbjsl is null then 0 else zbjsl end) as zbjsl, |
| | | sum(case when zbjwcsl is null then 0 else zbjwcsl end) as zbjcxsl, |
| | | sum(case when dismantsl is null then 0 else dismantsl end) as dismantsl, |
| | | sum(case when exitsl is null then 0 else exitsl end) as exitsl, |
| | | sum(case when returnsl is null then 0 else returnsl end) as returnsl, |
| | | sum(case when warehousesl is null then 0 else warehousesl end) as warehousesl |
| | | from dj_sys_teamgroup_class a |
| | | left join ( |
| | | select a.id as id2 ,a.pid as pid2, |
| | | case when EXISTS(select 1 from dj_jdgz_dismant_track c where c.LEVEL3_NETWORK_ID=b.id |
| | | and (status=0 or status is null) and is_delete = 0) or not |
| | | EXISTS(select 1 from dj_jdgz_dismant_track c where c.LEVEL3_NETWORK_ID=b.id |
| | | and status=1 and is_delete = 0)then 0 else 1 end as status |
| | | from dj_sys_teamgroup_class a ,dj_jdgz_network_level3 b |
| | | where a.IS_DELETE= 0 and b.IS_DELETE = 0 |
| | | select a.id as id2, a.pid as pid2,c.LEVEL3_NETWORK_ID, |
| | | case when EXISTS(select 1 from dj_jdgz_dismant_track s where s.LEVEL3_NETWORK_ID=b.id and (s.status=0 or s.status is null) and s.is_delete = 0) or not EXISTS(select 1 from dj_jdgz_dismant_track s where s.LEVEL3_NETWORK_ID=b.id and s.status=1 and s.is_delete = 0) then 0 else 1 end as sbStatus, |
| | | sum(case when c.id is not null then 1 else 0 end) as zbjsl, |
| | | sum(case when c.status=1 then 1 else 0 end) as zbjwcsl, |
| | | sum(case when c.dismant_time is null then 0 else 1 end) as dismantsl, |
| | | sum(case when c.exit_time is null then 0 else 1 end) as exitsl, |
| | | sum(case when c.return_weight_time is null then 0 else 1 end) as returnsl, |
| | | sum(case when c.warehouse_time is null then 0 else 1 end) as warehousesl |
| | | from dj_sys_teamgroup_class a |
| | | left join dj_jdgz_network_level3 b on b.IS_DELETE = 0 and b.TEAMGROUP_ID = a.id |
| | | left join dj_jdgz_dismant_track c on c.is_delete = 0 and c.LEVEL3_NETWORK_ID = b.id |
| | | where a.IS_DELETE= 0 |
| | | and a.AREA = 'hld' |
| | | and b.TEAMGROUP_ID = a.id |
| | | and b.LEVEL1_NETWORK_ID = ${level1Id} |
| | | ) c on a.id=c.id2 or a.id = c.pid2 |
| | | group by a.id,a.NAME,b.id |
| | | ) b on a.id=b.id2 or a.id = b.pid2 |
| | | where a.AREA = 'hld' and a.IS_DELETE = 0 |
| | | group by a.id,a.NAME |
| | | order by sort |
| | | </select> |
| | | <select id="getStatus" resultType="java.lang.Boolean"> |
| | | SELECT CASE |
| | | WHEN NOT EXISTS ( |
| | | SELECT 1 |
| | | FROM dj_jdgz_dismant_track |
| | | WHERE LEVEL3_NETWORK_ID = ${level3NetworkId} AND (status=0 or status is null) |
| | | ) THEN TRUE |
| | | ELSE FALSE |
| | | END |
| | | </select> |
| | | <select id="getStatist2" resultType="com.example.server.progressTrack.Dto.StatistDismantDto"> |
| | | select a.id,a.name, |
| | | sum(case when b.id is not null then 1 else 0 end) as sbsl, |
| | | sum(case when sbStatus = 1 then 1 else 0 end) as sbcxsl, |
| | | sum(case when zbjsl is null then 0 else zbjsl end) as zbjsl, |
| | | sum(case when zbjwcsl is null then 0 else zbjwcsl end) as zbjcxsl, |
| | | sum(case when dismantsl is null then 0 else dismantsl end) as dismantsl, |
| | | sum(case when exitsl is null then 0 else exitsl end) as exitsl, |
| | | sum(case when returnsl is null then 0 else returnsl end) as returnsl, |
| | | sum(case when warehousesl is null then 0 else warehousesl end) as warehousesl |
| | | from cabin a |
| | | left join ( |
| | | select b.id,c.cabin_id, |
| | | case when EXISTS(select 1 from dj_jdgz_dismant_track s where s.LEVEL3_NETWORK_ID=b.id and (s.status=0 or s.status is null) and s.is_delete = 0) or not EXISTS(select 1 from dj_jdgz_dismant_track s where s.LEVEL3_NETWORK_ID=b.id and s.status=1 and s.is_delete = 0) then 0 else 1 end as sbStatus, |
| | | sum(case when c.id is not null then 1 else 0 end) as zbjsl, |
| | | sum(case when c.status=1 then 1 else 0 end) as zbjwcsl, |
| | | sum(case when c.dismant_time is null then 0 else 1 end) as dismantsl, |
| | | sum(case when c.exit_time is null then 0 else 1 end) as exitsl, |
| | | sum(case when c.return_weight_time is null then 0 else 1 end) as returnsl, |
| | | sum(case when c.warehouse_time is null then 0 else 1 end) as warehousesl |
| | | from dj_jdgz_network_level3 b |
| | | join dj_jdgz_dismant_track c on c.is_delete = 0 and c.LEVEL3_NETWORK_ID = b.id |
| | | where b.IS_DELETE = 0 |
| | | and b.LEVEL1_NETWORK_ID = ${level1Id} |
| | | and b.TEAMGROUP_ID in (select id from dj_sys_teamgroup_class where AREA = 'hld' and IS_DELETE = 0 and (id = ${id} or pid = ${id})) |
| | | group by b.id,c.cabin_id |
| | | ) b on a.id=b.cabin_id |
| | | where a.IS_DELETE = 0 |
| | | group by b.cabin_id |
| | | order by a.id |
| | | </select> |
| | | </mapper> |