您好,欢迎来到欧得旅游网。
搜索
您的当前位置:首页网上商城项目数据库表

网上商城项目数据库表

来源:欧得旅游网
网上商城项目数据库表

注册用户表 字段名 UserID (主键) UserName UserPwd PwdQuestion PwdAnswer UserRealName UserSex UserAge UserOccupation UserIncome UserEducation UserEmail UserTelphone UserMobile UserProvince UserCity UserAddress UserVIP UserCheck UserPoint UserVisitCount UserLastVisitIP UserCreateTime 用户访问日志表 字段名 LogID UserName VisitIP VisitTime 管理员表 字段名 ManagerID ManagerName ManagerPwd ManagerType ManagerText 数据类型 integer nvarchar(50) nvarchar(50) integer nvarchar(250) null null null null 是否为空 默认值 identity 说明 管理员ID 管理员用户名 管理员密码 管理员类型 管理员描述 数据类型 integer nvarchar(50) nvarchar(20) datetime 是否为空 null null null default getdate() 默认值 identity 日志ID 访问用户名 访问IP 访问时间 说明 数据类型 integer nvarchar(50) nvarchar(50) nvarchar(100) nvarchar(100) nvarchar(50) nvarchar(5) nvarchar(5) nvarchar(20) nvarchar(20) nvarchar(20) nvarchar(100) nvarchar(20) nvarchar(11) nvarchar(20) nvarchar(50) nvarchar(100) integer integer integer integer nvarchar(20) datetime 是否为空 null null null null null null null null null null null null null null null null null null null null null null null default 0 default 1 default 100 default 1 default getdate() default getdate() 默认值 identity 说明 注册用户ID 注册用户用户名 注册用户密码 注册用户密码提问 注册用户密码回答 注册用户真实姓名 注册用户性别 注册用户年龄 注册用户工作职业 注册用户个人收入 注册用户最高学历 注册用户电子邮件 注册用户固定电话 注册用户移动电话 注册用户所在省份 注册用户所在城市 注册用户邮政编码 注册用户是否VIP 注册用户是否审核 注册用户商城积分 注册用户访问次数 注册用户最后访问时间 注册用户最后访问IP 注册用户注册时间 UserLastVisitTime datetime ManagerCheck ManagerVisitCount ManagerLastVisitTime ManagerLastVisitIP ManagerCreateTime integer integer datetime nvarchar(20) datetime null null null null null d 商品二级分类表 default 1 default 1 default getdate() efault getdate() 管理员是否审核 管理员访问次数 管理员最后访问时间 管理员最后访问IP 管理员录入时间 字段名 BorderID TypeID BorderName BorderText BorderOrder BorderCheck BorderTime 数据类型 integer integer nvarchar(50) nvarchar(250) integer integer datetime null null null 是否为空 默认值 identity 说明 二级分类ID 一级分类ID 二级分类名称 二级分类描述 二级分类显示级别 二级分类显示校验 二级分类录入时间 null null null 商品信息表 default 0 default 0 default getdate() 字段名 GoodsID TypeID BorderID GoodsCode GoodsTypeCode GoodsName GoodsKeys GoodsText GoodsContent GoodsPicSmall GoodsPicLarge GoodsPT GoodsPriceShop GoodsPriceUser GoodsPriceVIP GoodsPricePer GoodsOnTime GoodsIsNew GoodsIsVouch GoodsOrder GoodsCheck GoodsCheckAdmin GoodsHits GoodsReviews GoodsOrderNum 数据类型 integer integer integer nvarchar(100) nvarchar(100) nvarchar(100) nvarchar(100) nvarchar(250) text nvarchar(150) nvarchar(150) nvarchar(50) money money money integer datetime integer integer integer integer nvarchar(50) integer integer integer 是否为空 identity null null null null null null null null null null null null null null null null null null null null null null null null 默认值 说明 商品ID 商品一级分类ID 商品二级分类ID 商品编号 商品型号 商品名称 商品关键字 商品简介 商品描述 商品小图片 商品大图片 商品品牌 商品市场价 商品优惠价 商品VIP价 商品折扣数 商品上市时间 商品是否新品 商品是否推荐 商品显示级别 商品是否审核 商品审核员 商品点击数 商品评论数 商品下单数 default getdate() default 1 default 1 default 0 default 0 default 0 default 0 default 0 GoodsBuyNum GoodsInTime integer datetime null null 商品评论表 default 0 default getdate() 商品卖出数 商品录入时间 字段名 ReviewID GoodsID UserName UserIP ReviewText ReviewCheck ReviewTime 数据类型 integer integer nvarchar(50) nvarchar(20) text integer datetime null null null null 是否为空 默认值 identity 说明 评论ID 商品ID 评论用户名 评论用户IP 评论内容 评论是否审核 评论时间 null null 购物车记录表 default 1 default getdate() 字段名 ShoppingCartID UserID UserCookID UserIP GoodsID GoodsName GoodsPriceShop GoodsPriceUser GoodsNumber ShoppingCheck ShoppingTime 数据类型 integer integer nvarchar(20) nvarchar(20) integer nvarchar(100) money money integer integer datetime null null null null null null null 是否为空 默认值 identity 说明 购物车ID 注册用户ID 购物车临时CookID 用户IP地址 商品ID 商品名称 商品市场价 商品会员价 商品购买数量 商品审核 购物时间 null null null default 1 default 0 default getdate() 收藏夹记录表 字段名 数据类型 null null null null null null 购物订单记录表 字段名 OrderID UserID UserCookID 数据类型 integer integer nvarchar(20) null null 是否为空 默认值 identity 记录ID 注册用户ID 购物车临时CookID 说明 是否为空 default getdate() 默认值 identity 说明 记录ID 注册用户ID 商品ID 商品名 商品市场价 商品优惠价 收藏记录时间 integer CollectID integer UserID integer GoodsID nvarchar(100) GoodsName GoodsPriceShop money GoodsPriceUser money datetime CollectTime OrderUserRealName OrderUserSex n OrderUserAddress OrderUserPostcode OrderUserTelphone OrderUserEmail OrderGoodsSendType OrderMoneyPayType OrderWeight OrderTime nvarchar(50) varchar(5) nvarchar(250) nvarchar(6) nvarchar(20) nvarchar(100) nvarchar(50) nvarchar(50) integer datetime null null null null null null null null null null default 1 default getdate() 收货人姓名 收货人性别 收货人详细地址 收货人邮政编码 收货人联系电话 收货人电子邮件 送货方式 付款方式 订单状态 下单时间 商品库存表 字段名 GoodsSaveID GoodsID GoodsName SaveNum SaveAddNum SaveTime SaveAddTime 商品库存配置表 字段名 数据类型 null null null 是否为空 default getdate() 默认值 identity 说明 库存配置ID 商品满库数量 库存预警数量 配置创建时间 数据类型 integer integer nvarchar(100) integer integer datetime datetime null null null null null null 是否为空 default 0 default 0 default getdate() default getdate() 默认值 identity 说明 库存ID 商品ID 商品名称 商品库存数量 商品增加数量 商品入库时间 商品增加时间 GoodsSaveInfoID integer integer AllNum integer AlertNum datetime AddTime

