Permission table (permission) 10
Field name |
Type |
Constraints |
Describe |
AuthorityID |
Integer |
Pk NOT NULL |
Permission Serial ID PK |
Usernameid |
Int |
NOT NULL |
User name ID FK |
FunctionID |
Integer |
NOT NULL |
function ID FK |
Lookpermission |
Int |
NOT NULL |
Browse |
Addpermission |
Int |
NOT NULL |
Add to |
Editpermission |
Int |
NOT NULL |
Edit |
DeletePermission |
Int |
NOT NULL |
Delete |
Checkpermission |
Int |
NOT NULL |
Audit |
Againstrcheckpermission |
Int |
NOT NULL |
Anti-Audit |
Statementpermission |
Int |
NOT NULL |
Report |
Function Module table (functioncomponents) 3
Field name |
Type |
Constraints |
Module Name Description |
Functioncpid |
Integer |
Pk |
function ID PK |
Fundescribe |
Varchar (100) |
NOT NULL |
Module name |
Otherinfo |
Varchar (500) |
NOT NULL |
Note |
User table (UserInfo)
Field name |
Type |
Constraints |
Describe |
Userno |
Integer |
Pk NOT NULL |
Permission Serial ID PK |
UserName |
VARCHAR2 (20) |
NOT NULL |
User name ID FK |
Userpwd |
VARCHAR2 (20) |
NOT NULL |
Browse |
Role |
VARCHAR2 (20) |
NOT NULL |
Browse |
To query the permissions of a user's corresponding function
At first, I was using a subquery, not implemented
Select Userno, Userinfo.username, Userinfo.userpwd, Fundescribe, Lookpermission, Addpermission, EditPermission, DeletePermission, Checkpermission, Againstrcheckpermission, statementpermission from UserInfo, permission, Functioncomponents
Switch
Select Userno, Userinfo.username, Userinfo.userpwd, Fundescribe, Lookpermission, Addpermission, EditPermission, DeletePermission, Checkpermission, Againstrcheckpermission, statementpermission from UserInfo, permission, Functioncomponents GROUP BY Userno
The same is true!
After that, the three tables are connected in a query
Create View ' userfunpermission ' as
Select Userno, Userinfo.username, Userinfo.userpwd, Fundescribe, Lookpermission, Addpermission, EditPermission, DeletePermission, Checkpermission, Againstrcheckpermission, statementpermission from UserInfo, permission, Functioncomponents
OK!
MySQL Three table connection query