学习之:http://www.cnblogs.com/kivenhou/archive/2009/10/19/1586106.html

此为模型图:

据此写了sql语句:

drop table if exists tb_Permit_Group;

drop table if exists tb_Position_Permit;

drop table if exists tb_Position_User;

drop table if exists tb_Project_User;

drop table if exists tb_Role_Permit;

drop table if exists tb_User_Permit;

drop table if exists tb_User;

 

drop table if exists tb_Permit;

drop table if exists tb_Action;

 

drop table if exists tb_Position;

drop table if exists tb_Department;

drop table if exists tb_Company;

 

drop table if exists tb_Module;

 

drop table if exists tb_Project;

 

drop table if exists tb_Role;

 

 

/*==============================================================*/

/* Table: tb_Action                                             */

/*==============================================================*/

create table tb_Action

(

   ActionCode           varchar(20) not null,

   ActionName           varchar(20),

   ActionValue          varchar(20),

   primary key (ActionCode)

);

 

/*==============================================================*/

/* Table: tb_Company                                            */

/*==============================================================*/

create table tb_Company

(

   CompanyCode          varchar(20) not null,

   CompanyName          varchar(20),

   primary key (CompanyCode)

);

 

/*==============================================================*/

/* Table: tb_Department                                         */

/*==============================================================*/

create table tb_Department

(

   DeptCode             varchar(20) not null,

   DeptName             varchar(20),

   ParentDepartment     varchar(20),

   DepartmentDescription varchar(256),

   CompanyCode          varchar(20),

   primary key (DeptCode)

);

 

/*==============================================================*/

/* Table: tb_Module                                             */

/*==============================================================*/

create table tb_Module

(

   ModuleCode           varchar(20) not null,

   ModuleName           varchar(20),

   ModuleValue          varchar(20),

   LinkUrl              varchar(256),

   ParentModule         varchar(20),

   ModuleDescription    varchar(256),

   primary key (ModuleCode)

);

 

/*==============================================================*/

/* Table: tb_Permit                                             */

/*==============================================================*/

create table tb_Permit

(

   PermitCode           varchar(100) not null,

   ModuleCode           varchar(20),

   ActionCode           varchar(20),

   PermitValue          varchar(20),

   primary key (PermitCode)

);

 

/*==============================================================*/

/* Table: tb_Permit_Group                                       */

/*==============================================================*/

create table tb_Permit_Group

(

   GroupCode            varchar(20) not null,

   GroupName            varchar(20),

   PermitCode           varchar(100),

   primary key (GroupCode)

);

 

/*==============================================================*/

/* Table: tb_Position                                           */

/*==============================================================*/

create table tb_Position

(

   PositionCode         varchar(100) not null,

   PositionName         varchar(20),

   PositionDescription  varchar(256),

   ParentPosition       varchar(20),

   DeptCode             varchar(20),

   primary key (PositionCode)

);

 

/*==============================================================*/

/* Table: tb_Position_Permit                                    */

/*==============================================================*/

create table tb_Position_Permit

(

   PositionCode         varchar(100) not null,

   PermitCode           varchar(100),

   primary key (PositionCode)

);

 

/*==============================================================*/

/* Table: tb_Position_User                                      */

/*==============================================================*/

create table tb_Position_User

(

   PositionCode         varchar(100),

   UserId               varchar(20)

);

 

/*==============================================================*/

/* Table: tb_Project                                            */

/*==============================================================*/

create table tb_Project

(

   ProjectCode          varchar(20) not null,

   ProjectName          varchar(20),

   ParentProject        varchar(20),

   ProjectDescription   varchar(256),

   primary key (ProjectCode)

);

 

/*==============================================================*/

/* Table: tb_Project_User                                       */

/*==============================================================*/

create table tb_Project_User

(

   ProjectCode          varchar(20),

   UserId               varchar(20),

   IsLead               int

);

 

/*==============================================================*/

/* Table: tb_Role                                               */

/*==============================================================*/

create table tb_Role

(

   RoleCode             varchar(100) not null,

   RoleName             varchar(20),

   RoleDescription      varchar(256),

   primary key (RoleCode)

);

 

/*==============================================================*/

/* Table: tb_Role_Permit                                        */

