OA 办公系统 模块设计

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
--连接主数据库
use Master
go
 
--如果数据库simpleoa 存在,则先删除simpleoa。
if exists (select * from sysdatabases where name='simpleoa')
drop database  simpleoa
go
 
--创建simpleoa数据库
create database simpleoa
go
 
--
use simpleoa
go
 
--创建用户表
create table [dbo].[User]
(
    [UserID]        int     Identity(1,1) not null,--用户ID
    [UserLoginName] nvarchar(20)    not null,       --用户登录名
    [UserName]  nvarchar(20)    not null,       --用户姓名
    [UserPassword]  nvarchar(20)    not null,       --用户密码
    [UserRegister]  nvarchar(20)    default getdate(),  --用户注册时间
    [UserUp]        bit     default 'true', --是否需要上交
    [UserInfo]      nvarchar(200)   not null        --备注        --
)
alter table [dbo].[User] add constraint pk_user primary key(UserID);
go
 
 
--创建部门表
create table [dbo].[Department]
(
    [DepartmentID]  [int]       identity(1,1)   not null,   --部门ID
    [DepartmentNum] [nvarchar](20)  not null,       --部门编号
    [DepartmentName]    [nvarchar](20)  not null,       --部门名称
    [UserID]        [int]                   not null,   --部门负责人ID
    [DepartmentInfo]    [nvarchar](200) not null        --部门备注
)
alter table [dbo].[Department] add constraint pk_department primary key(DepartmentID);
go
--添加外键约束
--alter table Department add constraint dep_ref_use foreign key(UserID) references [dbo].[User](UserID)
--go
 
--创建消息表
create table [dbo].[Message]
(
    [MessageID] [int]       identity(1,1) not null, --消息ID
    [MessageSender] [int]       not null,       --外键
    [MessageSubject]    [nvarchar](50)  default getdate(),  --消息主题
    [MessageBody]   [nvarchar](500) not null,       --消息内容
    [MessageDataTime]   [datetime]      default getdate(),  --发送消息时间
    [MessageAttachment] [bit]   default 'false' --是否含有附件
)
alter table [dbo].[Message] add constraint pk_MessageID primary key (MessageID);
go
--消息接收人表:
create table [dbo].[Recipient]
(
    [RecipientID]   [int]       identity(1,1) not null, --接收人ID
    [MessageID] [int]       not null,       --外键
    [RecipientRead] [bit]       not null,       --是否读过
    [RecipientDel]  [bit]       not null,       --是否删除(显示在已删除消息栏)
    [RecipientReadTime] [nvarchar](20)  default '尚未阅读', --客户要求能看到接收人是否已经看过。
    [RecipientDelTime]  [nvarchar](20)  default '尚未删除', --储存删除消息时间
    [RecipientAllDel]   [nvarchar](20)  default '尚未彻底删除'--不再显示在已删除消息栏
)
alter table [dbo].[Recipient] add constraint pk_recipient primary key(RecipientID);
go
--附件表
create table [dbo].[Attachment]
(
    AttachmentID    [int]       identity(1,1),  --附件ID
    AttachmentName  [nvarchar](50)  not null,       --附件名称
    AttachmentFilePath  [nvarchar](100) not null,       --附件存放类型
    AttachmentType  [nvarchar](20)  not null,       --附件文件类型
    AttachmentDateTime  [datetime]      not null,   --附件上传时间
    AttachmentSource        [nvarchar](20)  not null,   --附件来源:消息、文章、上交?
    AttachmentSourceID  [int]       not null,   --附件来源ID
)
alter table [dbo].[Attachment] add constraint pk_Attachment primary key(AttachmentID)
go
 
--每月上传时间表
create table [dbo].[Time]
(
    TimeID      [int]       identity(1,1),  --表时间ID
    TimeName    [nvarchar](20)  not null,       --时间变量名
    TimeContent [datetime]      default getdate()   --时间变量值
)
alter table [dbo].[Time] add constraint pk_timeid primary key(TimeID)
go
代码
--连接主数据库
use Master
go

--如果数据库simpleoa 存在,则先删除simpleoa。
if exists (select * from sysdatabases where name='simpleoa')
drop database simpleoa
go

--创建simpleoa数据库
create database simpleoa
go

--
use simpleoa
go

