eTable
1
create database eTable
2
3
go
4
5
use eTable
6
7
go
8
9
--表格管理系统
10
--
11
--功能:可以设置生成各种类型的表格
12
13
--一、系统功能模板
14
--1、用户注册
15
--用户使用邮箱进行注册,注册时需要用户登录邮箱进行确认。注册后的用户才可以创建表格以及参与在线讨论。当用户忘记密码时可通过邮箱找回。
16
create table userInfo
17
(
18
[user_id] int identity primary key,
19
[user_name] varchar(200) not null,--用户名称,也是用户的注册邮箱
20
user_pass varchar(32) not null,--用户的登录密码
21
user_date datetime default getdate(),--用户注册的时间
22
true_name varchar(200) not null,--真实姓名
23
log_date datetime --最后一次登录时间
24
--user_email varchar(200) --备用邮箱
25
)
26
27
--2、密码找回
28
--当用户忘记密码时,系统会生成一个找回密码的链接,此时可重新设置密码,此链接的有效时间为24小时,超过此时间需要重新进行设置。当用户初次生成链接时,添加一条数据,当用户多次生成链接时,后面的数据总是更新前面的数据,也就是同一用户只能存一条数据。24小时该链接失效,用户需要重新申请,24小时内用户只能申请一次,申请时只是把数据进行重发,为同一链接。当用户打开链接时,验证用户的合法性后,该条数据失效,用户可以在此页面中重新设置密码。
29
create table getPass
30
(
31
get_id int identity primary key,
32
[user_name] varchar(200) not null,--用户邮箱
33
get_code varchar(200) not null,--随机生成验证码,并进行加密。
34
get_date datetime default getdate()--获取时间
35
)
36
37
--用户登录
38
39
--3、日志管理 log
40
--记录整个系统的操作日志,包括系统用户和系统管理员
41
create table operateLog
42
(
43
log_id int identity primary key,
44
[user_id] int default 0,--用户编号,当编号为0时为不能确认该用户的编号,如密码找回时。
45
log_message varchar(1000) not null,--发生的事件信息
46
log_date datetime default getdate(),--事件发生的时间
47
log_ip varchar(15) not null--用户的IP地址
48
)
49
50
--4、邮箱配置
51
--系统设置的邮箱,用于向用户发送邮件,需要配置SMTP服务器,邮箱名称和邮箱登录服务器
52
create table email
53
(
54
email_id int identity primary key,
55
email_name varchar(200) not null,--邮箱名称
56
email_pass varchar(200) not null,--邮箱密码,采用对称加密
57
email_SMTP varchar(200) not null,--SMTP服务器
58
email_count int default 0 --已经发送的邮件数
59
)
60
61
--5、系统权限设定
62
--5.1、系统管理员 admin
63
create table adminManage
64
(
65
admin_id int identity primary key,
66
admin_name varchar(200) not null,--用户名
67
admin_pass varchar(32) not null,--用户密码
68
69
)
70
71
--6、讨论区
72
--讨论区用于用户之间的交流
73
--6.1、讨论区栏目 bbsClass
74
create table bbsClass
75
(
76
class_id int identity primary key,
77
class_title varchar(200) not null,--栏目名称
78
class_parent int default 0,--父栏目编号
79
[user_id] int null--管理者编号,同用户表userInfo对应,管理者可回复、屏蔽、删除信息,并且可设置排序
80
)
81
--6.2、讨论区内容
82
create table bbs
83
(
84
bbs_id int identity primary key,
85
bbs_title varchar(200) not null,--标题
86
bbs_content text not null,--内容
87
class_id int not null,--栏目编号
88
bbs_date datetime default getdate(),--留言时间
89
[user_id] int not null,--留言者编号,同用户表userInfo对应
90
bbs_ip varchar(15) not null,--留言者IP地址
91
order_id int not null--排序编号,同bbsOrder表相对应
92
)
93
--6.3、留言排序依据
94
create table bbsOrder
95
(
96
order_id int identity primary key,--
97
order_title varchar(200) not null,--类别名称,如精华、推荐、普通、重点等,可设置格式。
98
order_num int not null,--顺序排列
99
order_image varchar(200) --类别图标
100
)
101
102
--7、内容管理
103
--内容管理可发布新闻,可发布通知公告等信息
104
--7.1、内容管理栏目
105
create table newClass
106
(
107
class_id int identity primary key,
108
class_name varchar(200) not null,--栏目名称
109
class_parent int not null--父栏目编号
110
)
111
--7.2、内容
112
create table news
113
(
114
new_id int identity primary key,
115
new_title varchar(200) not null,--标题
116
new_content text not null,--内容
117
redirect_url varchar(500),--重定向页面
118
class_id int not null,--类别编号
119
new_date datetime default getdate(),--添加时间
120
new_click int default 0,--点击数
121
admin_id int not null--添加管理员编号
122
)
123
124
--8、数据统计
125
--8.1、记录网站的数据访问量
126
create table visitLog
127
(
128
log_id int identity primary key,
129
log_IP varchar(15) not null,--访问者IP
130
log_Browser varchar(20) not null,--浏览器类型
131
log_time datetime default getdate(),--访问时间
132
log_OS varchar(20) not null,--操作系统
133
log_url varchar(200) not null,--所访问的页面
134
log_from varchar(200) --上一页面
135
)
136
137
--二、表格功能的实现
138
--1、表格管理 tableName
139
create table tableName
140
(
141
table_id int identity primary key,
142
table_name varchar(200) not null,--表格名
143
table_text text ,--表格说明
144
[user_id] int not null,--同userInfo表相对应,创建者编号
145
table_stat datetime not null,--表格使用的起始时间
146
table_end datetime not null--表格使用的结束时间
147
)
148
149
--2、字段类型 fieldType
150
create table fieldType
151
(
152
type_id int identity primary key,
153
type_name varchar(200) not null,--类型名称
154
type_reg varchar(200) not null,--验证正则表达式
155
type_explain varchar(200) --举例说明格式
156
)
157
158
--3、表格中的各个要素 tableBasic
159
create table tableBasic
160
(
161
basic_id int identity primary key,
162
table_id int not null,--表格编号,同tableName表相对应
163
basic_name varchar(200) not null,--要素的名称
164
type_id int not null,--数据类型,同fieldType表相对应
165
basic_order int default 0,--排序,从高到低,默认为1,为最末
166
basic_explain varchar(200) --要素说明
167
)
168
169
--4、提交数据用户表 theUse
170
create table theUse
171
(
172
the_id int identity primary key,--用户编号
173
table_id int not null,--表格编号
174
the_date datetime default getdate(),--添加时间
175
the_IP varchar(15) not null--提交者IP
176
)
177
178
--5、用户提交的数据管理 tableData
179
create table tableData
180
(
181
data_id int identity primary key,
182
the_id int not null,--提交数据的用户编号
183
basic_id int not null,--要素编号
184
data_value varchar(2000)--该要素的值
185
)
create database eTable2