***************************************************** ' 添加商品记录同步添加库存记录的触发器

'*****************************************************

IF EXISTS (SELECT name FROM sysobjects WHERE name = 'AddGoodsInfo' AND type = 'TR') DROP TRIGGER AddGoodsInfo GO

CREATE TRIGGER AddGoodsInfo ON [dbo].[GoodsInfo] FOR INSERT AS

INSERT INTO GoodsSave select GoodsID,GoodsName,0,0,getdate(),getdate() from inserted GO

'*****************************************************

' 删除商品记录同步删除库存记录的触发器

'*****************************************************

IF EXISTS (SELECT name FROM sysobjects WHERE name = 'DelGoodsInfo' AND type = 'TR') DROP TRIGGER DelGoodsInfo GO

CREATE TRIGGER DelGoodsInfo ON [dbo].[GoodsInfo] FOR DELETE AS

DELETE from GoodsSave where GoodsID = (SELECT GoodsID FROM deleted) GO

'***************************************************** ' 重新同步商品在库存表中的对应记录的存储过程 '***************************************************** CREATE PROCEDURE BindGoodsToSave AS

IF EXISTS (SELECT name FROM sysobjects WHERE name = 'GoodsSave' AND type = 'U') BEGIN

DROP TABLE GoodsSave

create table GoodsSave (

GoodsSaveID integer identity, GoodsID integer null,

GoodsName nvarchar(100) null, SaveNum integer null default 0, SaveAddNum integer null default 0,

SaveTime datetime null default getdate(), SaveAddTime datetime null default getdate(),

constraint PK_GOODSSAVE primary key (GoodsSaveID) ) END ELSE BEGIN

