学习之: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. HDU 4720 Naive and Silly Muggles 2013年四川省赛题

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4720 题目大意:给你四个点,用前三个点绘制一个最小的圆,而这三个点必须在圆上或者在圆内,判断最一个点如 ...

  2. centos6.5建立cloudera-cdh4.6本地源

    1.准备:      centos6.5系统,root用户 2.安装所需包:      sudo yum install yum-utils createrepo 3.下载cdh4.6的repo:   ...

  3. Google桌面搜索引擎

    本博文的主要内容有 .Google桌面搜索引擎的下载 .Google桌面搜索引擎的安装 .Google桌面搜索引擎的使用 1.Google桌面搜索引擎的下载   http://download.csd ...

  4. Sencha Touch 的基础知识

    基础知识 一.要注意书写,一个字母就会让你代码跑不起来Ext.setup({ icon:'icon.png', glossOnIcon:false, tabletStartupScreen:'talb ...

  5. css 权威指南笔记(四)选择器

    规则结构 每个规则都有两个基本部分组成:选择器和声明块.声明块由一个或多个声明组成,每个声明则是一个属性-值对. 元素选择器 声明和关键字 关键字一般由空格隔开:有一种情况例外 font属性中的  斜 ...

  6. Java NIO 学习笔记

    为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处.LaplaceDemon/SJQ. http://www.cnblogs.com/shijiaqi1066/p/3344148.html ...

  7. GET和POST本质上有什么区别

    如果有人问你,GET和POST,有什么区别?你会如何回答? 我的经历 前几天有人问我这个问题.我说GET是用于获取数据的,POST,一般用于将数据发给服务器之用. 这个答案好像并不是他想要的.于是他继 ...

  8. 一道阿里面试题(js)

    写一个求和的函数sum,达到下面的效果 // Should equal 15 sum(1, 2, 3, 4, 5); //Should equal 0 sum(5, 'abc', -5); //Sho ...

  9. jquery生产和开发的区别

    今天说一下jquery生产和开发的区别,在我们下载jquery的时候,会有两个下载链接,一个是jquery.min.js .迷你版 (生产),另一个是 jquery.js .开发版 .不知道的人可能就 ...

  10. C# - Sql数据类型的对应关系

    <Language From="SQL" To="C#"> <Type From="bigint" To="lo ...