3
go4

5
use eTable6

7
go8

9
--表格管理系统10
--11
--功能:可以设置生成各种类型的表格12

13
--一、系统功能模板14
--1、用户注册15
--用户使用邮箱进行注册,注册时需要用户登录邮箱进行确认。注册后的用户才可以创建表格以及参与在线讨论。当用户忘记密码时可通过邮箱找回。16
create table userInfo17
(18
[user_id] int identity primary key,19
[user_name] varchar(200) not null,--用户名称,也是用户的注册邮箱20
user_pass varchar(32) not null,--用户的登录密码21
user_date datetime default getdate(),--用户注册的时间22
true_name varchar(200) not null,--真实姓名23
log_date datetime --最后一次登录时间24
--user_email varchar(200) --备用邮箱25
)26

27
--2、密码找回28
--当用户忘记密码时,系统会生成一个找回密码的链接,此时可重新设置密码,此链接的有效时间为24小时,超过此时间需要重新进行设置。当用户初次生成链接时,添加一条数据,当用户多次生成链接时,后面的数据总是更新前面的数据,也就是同一用户只能存一条数据。24小时该链接失效,用户需要重新申请,24小时内用户只能申请一次,申请时只是把数据进行重发,为同一链接。当用户打开链接时,验证用户的合法性后,该条数据失效,用户可以在此页面中重新设置密码。29
create table getPass30
(31
get_id int identity primary key,32
[user_name] varchar(200) not null,--用户邮箱33
get_code varchar(200) not null,--随机生成验证码,并进行加密。34
get_date datetime default getdate()--获取时间35
)36

37
--用户登录38

39
--3、日志管理 log40
--记录整个系统的操作日志,包括系统用户和系统管理员41
create table operateLog42
(43
log_id int identity primary key,44
[user_id] int default 0,--用户编号,当编号为0时为不能确认该用户的编号,如密码找回时。45
log_message varchar(1000) not null,--发生的事件信息46
log_date datetime default getdate(),--事件发生的时间47
log_ip varchar(15) not null--用户的IP地址48
)49

