存储过程数据集如何实现权限控制

如题,存储过程数据集如何实现动态权限控制,如数据集的参数的下面参数如何在存储过程实现

${if(fine_role="superusers","",if(sql("dcresult","select count(fr_roles_id) from dim_user_roles ro where ro.fr_roles_id=1 and ro.user_fr_name='"+fine_username+"'",1,1)<>0," and (t.dept_id in(

         select d1.dept_id from dim_dept d1 where d1.dept_id in(

      select du.pk_dept from DIM_PERMISSION_USER_DEPT du where du.user_code='"+fine_username+"')) or  t.employees_id=(select ps.pk_psndoc from dim_psn ps where  ps.user_code='"+fine_username+"'))"," and t.employees_id in (select ro.employ_id from dim_user_roles ro where  ro.user_fr_name='"+fine_username+"')"))}

${if(len(startDate)=0,"", " and t.cal_bill_date>='"+startDate+"'")}

${if(len(endDate)=0,"", " and t.cal_bill_date <='"+endDate+"'")}

FineReport ss2021 发布于 2022-11-29 16:34
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
0
Z4u3z1Lv6专家互助
发布于2022-11-29 16:39

存储过程中传入  fine_role,startDate,endDate

然后 根据 select count(fr_roles_id) from dim_user_roles ro where ro.fr_roles_id=1 and ro.user_fr_name='"+fine_username+"' 这个的值拼接后面的SQL就对了

  • ss2021 ss2021(提问者) 如果参数有很多,过程里面的sql也很长,要拼sql的话就得把sql用变量先接收吧, 这样拼下去有点不能接受啊
    2022-11-29 16:42 
  • Z4u3z1 Z4u3z1 回复 ss2021(提问者) 慢慢找个中间点吧,有得必有失
    2022-11-29 16:49 
  • 1关注人数
  • 355浏览人数
  • 最后回答于:2022-11-29 16:39
    请选择关闭问题的原因
    确定 取消
    返回顶部