snowzl(提问者)最后3个条件参照您给的已经设置后,权限没有实现隔离,请问是哪里不对么?
select t0.* from
(select distinct(t.recno), MAIN_PROJECT_NO,
PROJECTNAME,PROJECT_TYPE,PROJECT_LEVEL,owning_user,PROPOSAL_PER as 项目负责人,DEPARTMENT_BUSINESS as 事业部,APP_UNIT,STATUS,CURRENT_PHASE,CURRENT_PHASE_STATUS,DEVELOPCYCLE,RUN_DAYS,FACT_DAYS,SELF_CHECK,industry,CREATEDATE,
(case when t.MAIN_PROJECT_NO=\'—\' then \'总项目\'
else \'子项目\' end ) as 总子项目,
(SELECT owning_user FROM t_if_project_app A
WHERE MAIN_PROJECT_NO=\'—\'AND A.recno=SUBSTR(t.recno,1,7)) as 总项目负责人
from T_IF_PROJECT_APP t) t0
where 1=1
${if(len(项目编码) == 0,\"\",\"and t0.recno in (\'\" + 项目编码 + \"\')\")}
${if(len(项目名称) == 0,\"\",\"and t0.PROJECTNAME = \'\" + 项目名称 + \"\'\")}
${if(len(状态) == 0,\"\",\"and t0.STATUS = \'\" + 状态 + \"\'\")}
${if(len(项目分类) == 0,\"\",\"and t0.PROJECT_TYPE = \'\" + 项目分类 + \"\'\")}
and TO_DATE(t0.CREATEDATE, \'yyyy-MM-dd\')>= TO_DATE(\'${开始日期}\', \'yyyy-MM-dd\')
and TO_DATE(t0.CREATEDATE, \'yyyy-MM-dd\')<= TO_DATE(\'${结束日期}\', \'yyyy-MM-dd\')
and t0.industry = \'光电\'
or t0.项目负责人=\'${fine_username}\'
OR t0.总项目负责人=\'${fine_username}\'
OR t0.事业部 in
(select t2.low as 权限low值
from T_PLM_FINE_USER t1,t_plm_fine_role t2
where t1.role=t2.role_id
and t2.MOD=\'PROJECT_APP\'
and t2.FIELD=\'BUSINESS\'
and t1.user_id =\'${fine_username}\')
snowzl(提问者)我这个和帮助手册中的外部权限表实现数据权限过滤类似:https://help.fanruan.com/finereport/doc-view-3040.html,只是我不知道oracle数据库要如何在where后面添加多种case when的判断条件来实现,请问以下这种写法问题出在哪儿呢(判断事业部领导可查看的数据)?
${if((select count(1) from T_PLM_FINE_USER t1,t_plm_fine_role t2
where t1.role=t2.role_id
and t2.MOD=\'PROJECT_APP\'
and t2.FIELD=\'BUSINESS\'
and t1.user_name =\'${fine_username}\')==0,\"\",\"and t0.事业部 in (\'\" + select t2.low as 权限LOW值
from T_PLM_FINE_USER t1,t_plm_fine_role t2
where t1.role=t2.role_id
and t2.MOD=\'PROJECT_APP\'
and t2.FIELD=\'BUSINESS\'
and t1.user_id =\'${fine_username}\' + \"\')\")}