50
--4、邮箱配置51
--系统设置的邮箱,用于向用户发送邮件,需要配置SMTP服务器,邮箱名称和邮箱登录服务器52
create table email53
(54
email_id int identity primary key,55
email_name varchar(200) not null,--邮箱名称56
email_pass varchar(200) not null,--邮箱密码,采用对称加密57
email_SMTP varchar(200) not null,--SMTP服务器58
email_count int default 0 --已经发送的邮件数59
)60

61
--5、系统权限设定62
--5.1、系统管理员 admin63
create table adminManage64
(65
admin_id int identity primary key,66
admin_name varchar(200) not null,--用户名67
admin_pass varchar(32) not null,--用户密码68

69
)70

71
--6、讨论区72
--讨论区用于用户之间的交流73
--6.1、讨论区栏目 bbsClass74
create table bbsClass75
(76
class_id int identity primary key,77
class_title varchar(200) not null,--栏目名称78
class_parent int default 0,--父栏目编号79
[user_id] int null--管理者编号,同用户表userInfo对应,管理者可回复、屏蔽、删除信息,并且可设置排序80
)81
--6.2、讨论区内容82
create table bbs83
(84
bbs_id int identity primary key,85
bbs_title varchar(200) not null,--标题86
bbs_content text not null,--内容87
class_id int not null,--栏目编号88
bbs_date datetime default getdate(),--留言时间89
[user_id] int not null,--留言者编号,同用户表userInfo对应90
bbs_ip varchar(15) not null,--留言者IP地址91
order_id int not null--排序编号,同bbsOrder表相对应92
)93
--6.3、留言排序依据94
create table bbsOrder95
(96
order_id int identity primary key,--97
order_title varchar(200) not null,--类别名称,如精华、推荐、普通、重点等,可设置格式。98
order_num int not null,--顺序排列99
order_image varchar(200) --类别图标100
)101

102
--7、内容管理103
--内容管理可发布新闻,可发布通知公告等信息104
--7.1、内容管理栏目105
create table newClass106
(107
class_id int identity primary key,108
class_name varchar(200) not null,--栏目名称109
class_parent int not null--父栏目编号110
)111
--7.2、内容112
create table news113
(114
new_id int identity primary key,115
new_title varchar(200) not null,--标题116
new_content text not null,--内容117
redirect_url varchar(500),--重定向页面118
class_id int not null,--类别编号119
new_date datetime default getdate(),--添加时间120
new_click int default 0,--点击数121
admin_id int not null--添加管理员编号122
)123

124
--8、数据统计125
--8.1、记录网站的数据访问量126
create table visitLog127
(128
log_id int identity primary key,129
log_IP varchar(15) not null,--访问者IP130
log_Browser varchar(20) not null,--浏览器类型131
log_time datetime default getdate(),--访问时间132
log_OS varchar(20) not null,--操作系统133
log_url varchar(200) not null,--所访问的页面134
log_from varchar(200) --上一页面135
)136

137
--二、表格功能的实现138
--1、表格管理 tableName139
create table tableName140
(141
table_id int identity primary key,142
table_name varchar(200) not null,--表格名143
table_text text ,--表格说明144
[user_id] int not null,--同userInfo表相对应,创建者编号145
table_stat datetime not null,--表格使用的起始时间146
table_end datetime not null--表格使用的结束时间147
)148

149
--2、字段类型 fieldType150
create table fieldType151
(152
type_id int identity primary key,153
type_name varchar(200) not null,--类型名称154
type_reg varchar(200) not null,--验证正则表达式155
type_explain varchar(200) --举例说明格式156
)157

158
--3、表格中的各个要素 tableBasic159
create table tableBasic160
(161
basic_id int identity primary key,162
table_id int not null,--表格编号,同tableName表相对应163
basic_name varchar(200) not null,--要素的名称164
type_id int not null,--数据类型,同fieldType表相对应165
basic_order int default 0,--排序,从高到低,默认为1,为最末166
basic_explain varchar(200) --要素说明167
)168

169
--4、提交数据用户表 theUse170
create table theUse171
(172
the_id int identity primary key,--用户编号173
table_id int not null,--表格编号174
the_date datetime default getdate(),--添加时间175
the_IP varchar(15) not null--提交者IP176
)177

178
--5、用户提交的数据管理 tableData179
create table tableData180
(181
data_id int identity primary key,182
the_id int not null,--提交数据的用户编号183
basic_id int not null,--要素编号184
data_value varchar(2000)--该要素的值185
)
浙公网安备 33010602011771号