学习之: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. yarn安装部署

    在HDFS HA(http://www.cnblogs.com/yinchengzhe/p/5140117.html)基础上进行yarn的安装. 1.配置yarn-site.xml 参数详情参考 ht ...

  2. Android学习笔记(一)Android应用程序的组成部分

    Android应用程序由松散耦合的组件组成,并使用应用程序Manifest绑定到一起:应用程序Manifest描述了每一组件和它们之间的交互方式,还用于指定应用程序元数据.其硬件和平台要求.外部库以及 ...

  3. HTML Meta, http-equiv, Refresh

    原文: http://www.lifelaf.com/blog/?p=481 在HTML页面中,如果想实现定时刷新或重定向,我们可以使用meta标签的refresh功能: <!-- 5秒后刷新页 ...

  4. poj 2288 tsp经典问题

    题目链接:http://poj.org/problem?id=2288 #include<cstdio> #include<cstring> #include<iostr ...

  5. Hibernate输出SQL语句以便调试

    配置方法:1.打开hibernate.cfg.xml文件编辑界面,在Properties窗口处,点击Add按钮,选择Show_SQL参数,输入值为True. *另外,如果按照同样的步骤,分别加入以下参 ...

  6. winform 窗体关闭按钮禁用、不显示最大化、最小化、关闭按钮 分类: WinForm 2014-12-22 16:09 82人阅读 评论(0) 收藏

    关闭按钮禁用: (1) FormClosing事件 private void Main_FormClosing(object sender, FormClosingEventArgs e) {     ...

  7. linux操作系统cron详解

    Linux操作系统定时任务系统 Cron 入门 cron是一个linux下的定时执行工具,可以在无需人工干预的情况下运行作业.由于Cron 是Linux的内置服务,但它不自动起来,可以用以下的方法启动 ...

  8. dispatch_get_current_queue 废弃

    由于iOS7以后 dispatch_get_current_queue 被废弃,所以需要寻找一个替代的方案. 发现 dispatch_get_current_queue 并没有字面上那么简单. 这个函 ...

  9. mac下versions 提交提示 SVN Working Copy xxx locked

    终端进入工程目录,执行 find . | grep ".svn/lock" | xargs rm

  10. EXCEL 如何将多个工作表或工作簿合并到一个工作表

    在使用Excel 时,我们经常需要将多个工作表或工作簿合并到一个工作表中,这样我们就能快速地对数据进行分析和统计.对于一般用户而言,除了复制每个工作表后再粘贴,没有其他什么方法了.如果只是合并少数几个 ...