本帖最后由 橘猫今天喝水了吗 于 2024-12-23 11:13 编辑
实际情况中,各个公司的数据都是独立展示的,因此只需要给每个账号对应的角色,对应的角色分配对应的资源即可,可参考1楼的答案。
标准的用户角色权控制,需要40个角色,分别是20个公司的20个会计角色,20个出纳角色,然后对应角色授权对应资源。再将各个角色按需分配给账号即可。
如果你的所有公司的数据都在一张表,使用标准的角色权限控制是不能实现的,使用非常规手段,则需要你在数据集中进行判断,
select * from 出纳数据表 as t
where
current_用户='A' and t.公司id between 1 and 10
or
current_用户='B' and t.公司id between 11 and 20
select * from 会计数据表 as t
where
current_用户='A' and t.公司id between 11 and 20
or
current_用户='B' and t.公司id between 1 and 10
如果出纳和会计的数据也在同一张表
那你就在条件中加上数据类型判断。
select * from 出纳_会计数据表 as t
where
current_用户='A' and t.公司id between 1 and 10 and t.数据类型 ='出纳数据'
or
current_用户='B' and t.公司id between 11 and 20 and t.数据类型 ='出纳数据'
or
current_用户='A' and t.公司id between 11 and 20 and t.数据类型 ='会计数据'
or
current_用户='B' and t.公司id between 1 and 10 and t.数据类型 ='会计数据' |