/*==============================================================*/

create table tb_Role_Permit

(

   RoleCode             varchar(100) not null,

   PermitCode           varchar(100),

   primary key (RoleCode)

);

 

/*==============================================================*/

/* Table: tb_User                                               */

/*==============================================================*/

create table tb_User

(

   UserId               varchar(20) not null,

   UserName             varchar(20),

   Password             varchar(50),

   TrueName             varchar(12),

   DeptCode             varchar(20),

   primary key (UserId)

);

 

/*==============================================================*/

/* Table: tb_User_Permit                                        */

/*==============================================================*/

create table tb_User_Permit

(

   UserId               varchar(20),

   RoleCode             varchar(100),

   PositionCode         varchar(100),

   ProjectCode          varchar(20),

   PermitCode           varchar(100)

);

 

alter table tb_Department add constraint FK_Reference_5 foreign key (CompanyCode)

      references tb_Company (CompanyCode) on delete restrict on update restrict;

 

alter table tb_Permit add constraint FK_Reference_3 foreign key (ModuleCode)

      references tb_Module (ModuleCode) on delete restrict on update restrict;

 

alter table tb_Permit add constraint FK_Reference_4 foreign key (ActionCode)

      references tb_Action (ActionCode) on delete restrict on update restrict;

 

alter table tb_Permit_Group add constraint FK_Reference_18 foreign key (PermitCode)

      references tb_Permit (PermitCode) on delete restrict on update restrict;

 

alter table tb_Position add constraint FK_Reference_21 foreign key (DeptCode)

      references tb_Department (DeptCode) on delete restrict on update restrict;

 

alter table tb_Position_Permit add constraint FK_Reference_19 foreign key (PermitCode)

      references tb_Permit (PermitCode) on delete restrict on update restrict;

 

alter table tb_Position_Permit add constraint FK_Reference_9 foreign key (PositionCode)

      references tb_Position (PositionCode) on delete restrict on update restrict;

 

alter table tb_Position_User add constraint FK_Reference_11 foreign key (PositionCode)

      references tb_Position (PositionCode) on delete restrict on update restrict;

 

alter table tb_Position_User add constraint FK_Reference_6 foreign key (UserId)

      references tb_User (UserId) on delete restrict on update restrict;

 

alter table tb_Project_User add constraint FK_Reference_22 foreign key (ProjectCode)

      references tb_Project (ProjectCode) on delete restrict on update restrict;

 

alter table tb_Project_User add constraint FK_Reference_23 foreign key (UserId)

      references tb_User (UserId) on delete restrict on update restrict;

 

alter table tb_Role_Permit add constraint FK_Reference_1 foreign key (RoleCode)

      references tb_Role (RoleCode) on delete restrict on update restrict;

 

alter table tb_Role_Permit add constraint FK_Reference_17 foreign key (PermitCode)

      references tb_Permit (PermitCode) on delete restrict on update restrict;

 

alter table tb_User add constraint FK_Reference_20 foreign key (DeptCode)

      references tb_Department (DeptCode) on delete restrict on update restrict;

 

alter table tb_User_Permit add constraint FK_Reference_12 foreign key (UserId)

      references tb_User (UserId) on delete restrict on update restrict;

 

alter table tb_User_Permit add constraint FK_Reference_13 foreign key (RoleCode)

      references tb_Role (RoleCode) on delete restrict on update restrict;

 

alter table tb_User_Permit add constraint FK_Reference_14 foreign key (PositionCode)

      references tb_Position (PositionCode) on delete restrict on update restrict;

 

alter table tb_User_Permit add constraint FK_Reference_15 foreign key (ProjectCode)

      references tb_Project (ProjectCode) on delete restrict on update restrict;

 

alter table tb_User_Permit add constraint FK_Reference_16 foreign key (PermitCode)

      references tb_Permit (PermitCode) on delete restrict on update restrict;

