from TB_RY_RYCJ,AFIS_QUALITY_CK where TB_RY_RYCJ.RYBH=AFIS_QUALITY_CK.R_RYBH(+) AND (TB_RY_RYCJ.SCBZ='0' or TB_RY_RYCJ.SCBZ is null) AND (IFHB<![CDATA[<>]]>'1' OR IFHB IS NULL)
(select name from SYS_DICTITEM where code = t.LRDWDM and GROUPID = 'CODE_UNIT') as SSDW_NAME,
(select TRUE_NAME from SYS_USER where USERNAME = ry.LRR) as IFYTHCJY
from (select LRDWDM, count(*) as ycs, max(LRSJ) as rylrsj
from tb_ry_rycj
where scbz = '0'
from (
select ry.ycs as ZWCJY_NAME,
vp.ips as ip,
NVL2(ry.RYLRSJ, ry.RYLRSJ,vp.LRSJ) as rylrsj,
vp.SSDW_NAME as SSDW_NAME,
(select TRUE_NAME from SYS_USER where USERNAME = (select s.lrr from TB_RY_RYCJ s where s.lrsj =ry.RYLRSJ and s.ip=ry.IP)) as IFYTHCJY
from (select PP.LRSJ, (select name from SYS_DICTITEM where code = pp.ssdw_code and GROUPID = 'CODE_UNIT') as SSDW_NAME, substr((select utl_raw.cast_to_varchar2(utl_encode.base64_decode(
utl_raw.cast_to_raw(utl_raw.cast_to_varchar2(
utl_encode.base64_decode(utl_raw.cast_to_raw(pp.IP)))))) as ip
from dual), 1, instr((select utl_raw.cast_to_varchar2(
utl_encode.base64_decode(
utl_raw.cast_to_raw(
utl_raw.cast_to_varchar2(
utl_encode.base64_decode(utl_raw.cast_to_raw(pp.IP)))))) as ip
from dual), '{') - 1) as ips from Sys_Client_Vp pp where pp.scbz ='0'
<iftest="ssdwcode!=null and ssdwcode !=''">
and LRDWDM like #{ssdwcode}||'%'
and pp.ssdw_code like #{ssdwcode}||'%'
</if>
group by LRDWDM) t,
TB_RY_RYCJ ry
where t.LRDWDM = ry.LRDWDM(+)
and t.rylrsj = ry.LRSJ
<iftest="sbztstr!=null and sbztstr==1">
AND t.rylrsj <![CDATA[ >= ]]> SYSDATE - 7
order by ip) vp LEFT JOIN
(select ip, count(*) as ycs, max(LRSJ) as rylrsj
from tb_ry_rycj
where scbz = '0'
and ip is not null
group by ip
) ry ON vp.IPS = ry.ip
where 1=1
<iftest="sbztstr!=null and sbztstr!='' and sbztstr==1">
AND NVL2(ry.RYLRSJ, ry.RYLRSJ,vp.LRSJ) <![CDATA[ >= ]]> SYSDATE - 7
</if>
<iftest="sbztstr!=null and sbztstr==2">
AND t.rylrsj<![CDATA[ < ]]> SYSDATE - 7
<iftest="sbztstr!=null and sbztstr!='' and sbztstr==2">
AND NVL2(ry.RYLRSJ, ry.RYLRSJ,vp.LRSJ)<![CDATA[ < ]]> SYSDATE - 7
</if>
<iftest="gxsjStr!=null and gxsjStr==1">
AND t.rylrsj <![CDATA[ >= ]]> SYSDATE - 7
<iftest="gxsjStr!=null and sbztstr!='' and gxsjStr==1">
AND NVL2(ry.RYLRSJ, ry.RYLRSJ,vp.LRSJ) <![CDATA[ >= ]]> SYSDATE - 7
</if>
<iftest="gxsjStr!=null and gxsjStr==2">
AND t.rylrsj<![CDATA[ >= ]]> SYSDATE - 30
<iftest="gxsjStr!=null and gxsjStr!='' and gxsjStr==2">
AND NVL2(ry.RYLRSJ, ry.RYLRSJ,vp.LRSJ)<![CDATA[ >= ]]> SYSDATE - 30
</if>
<iftest="gxsjStr!=null and gxsjStr==3">
AND t.rylrsj<![CDATA[ >= ]]> SYSDATE - 120
<iftest="gxsjStr!=null and gxsjStr!='' and gxsjStr==3">
AND NVL2(ry.RYLRSJ, ry.RYLRSJ,vp.LRSJ)<![CDATA[ >= ]]> SYSDATE - 120
</if>
<iftest="gxsjStr!=null and gxsjStr==4">
AND t.rylrsj<![CDATA[ >= ]]> SYSDATE - 180
<iftest="gxsjStr!=null and gxsjStr!='' and gxsjStr==4">
AND NVL2(ry.RYLRSJ, ry.RYLRSJ,vp.LRSJ)<![CDATA[ >= ]]> SYSDATE - 180