帮帮忙!有人知道为什么按finedb表结构那样去连,一些用户查出的权限是0行吗

目的:在数据库查用户-部门-权限

效果参考权限导出插件的效果。

背景:但:1、权限导出插件——每次需手动导出excel去进一步查询

且服务器数据集因数据量大与不能编辑sql没法直接使用

2、帮助文档中的用户权限查询,不能查出完整、全部正确的权限

--并不是所有用户的roleId在权限表《fine_authority》中都能找到对应.....

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

https://help.fanruan.com/finereport/doc-view-3151.html 

前面不是有人提供了SQL么?

帆软数据库字典就这样了  自己凑吧

  • yzm827631 yzm827631(提问者) 参考了一些社区帮助提供的sql ,不管咋连总有人连不出权限,您能帮看看吗 SELECT A.userName as 账号,A.[姓名],A.[角色],A.[部门], B.AUTHORITYTYPE as 权限类型, B.[类型],B.displayName as 表名, B.[权限目录类型],B.[适用平台] FROM ( select u.id 用户ID, u.userName , u.realName 姓名, rc.id 角色ID, rc.name 角色 , rd.id 部门ID, d.name 部门 from fine_user u left join fine_user_role_middle rm on u.id = rm.userId left join fine_custom_role rc on rm.roleType = 2 and rm.roleId = rc.id left join fine_dep_role rd on rm.roleType = 1 and rm.roleId = rd.id left join fine_department d on d.id = rd.departmentId left join fine_post p on p.id=rd.postId --where u.userName = \'040721\' ) A LEFT JOIN ( select f.roleId, case when f.authorityType = \'1\' then \'查看权限\' when f.authorityType = \'2\' then \'授权权限\' when f.authorityType = \'3\' then \'编辑权限\' when f.authorityType = \'4\' then \'数据连接管理权限\' when f.authorityType = \'101\' then \'FineReport 模板认证权限\' when f.authorityType = \'102\' then \'FineReport 模板查看权限\' when f.authorityType = \'103\' then \'FineReport 模板填报权限\' when f.authorityType = \'201\' then \'业务包使用权限\' when f.authorityType = \'202\' then \'业务包管理权限\' when f.authorityType = \'203\' then \'BI报表导出权限\' when f.authorityType = \'204\' then \'BI仪表板分享权限\' when f.authorityType = \'205\' then \'BI模板认证权限\' when f.authorityType = \'206\' then \'BI模板查看权限\' when f.authorityType = \'207\' then \'BI模板导出权限\' when f.authorityType = \'208\' then \'BI仪表板分享角色控制权限\' when f.authorityType = \'209\' then \'BI仪表板分享功能权限\' when f.authorityType = \'210\' then \'BI仪表板公共链接功能权限\' end AUTHORITYTYPE, case when f.roleType = \'1\' then \'部门\' when f.roleType = \'2\' then \'角色\' when f.roleType = \'3\' then \'用户\' when f.roleType = \'4\' then \'职务\' end 类型, a.id, a.displayName , a.sortIndex, a.parentId PARENTID0, b.parentId PARENTID1, c.parentId PARENTID2, d.parentId PARENTID3, e.parentId PARENTID4, case when a.expandType = \'1\' then \'平台管理系统节点\' when a.expandType = \'2\' then \'首页\' when a.expandType = \'3\' then \'目录\' when a.expandType = \'5\' then \'链接\' when a.expandType = \'6\' then \'文件\' when a.expandType = \'101\' then \'上报流程\' when a.expandType = \'102\' then \' FineReport报表\' when a.expandType = \'201\' then \' BI报表\' end 权限目录类型, case when a.deviceType = \'0\' then \'未勾选 \' when a.deviceType = \'1\' then \'PC \' when a.deviceType = \'2\' then \'平板 \' when a.deviceType = \'3\' then \'PC、平板 \' when a.deviceType = \'4\' then \'手机 \' when a.deviceType = \'5\' then \'PC、手机 \' when a.deviceType = \'6\' then \'平板、手机 \' when a.deviceType = \'7\' then \'PC 、平板、手机 \' end 适用平台, a.sortIndex 排序顺序 from fine_authority_object a left join fine_authority_object b on a.parentId = b.id left join fine_authority_object c on b.parentId = c.id left join fine_authority_object d on c.parentId = d.id left join fine_authority_object e on d.parentId = e.id left join fine_authority f on f.authority = 2 and (a.id = f.authorityEntityId or a.parentId = f.authorityEntityId or b.parentId = f.authorityEntityId or c.parentId = f.authorityEntityId or d.parentId = f.authorityEntityId ) where not exists (select 1 from fine_authority f1 where f1.authority = 1 and (a.id = f1.authorityEntityId or a.parentId = f1.authorityEntityId or b.parentId = f1.authorityEntityId or c.parentId = f1.authorityEntityId or d.parentId = f1.authorityEntityId or e.parentId = f1.authorityEntityId) and f.roleId = f1.roleId and f.authorityType = f1.authorityType) -- and f.roleid=\'old-platform-custom-1\' --order by a.parentId,a.sortIndex ) B ON A.用户ID = B.roleId OR A.角色ID = B.roleId OR A.部门ID = B.roleId where --B.displayName like \'%投入产出率%\' A.userName =\'064860\'
    2022-07-19 17:24 
  • Z4u3z1 Z4u3z1 回复 yzm827631(提问者) 它 的基表是 fine_authority_object 这个记录的是 权限实体表,记录当前目录(不包含该目录下的模板及子目录)权限的对象、目录名称、报表名称。首先它得有目录权限才关联得出其它的权限。你改成你需要的基表呗。PS:下班......
    2022-07-19 17:31 
  • yzm827631 yzm827631(提问者) 回复 Z4u3z1 栓q!
    2022-07-20 08:12 
  • 1关注人数
  • 257浏览人数
  • 最后回答于:2022-7-19 17:20
    请选择关闭问题的原因
    确定 取消
    返回顶部