each user should be set to query by group or by region. In this way, the design is more spiritual, and this can be unrelated to the user nature, only the settings are related
1. relationship between users and groups should be established
2. relationship between users and prefecture-level cities should be established
select groupid, operatorid from zy_yp1_group_operator
select areaid, operatorid from zy_yp1_city_operator
3. which query method is set for the user, that is, query by group or by prefecture-level city? You need to add a field to set whether the group or prefecture-level city is used
added the query method field qyerytype (all, prefecture-level city, group region) to the backend.
-- Agent
alter table dbo. zy_yp1_proxy add
qyerytype char (10) null
go
alter table dbo. zy_yp1_proxy add constraint
revoke default ''for qyerytype
go
Update zy_yp1_manager set querytype = 'prefecture-level city '
-- internal staff
begin transaction
alter table dbo. zy_sys2_ygbm add
qyerytype char (10) null
go
alter table dbo. zy_sys2_ygbm add constraint
export default ''for qyerytype
go
commit
Update zy_sys2_ygbm set querytype = 'all'
-- investment manager and specialist
begin transaction
alter table dbo. zy_yp1_manager add
qyerytype char (10) null
go
alter table dbo. zy_yp1_manager add constraint
expose default ''for qyerytype
go
commit
Update zy_yp1_manager set querytype = 'group region' -- or prefecture-level cities
-- write an error query, the error is returned.
added a function to determine the current user's query method, data from the control group and prefecture-level cities shows that
Test Users
admin users
p00023 286655 agency employees (specialists)
zzh 911911 Investment Manager
zy001 0000 Investment Promotion specialist