OA系统权限管理设计方案学习的更多相关文章

  1. OA系统权限管理设计方案

    (转)OA系统权限管理设计方案 OA系统权限管理设计方案     不同职责的人员,对于系统操作的权限应该是不同的.优秀的业务系统,这是最基本的功能.     可以对“组”进行权限分配.对于一个大企业的 ...

  2. OA系统权限管理设计方案【转】

    l 不同职责的人员,对于系统操作的权限应该是不同的.优秀的业务系统,这是最基本的功能. l 可以对“组”进行权限分配.对于一个大企业的业务系统来说,如果要求管理员为其下员工逐一分配系统操作权限的话,是 ...

  3. OA系统权限管理设计(转载)

    不论什么系统都离不开权限的管理,有一个好的权限管理模块,不仅使我们的系统操作自如,管理方便,也为系统加入亮点. l         不同职责的人员,对于系统操作的权限应该是不同的.优秀的业务系统,这是 ...

  4. OA系统 权限管理的设计流程

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/u013630349/article/det ...

  5. Android权限管理知识学习记录

    一.Android权限背景知识 在Android 6.0之前,所申请的权限只需要在AndroidManifest.xml列举就可以了,从而容易导致一些安全隐患,因此,在Android 6.0时,Goo ...

  6. OA(权限管理初步模块)

    权限管理:一般指根据系统设置的安全规则或者安全策略,用户可以访问而且只能访问自己被授权的资源,不多不少.权限管理几乎出现在任何系统里面,只要有用户和密码的系统. 根据权限管理的套路,我们一般从这三个角 ...

  7. 潭州课堂25班:Ph201805201 django框架 第十三课 自定义404页面,auth系统中的User模型,auth系统权限管理 (课堂笔记)

    当 DEBUG=True 时,django 内部的404报错信息, 自带的报错信息, 要自定义404信息,要先把 DEBUG=False , 之后要自定义4040页面,有两种方法, 方法1,在创建40 ...

  8. 使用shiro做权限管理的学习笔记整理

    Shiro权限管理 参考:https://www.cnblogs.com/jpfss/p/8352031.html Shiro解决的问题 授权和鉴别的问题:Authenrization(授权) Aut ...

  9. 2018/09/05《涂抹MySQL》【权限管理】学习笔记(二)

    读 第四章<管理MySQL库与表> 第五章<MySQL的权限管理> 总结 1:当配置好 MySQL 数据库后,发现有几个默认的库,他们的意义和作用?(这里只做简单了解,之后用到 ...

随机推荐

  1. FBReader移植日记 第一天

    1.目标是创建两个工程,一个j2se的桌面软件,用于编辑和预览epub等格式的电子书,预览的窗口可以设置分辨率来模拟不同的设备,把编辑的结果实时的显示出来.另一个是Android的应用,用于阅读,管理 ...

  2. HDU 3480 Division(斜率优化+二维DP)

    Division Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 999999/400000 K (Java/Others) Tota ...

  3. php写excel

    $this->loadexcel();        $objPHPExcel = new PHPExcel();        $objPHPExcel->getProperties() ...

  4. CentOS添加swap分区

    在多个VPS上尝试. 1.进入目录 cd /var/ 2.获取要增加的SWAP文件块(这里以1GB为例) dd if=/dev/zero of=swapfile bs=1024 count=10383 ...

  5. Django中的cookie与session

    cookie与session的实现原理 HTTP被设计为”无状态”,每次请求都处于相同的空间中. 在一次请求和下一次请求之间没有任何状态保持,我们无法根据请求的任何方面(IP地址,用户代理等)来识别来 ...

  6. [置顶] 提高生产力:开源Java工具包Jodd(Java的”瑞士军刀”)

    官方网站:http://jodd.org/ 下载地址:http://jodd.org/download/index.html Jodd=tools + ioc + mvc + db + aop + t ...

  7. OfficePickers

    OfficePickers http://www.codeproject.com/Articles/12327/Office-2003-Color-Picker     来自为知笔记(Wiz) 附件列 ...

  8. leetcode-1 Two Sum 找到数组中两数字和为指定和

     问题描写叙述:在一个数组(无序)中高速找出两个数字,使得两个数字之和等于一个给定的值.如果数组中肯定存在至少一组满足要求. <剑指Offer>P214(有序数组) <编程之美& ...

  9. linux 内存管理大图

  10. Qt c++11

    借助 Qt 5 的信号槽语法,我们可以将一个对象的信号连接到 Lambda 表达式,例如:     1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // !!! Q ...