select T3.REALNAME AS 姓名, T3.USERNAME AS 用户名, T5.ID AS 角色ID, T5.NAME AS 角色名称, T6.PATH AS 报表链接路径, T6.ID AS 报表预览ID FROM FINE_USER t3 --用户表 LEFT JOIN FINE_USER_ROLE_MIDDLE T4 ON T3.ID = T4.USERID AND T4.ROLETYPE=2 -- 用户角色中间表 LEFT JOIN FINE_CUSTOM_ROLE T5 ON T4.ROLEID = T5.ID --角色表 LEFT JOIN ( select T1.ROLEID, --角色ID T2.PATH, --报表链接路径, T2.ID --报表预览ID FROM FINE_AUTHORITY T1 --权限表 LEFT JOIN FINE_AUTHORITY_OBJECT T2 ON T1.AUTHORITYENTITYID = T2.ID --权限实体表 ) T6 ON T6.ROLEID = T4.ROLEID WHERE T3.REALNAME='XXX' ORDER BY T3.ID 上述是SQL,得出的数据感觉不对,测试过几个用户,得出的数据有遗失 |