create table GoodsSave (

GoodsSaveID integer identity, GoodsID integer null,

GoodsName nvarchar(100) null, SaveNum integer null default 0, SaveAddNum integer null default 0,

SaveTime datetime null default getdate(), SaveAddTime datetime null default getdate(),

constraint PK_GOODSSAVE primary key (GoodsSaveID) ) END

INSERT INTO GoodsSave(GoodsID,GoodsName) select GoodsID,GoodsName from GoodsInfo order by GoodsID GO

'***************************************************** ' 按日期和月份统计注册人数的存储过程

'***************************************************** CREATE procedure GetRegUsers @id int AS

declare @table table(ID int IDENTITY(1,1),RegDate nvarchar(10),RegNum int) declare @tempId int --临时表记录ID

declare @tempRegDate nvarchar(10) --临时表日期 set nocount on if (@id = 0) begin

insert into @table(RegDate)

select distinct convert(char(10),UserCreateTime,120) from Users order by convert(char(10),UserCreateTime,120) desc

declare _cursor cursor for select Id,RegDate from @table open _cursor

fetch next from _cursor into @tempId,@tempRegDate while @@fetch_status = 0 begin

update @table set RegNum=(select count(UserID) from Users where convert(char(10),UserCreateTime,120) = @tempRegDate) where ID = @tempId

fetch next from _cursor into @tempId,@tempRegDate end

close _cursor

deallocate _cursor end else begin

insert into @table(RegDate)

select distinct convert(char(7),UserCreateTime,120) from Users order by convert(char(7),UserCreateTime,120) desc

declare _cursor cursor for select Id,RegDate from @table open _cursor

fetch next from _cursor into @tempId,@tempRegDate while @@fetch_status = 0 begin

update @table set RegNum=(select count(UserID) from Users where convert(char(7),UserCreateTime,120) = @tempRegDate) where ID = @tempId

fetch next from _cursor into @tempId,@tempRegDate end

close _cursor

deallocate _cursor end

set nocount off

select * from @table where RegDate is not null GO

'***************************************************** ' 按日期和月份统计用户订单的存储过程

'***************************************************** CREATE procedure GetUserOrders @id int AS

declare @table table(ID int IDENTITY(1,1),RegDate nvarchar(10),RegNum int) declare @tempId int --临时表记录ID

declare @tempRegDate nvarchar(10) --临时表日期 set nocount on if (@id = 0) begin

insert into @table(RegDate)

select distinct convert(char(10),OrderTime,120) from GoodsOrder order by convert(char(10),OrderTime,120) desc

declare _cursor cursor for select Id,RegDate from @table open _cursor

fetch next from _cursor into @tempId,@tempRegDate while @@fetch_status = 0 begin

update @table set RegNum=(select count(UserID) from GoodsOrder where convert(char(10),OrderTime,120) = @tempRegDate) where ID = @tempId

fetch next from _cursor into @tempId,@tempRegDate end

close _cursor

deallocate _cursor end else

begin

insert into @table(RegDate)

select distinct convert(char(7),OrderTime,120) from GoodsOrder order by convert(char(7),OrderTime,120) desc

declare _cursor cursor for select Id,RegDate from @table open _cursor

fetch next from _cursor into @tempId,@tempRegDate while @@fetch_status = 0 begin

update @table set RegNum=(select count(UserID) from GoodsOrder where convert(char(7),OrderTime,120) = @tempRegDate) where ID = @tempId

fetch next from _cursor into @tempId,@tempRegDate end

close _cursor

deallocate _cursor end

set nocount off

select * from @table where RegDate is not null GO

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- ovod.cn 版权所有

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务