自定义权限控制模板实现
不同步业务系统的权限,从帆软填报实现数据权限控制
1.把数据权限按类型分类填报
2. 新增具体的角色选择类别
3.给角色授权组织和部门权限
4.往角色里面添加对应的人员
5.在帆软模板使用的时候拼接sql
${if(fine_role="superusers","",if(SQL("dcresult"," select rt.role_permission from DIM_FIN_USER_ROLES fr
left join dim_fin_roles_permission_org fp on fp.fin_role_id=fr.fin_user_role
left join dim_fin_roles ro on ro.fin_role_id=fr.fin_user_role
left join dim_fin_roles_type rt on rt.role_type_id=ro.role_type_id
where fr.fin_user_code='"+fine_username+"'",1,1)='0',"",if(SQL("dcresult"," select rt.role_permission from DIM_FIN_USER_ROLES fr
left join dim_fin_roles_permission_org fp on fp.fin_role_id=fr.fin_user_role
left join dim_fin_roles ro on ro.fin_role_id=fr.fin_user_role
left join dim_fin_roles_type rt on rt.role_type_id=ro.role_type_id
where fr.fin_user_code='"+fine_username+"'",1,1)='1'," and t.dept_id in (select du.pk_dept from DIM_PERMISSION_USER_DEPT du where du.user_code='"+fine_username+"') "," and (t.corp_code in ('"+SUBSTITUTE(sql("dcresult"," select fp.fin_org_code from DIM_FIN_USER_ROLES fr
left join dim_fin_roles_permission_org fp on fp.fin_role_id=fr.fin_user_role
where fr.fin_user_code ='"+fine_username+"'",1,null),",","','")+"') or
regexp_like(t.dept_name,'("+SUBSTITUTE(SQL("dcresult"," select fp.remark from DIM_FIN_USER_ROLES fr
left join dim_fin_roles_permission_org fp on fp.fin_role_id=fr.fin_user_role
left join dim_fin_roles ro on ro.fin_role_id=fr.fin_user_role
left join dim_fin_roles_type rt on rt.role_type_id=ro.role_type_id
where fr.fin_user_code='"+fine_username+"'",1,null),",","|")+")')
)"
)))}