--创建用户表
create table [dbo].[User]
(
[UserID] int Identity(1,1) not null,--用户ID
[UserLoginName] nvarchar(20) not null, --用户登录名
[UserName] nvarchar(20) not null, --用户姓名
[UserPassword] nvarchar(20) not null, --用户密码
[UserRegister] nvarchar(20) default getdate(), --用户注册时间
[UserUp] bit default 'true', --是否需要上交
[UserInfo] nvarchar(200) not null --备注 --
)
alter table [dbo].[User] add constraint pk_user primary key(UserID);
go


--创建部门表
create table [dbo].[Department]
(
[DepartmentID] [int] identity(1,1) not null, --部门ID
[DepartmentNum] [nvarchar](20) not null, --部门编号
[DepartmentName] [nvarchar](20) not null, --部门名称
[UserID] [int] not null, --部门负责人ID
[DepartmentInfo] [nvarchar](200) not null --部门备注
)
alter table [dbo].[Department] add constraint pk_department primary key(DepartmentID);
go
--添加外键约束
--
alter table Department add constraint dep_ref_use foreign key(UserID) references [dbo].[User](UserID)
--
go

--创建消息表
create table [dbo].[Message]
(
[MessageID] [int] identity(1,1) not null, --消息ID
[MessageSender] [int] not null, --外键
[MessageSubject] [nvarchar](50) default getdate(), --消息主题
[MessageBody] [nvarchar](500) not null, --消息内容
[MessageDataTime] [datetime] default getdate(), --发送消息时间
[MessageAttachment] [bit] default 'false' --是否含有附件
)
alter table [dbo].[Message] add constraint pk_MessageID primary key (MessageID);
go
--消息接收人表:
create table [dbo].[Recipient]
(
[RecipientID] [int] identity(1,1) not null, --接收人ID
[MessageID] [int] not null, --外键
[RecipientRead] [bit] not null, --是否读过
[RecipientDel] [bit] not null, --是否删除(显示在已删除消息栏)
[RecipientReadTime] [nvarchar](20) default '尚未阅读', --客户要求能看到接收人是否已经看过。
[RecipientDelTime] [nvarchar](20) default '尚未删除', --储存删除消息时间
[RecipientAllDel] [nvarchar](20) default '尚未彻底删除'--不再显示在已删除消息栏
)
alter table [dbo].[Recipient] add constraint pk_recipient primary key(RecipientID);
go
--附件表
create table [dbo].[Attachment]
(
AttachmentID
[int] identity(1,1), --附件ID
AttachmentName [nvarchar](50) not null, --附件名称
AttachmentFilePath [nvarchar](100) not null, --附件存放类型
AttachmentType [nvarchar](20) not null, --附件文件类型
AttachmentDateTime [datetime] not null, --附件上传时间
AttachmentSource [nvarchar](20) not null, --附件来源:消息、文章、上交?
AttachmentSourceID [int] not null, --附件来源ID
)
alter table [dbo].[Attachment] add constraint pk_Attachment primary key(AttachmentID)
go

--每月上传时间表
create table [dbo].[Time]
(
TimeID
[int] identity(1,1), --表时间ID
TimeName [nvarchar](20) not null, --时间变量名
TimeContent [datetime] default getdate() --时间变量值
)
alter table [dbo].[Time] add constraint pk_timeid primary key(TimeID)
go
复制代码

 

最近偶然接到这样一个小项目,所以认真做一下。

1,消息模块设计:

 

     方案一:A给B,C,D发送信息,则在消息表中生成3条信息,接收人分别是B,C,D,并有Bool表示是否查看过。

     方案二:A给B,C,D发送信息,在表A中生成一条信息 ,表B中保存消息ID,和接收人分别是B,C,D的3条信息。(优点,当消息字数多时,能有效节省数据库空间)

     关于消息附件:设计表FuJianBiao ,每个附件记录引用消息表ID,可实现一条消息附带多条附件。

 

2,用户及权限模块设计:

    

 

用户角色表关联用户表和角色表,角色功能表关联角色表和功能表,都是多对多关系。每个用户有多个角色,每个角色也有多个用户;每个角色有多个功能,每个功能可以对应多个角色,由于该项目对权限要求明确而且很简单,所以不必这样设计用户权限系统。简单合适就好。

 

3,部门管理模块(管理员)设计

设计部门表

 

4,文档上传管理模块:

 

 

5,服务器文件管理模块:

 

 

 

posted on   Henry_Wang  阅读(825)  评论(0编辑  收藏  举报

导航

< 2010年12月 >
28 29 30 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 1
2 3 4 5 6 7 8

统计

点击右上角即可分享
微信分享提示