eTable

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