web-3g-163(网易)-邮箱和博客-数据架构设计

专题图ylbtech-asp.net编号:ylbtechASPNET

1,功能描述

 

2,技术与环境

 

3,数据库设计

3g163EMail.sql

USE MASTER

go

-- =============================================

-- ylb: 3g版网易邮箱

-- url: http://m.mail.163.com/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 11:11 2012-07-05

-- =============================================

IF EXISTS (SELECT * 

	   FROM   master..sysdatabases 

	   WHERE  name = N'_3g163EMail')

	DROP DATABASE _3g163EMail

GO



CREATE DATABASE _3g163EMail

GO



USE _3g163EMail

GO

-- =============================================

-- ylb: 1.1邮箱帐户表

-- =============================================

create table MailUsers

(

mailUser varchar(100) primary key,	--帐号名称[PK]

pwd varchar(100) not null			--密码

)

 

/1, 3g163EMail/1, MailUsers.sql
View Code
use _3g163Email

go

-- =============================================

-- ylb: 3g版网易邮箱

-- url: http://m.mail.163.com/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 11:11 2012-07-05

-- =============================================

-- =============================================

-- ylb-menu: 1, 邮箱帐户表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData: 1,用户登录

-- =============================================

insert into MailUsers(mailUser,pwd) values('[email protected]','m123456')

GO

insert into MailUsers(mailUser,pwd) values('[email protected]','m123456')





GO

-- =============================================

-- ylb: 1,用户登录

-- =============================================

select COUNT(*) from MailUsers where mailUser='[email protected]' and pwd='m123456'

 

3,数据库设计

2, 3g163Blog.sql

USE MASTER

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 11:11 2012-07-05

-- =============================================

IF EXISTS (SELECT * 

	   FROM   master..sysdatabases 

	   WHERE  name = N'_3g163Blog')

	DROP DATABASE _3g163Blog

GO



CREATE DATABASE _3g163Blog

GO



USE _3g163Blog

GO



--ylb:1, 用户

GO

-- =============================================

-- ylb: 1.1,用户基本资料表

-- =============================================

create table Users

(

userId int primary key identity(100,1),	--编号【PK】

nickname varchar(200) not null,		--昵称

realname varchar(200) null,		--真实姓名

sex char(1) check(sex in('M','F','N')) default('N'),	--性别M:男;F:女;N:未知

birthday datetime,			--生日



constellation int,	--星座

province varchar(100),		--现居住地-省

city varchar(100),		--现居住地-市

county varchar(100),		--现居住地-县

mailUser varchar(100) not null		--用户账号[FP], 于网易登录系统MailUser表的mailUser列相关

)



GO

-- =============================================

-- ylb: 1.2,博客统计表

-- =============================================

create table BlogStatistics

(

blogStatisticsId int primary key identity(100,1),--编号【PK】

todayAccessNo int default(0),			--今日访问量

sunAccessNo int default(0),			--总访问量

integral int default(0),			--博客等级

userId int references Users(userId)		--积分【FK】

)



--ylb:2,日志

GO

-- =============================================

-- ylb: 2.1,日志分类表

-- =============================================

create table BlogClass

(

blogClassId int primary key identity(100,1),	--编号【PK】

className varchar(100) not null,		--分类名称

userId int references Users(userId)		--用户编号【FK】

)



GO

-- =============================================

-- ylb: 2.2,日志表

-- =============================================

--drop table Article

create table Article

(

articleId int primary key identity(1,1),	--编号【PK】

title varchar(200) not null,			--标题

content varchar(5000),					--内容

blogClassId int references BlogClass(blogClassId),		--分类编号【FK】

pubdate datetime default(getdate()),			--分布日期



readCnt int default(0),					--阅读数量

replyCnt int default(0),				--回复数量

allowView int default(0),				--显示范围权限 -100:公开;100:好友;1000:私人

draftFlag int default(0),					--0:发送;1:保存草稿

userId int references Users(userId)		--用户编号[FK]

)



GO

-- =============================================

-- ylb: 2.3,日志评论表

-- =============================================

create table ArticleReply

(

articleReplyId int primary key identity(100,1),	--编号【PK】

content varchar(200) not null,			--内容

pubdate datetime default(getdate()),		--回复时间

userId int references Users(userId),		--回复人,用户编号【FK】

articleId int references Article(articleId) --文章编号[FK]

)



--ylb:3, 相册

GO

-- ylb: 3.1 相册类别表

-- =============================================

-- ylb: 3.1.1 相册类别表

-- =============================================

create table Album

(

albumId int primary key identity(1,1),	--编号【PK】

albumName varchar(100) not null,		--相册名

pubdate datetime default(getdate()),		--创建时间

userId int references Users(userId),		--用户编号【PF】

albumUrl varchar(100)						--封面图片

)



GO

-- =============================================

-- ylb: 3.1.2 相册类别评论表

-- =============================================

create table ReplyAlbum

(

replyAlbumId int primary key identity(100,1),--编号

content varchar(200) not null,			--评论内容

pubdate datetime default(getdate()),		--评论时间

baseId int default(0),				--评论级次 0:发表;其他:回复|跟贴

albumId int references Album(albumId),	--相册编号[FK]

userId int references Users(userId)		--用户编号[FK]

)





-- ylb: 3.2 相册表

GO

-- =============================================

-- ylb: 3.2.1 相册表

-- =============================================

create table Photo

(

photoId int primary key identity(100,1),	--编号【PK】

imgUrl varchar(100),				--保存地址

imgDesc varchar(100),				--描述 [注:3g版不显示]

albumId int references Album(albumId),	--相册编号[FK]

userId int references Users(userId)		--用户编号[FK] 有争议

)



GO

-- =============================================

-- ylb: 3.2.2 相册评论表

-- =============================================

create table ReplyPhoto

(

replyPhotoId int primary key identity(100,1),--编号

content varchar(200) not null,			--评论内容

pubdate datetime default(getdate()),		--评论时间

baseId int default(0),				--评论级次 0:发表;其他:回复|跟贴

photoId int references Photo(photoId),	--照片编号[FK]

userId int references Users(userId)		--用户编号[FK]

)





GO

-- =============================================

-- ylb: 4,博友组表

-- =============================================

create table FriendsGroup

(

friendsGroupId int primary key identity(100,1),	--编号【PK】

friendsGroupName varchar(100),					--组名

userId int references Users(userId)				--用户编号【FK】

)



GO

-- =============================================

-- ylb: 4,博友表

-- =============================================

create table Friend

(

friendId int references Users(userId),		--编号

userId int references Users(userId),		--用户编号

pubdate datetime default(getdate()),		--加添时间

friendsGroupId int references FriendsGroup(friendsGroupId)	--好友分组【FK】

)





-- ylb: 5,消息

GO

-- =============================================

-- ylb: 5, 消息表

-- =============================================

create table Msg

(

msgId int primary key identity(100,1),		--编号【PK】

inUserId int references Users(userId),		--接受用户编号【FK】

sendUserId int references Users(userId),	--发送用户编号【FK】

content varchar(200),				--内容

pubdate datetime default(getdate())		--发送时间

)



GO

-- =============================================

-- ylb: 6, 留言表

-- =============================================

create table Note

(

noteId int primary key identity(1,1),	--编号

content varchar(200),					--内容

pubdate datetime default(getdate()),	--时间

inUserId int,							--主人编号

sendUserid int 						--发送人编号

)



GO

-- =============================================

-- ylb: 7, 通知表

-- =============================================

create table Notice

(

noticeId int primary key identity(1,1),	--编号

content varchar(200),					--内容

pubdate datetime default(getdate()),	--时间

remark varchar(200),					--备注

inUserId int							--主人编号

)





GO

-- =============================================

-- ylb: 7, 最近访客

-- =============================================

create table RecentVisitor

(

recentVisitorId int primary key identity(1,1),	--编号

hostId int,		--主人编号

visitId int,	--来访者编号

pubdate datetime default(getdate())	--时间

)





GO

-- =============================================

-- ylb: 7, 最近走访

-- =============================================

create table RecentVisited

(

recentVisitedId int primary key identity(1,1),	--编号

hostId int,		--主人编号

visitId int,	--来访者编号

pubdate datetime default(getdate())	--时间

)



GO

-- =============================================

-- ylb: 7, 最近走访

-- =============================================

create table RecentVisit

(

recentVisitId int primary key identity(1,1),	--编号

hostId int,		--主人编号

visitId int,	--来访者编号

pubdate datetime default(getdate()),	--时间

type varchar(100)			--类型

)



GO

-- =============================================

-- ylb: 8, 心情随笔

-- =============================================

create table Feeling

(

feelingId int primary key identity(1,1),	--编号

content varchar(200),						--内容

pubdate datetime default(getdate()),		--时间

baseId int,									--baseId=0:首发;baseId=num:则恢复

userId int									--用户编号

)



GO

print '网易博客数据创建完成'

 /2, 3g163Blog/1, Users.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 15:45 2012/7/7

-- =============================================

-- =============================================

-- ylb-menu: 1, 用户表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData: 1,用户登录

-- =============================================

insert into Users(nickname,realname,sex,birthday,constellation,mailUser) values('sunshine','yb','F','1989-2-23',1,'[email protected]')

GO

insert into BlogClass(className,userId) values('默认分类',100)

GO

insert into Users(nickname,realname,sex,birthday,constellation,mailUser) values('yinghua','dream','F','1989-2-23',1,'[email protected]')

GO

insert into BlogClass(className,userId) values('默认分类',101)

GO

-- =============================================

-- ylb: 1,获取用户个人资料

-- =============================================

select userId,nickname,realname,sex,birthday,constellation from Users where userId=200



GO

-- =============================================

-- ylb: 2,更新用户个人资料

-- =============================================

update Users set nickname='yb',realname='sunshine',sex='F',birthday='1989-2-23',constellation=1 where userId=200







GO

-- =============================================

-- ylb: 3,获取用户个人资料[登录后]

-- =============================================

select userId,nickname from Users where mailUser='[email protected]'





GO

-- =============================================

-- ylb: 4, 查找好友[模糊查询],根据昵称

-- =============================================

select userId,nickname from Users where nickname like '%n%' 

order by userId asc

 /2, 3g163Blog/2, BlogClass.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 10:35 2012/7/8

-- =============================================

-- =============================================

-- ylb-menu: 2, 日志类别表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData: 

-- =============================================







GO

-- =============================================

-- ylb: 1,添加一个新日志分类

-- =============================================

insert into BlogClass(className,userId) values('life',200)



GO

-- =============================================

-- ylb: 2,查询所有分类,根据userId;排序,添加着在上

-- =============================================

select blogClassId,className from BlogClass where userId=200 order by blogClassId desc

 /2, 3g163Blog/3, Article.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 15:37 2012/7/8

-- =============================================

-- =============================================

-- ylb-menu: 1, 文章表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData:

-- =============================================



GO

-- =============================================

-- ylb:1,添加一篇博文,根据userId

-- =============================================

--select title,content,blogClassId,allowView,draftFlag,userId from Article

--insert into Article(title,content,blogClassId,allowView,draftFlag,userId) values()





GO

-- =============================================

-- ylb:2,查看所有短目录博文列表,根据userId,按userId降序排列

-- =============================================

select articleId,title,allowView,draftFlag,readCnt,(select COUNT(*) from ArticleReply where articleId=a.articleId) from Article a

where userId=1

order by articleId desc



GO

-- =============================================

-- ylb:3,统计用户发表博文的数量,根据userId

-- =============================================

select COUNT(*) from Article where userId=100



GO

-- =============================================

-- ylb:4,查一篇博文的,根据articleId

-- =============================================

select articleId,title,content,blogClassId,allowView,draftFlag,readCnt,(select COUNT(*) from ArticleReply where articleId=a.articleId),userId from Article a

where articleId=1



GO

-- =============================================

-- ylb:5,更新一篇博文的,根据articleId

-- =============================================

select title,content,blogClassId,allowView,draftFlag from Article

where articleId=1



GO

-- =============================================

-- ylb:6,别人或着匿名查看则,访问数量在原基数上加一,根据articleId

-- date: 22:48 2012/7/10

-- =============================================

update Article set readCnt=readCnt+1 where articleId=1



GO

-- =============================================

-- ylb:7,删除一篇博文,根据articleId

-- date: 13:24 2012-07-11

-- =============================================

delete Article where articleId=0



GO

-- =============================================

-- ylb:8,该日志的上一篇或者下一篇,根据articleId

-- =============================================

--下一篇

select top 1 articleId,title from Article where articleId>2 order by articleId asc

--上一篇

select top 1 articleId,title from Article where articleId<2 order by articleId desc



GO

-- =============================================

-- ylb:9,查看所有短目录博文列表[Friend],根据userId,按userId降序排列

-- =============================================

select top 10 articleId,title,userId,(select nickname from  Users where userId=a.userId)'nickname' from Article a

where userId=1 and allowView=-100

order by articleId desc

 /2, 3g163Blog/4, ArticleReply.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 15:37 2012/7/8

-- =============================================

-- =============================================

-- ylb-menu: 2.3, 日志评论表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData:

-- =============================================



GO

-- =============================================

-- ylb:1,添加一条博文评论

-- date:14:51 2012-07-11

-- =============================================

insert into ArticleReply(content,userId,articleId) values()



GO

-- =============================================

-- ylb:2,获取所有博文评论,根据articleId

-- =============================================

select top 5 articleReplyId,content,pubdate,userId,articleId,(select nickname from Users where userId=ar.userId) 'nickname' from ArticleReply ar where articleId=0

order by articleReplyId DESC



GO

-- =============================================

-- ylb:3,删除一条评论,根据articleReplyId

-- =============================================

delete articleReply where articleReplyId=0



GO

-- =============================================

-- ylb:4,该篇日志多少评论,根据articleReplyId

-- date:9:08 2012/7/12

-- =============================================

select COUNT(*) from ArticleReply where articleId=0

 /2, 3g163Blog/5, Album.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 11:18 2012/7/12

-- =============================================

-- =============================================

-- ylb-menu: 1, 相册表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData:

-- =============================================

select * from Album



GO

-- =============================================

-- ylb: 1,添加一个新相册

-- date: 11:18 2012/7/12

-- =============================================

insert into Album(albumName,userId) values()

select @@IDENTITY



GO

-- =============================================

-- ylb: 2,查询所有新相册,根据userId

-- date: 11:18 2012/7/12

-- =============================================

select albumId,albumName,pubdate,userId,albumUrl,(select COUNT(*) from Photo where albumId=p.albumId) 'photoCnt' from Photo p

 where userId=0

 order by albumId desc

GO

--如果该用户没有相册,则创建默认"我的相册"



GO

-- =============================================

-- ylb: 3, 用户拥有的相册数量,根据userId [方法位置有异议]

-- date: 11:18 2012/7/12

-- =============================================

select COUNT(*) from Album where userId=0



GO

-- =============================================

-- ylb: 4,查询所有新相册[dropDownList],根据userId

-- date: 11:18 2012/7/12

-- =============================================

select albumId,albumName from Album where userId=0



GO

-- =============================================

-- ylb: 5,查询新相册,根据albumId

-- date: 11:18 2012/7/12

-- =============================================

select albumId,albumName from Album where albumId=0



select * from Album 

 /2, 3g163Blog/5, Photo.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 23:24 2012/7/12

-- =============================================

-- =============================================

-- ylb-menu: 1, 相册表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData:

-- =============================================



GO

-- =============================================

-- ylb: 1,上传一张照片

-- =============================================

select imgUrl,albumId,userId from Photo

insert into Photo(imgUrl,albumId,userId) values()

select @@IDENTITY



GO

-- =============================================

-- ylb: 2,添加描述,根据photoId

-- =============================================

update Photo set imgDesc='' where photoId=0





GO

-- =============================================

-- ylb: 3,查看一张照片,根据photoId

-- =============================================

select albumId,imgUrl from Photo where photoId=0



GO

-- =============================================

-- ylb: 4,查看一张照片,根据albumId

-- =============================================

select photoId,imgUrl,albumId from Photo where albumId=0 order by photoId desc



GO

-- =============================================

-- ylb: 5,相册包涵照片的数量,根据albumId

-- =============================================



select COUNT(*) from Photo where albumId=0





-- =============================================

-- ylb:6,该照片的上一张或者下一张,根据photoId

-- =============================================

--下一篇

select top 1 photoId,imgUrl from Photo where photoId>2 order by photoId asc

--上一篇

select top 1photoId,imgUrl from Photo where photoId<2 order by photoId desc





GO

-- =============================================

-- ylb: 7,删除一张照片,根据photoId

-- =============================================

delete ReplyPhoto where photoId=1

delete Photo where photoId=0

 /2, 3g163Blog/7, ReplyAlbum.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 11:18 2012/7/12

-- =============================================

-- =============================================

-- ylb-menu: 1, 相册评论表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData:

-- =============================================



GO

-- =============================================

-- ylb:1, 添加一条评论

-- =============================================

select content,baseId,albumId,userId from ReplyAlbum

--insert into ReplyAlbum(content,baseId,albumId,userId) values()

GO

-- =============================================

-- ylb:2,查询所有评论,根据albumId

-- =============================================

select replyAlbumId,content,pubdate,baseId,ra.userId,u.nickname from ReplyAlbum ra

 inner join Users u on ra.userId=u.userId

 where albumId=0

 order by replyAlbumId desc

 

 GO

-- =============================================

-- ylb:3, 删除一条评论

-- =============================================

delete ReplyAlbum where replyAlbumId=0

 /2, 3g163Blog/8, ReplyPhoto.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 11:18 2012/7/12

-- =============================================

-- =============================================

-- ylb-menu: 1, 照片评论表的操作与步骤

-- =============================================

select * from ReplyPhoto

GO

-- =============================================

-- ylb_TestData:

-- =============================================





GO

-- =============================================

-- ylb:1, 添加一条评论

-- =============================================

select content,baseId,photoId,userId from ReplyPhoto

--insert into ReplyPhoto(content,baseId,photoId,userId) values()

GO

-- =============================================

-- ylb:2,查询所有评论,根据photoId

-- =============================================

select replyPhotoId,content,pubdate,baseId,rp.userId,u.nickname from ReplyPhoto rp

 inner join Users u on rp.userId=u.userId

 where photoId=0

 order by replyPhotoId desc

 

 GO

-- =============================================

-- ylb:3, 删除一条评论

-- =============================================

delete ReplyPhoto where replyPhotoId=0

 /2, 3g163Blog/9, Note.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 15:45 2012/7/7

-- =============================================

-- =============================================

-- ylb-menu: 7, 留言表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData: 

-- =============================================

select * from Note





GO

-- =============================================

-- ylb:1, 增加一条留言

-- =============================================

select content,inUserId,sendUserId from Note

--insert into Note(content,inUserId,sendUserId) values()



GO

-- =============================================

-- ylb:2, 查询所有留言,根据inUserId

-- =============================================

select noteId,content,pubdate,inUserId,sendUserId,u.nickname from Note n

 inner join Users u on n.sendUserId=u.userId

 where inUserId=0

 order by noteId desc



GO

-- =============================================

-- ylb:3, 删除一条留言

-- =============================================

delete Note where noteId=0



GO

-- =============================================

-- ylb:4, 留言数量,根据inUserId

-- =============================================

select COUNT(*) from Note where inUserId=0



GO

-- =============================================

-- ylb:5, 查询留言,根据noteId

-- =============================================

select noteId,content,pubdate,inUserId,sendUserId,u.nickname from Note n

 inner join Users u on n.sendUserId=u.userId

 where noteId=0





 GO

-- =============================================

-- ylb:6, 查询所有留言[Friend],根据inUserId 

-- sql方法同sql2

-- =============================================

select top 5 noteId,content,pubdate,inUserId,sendUserId,u.nickname from Note n

 inner join Users u on n.sendUserId=u.userId

 where inUserId=0

 order by noteId desc

 /2, 3g163Blog/10,Notice.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 15:45 2012/7/7

-- =============================================

-- =============================================

-- ylb-menu: 10, 通知表的操作与步骤

-- =============================================



GO

-- =============================================

-- ylb_TestData: 

-- =============================================

insert into Notice(content,remark,inUserId) values('手机相片嫌导出麻烦?怕意外丢失?『网易云相册』提供手机相片无线上传,安全备份,自动关联你的网易博客相册。点击查看详情'

,'系统通知',100)







GO

-- =============================================

-- ylb: 1,[admin]发布通知 [现在还不对]

-- =============================================



select content,remark,inUserId from Notice



insert into Notice(content,remark,inUserId) values()





GO

-- =============================================

-- ylb: 2,查看所有通知,根据inUserId

-- =============================================

select noticeId,content,pubdate,remark,inUserId from Notice where inUserId=0







GO

-- =============================================

-- ylb: 3,删除一条通知,根据noticeId

-- =============================================

delete Notice where noticeId=0



GO

-- =============================================

-- ylb: 4,通知数量,根据inUserId

-- =============================================

select COUNT(*) from Notice where inUserId=0

 /2, 3g163Blog/11,Feeling.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 15:45 2012/7/7

-- =============================================

-- =============================================

-- ylb-menu: 11, 心情随笔表的操作与步骤

-- =============================================

select * from Feeling



GO

-- =============================================

-- ylb_TestData: 

-- =============================================





GO

-- =============================================

-- ylb: 1, 增加随笔

-- =============================================

select content,baseId,userId from Feeling

insert into Feeling(content,baseId,userId) values()

GO

-- =============================================

-- ylb: 2, 查询所有随笔,根据userId

-- =============================================

select feelingId,content,pubdate,baseId,f.userId,u.nickname,(select COUNT(*) from Feeling where baseId=f.feelingId)'replyCnt' from Feeling f

inner join Users u on f.userId=u.userId

where f.userId=0 and baseId=0

order by feelingId desc



GO

select feelingId,content,pubdate,baseId,f.userId,u.nickname,(select COUNT(*) from Feeling where baseId=f.feelingId)'replyCnt' from Feeling f

inner join Users u on f.userId=u.userId

where f.baseId=0

order by feelingId desc



GO

-- =============================================

-- ylb: 3, 删除一条随笔以及回复

-- =============================================

delete Feeling where baseId=0

delete Feeling where feelingId=0





GO

-- =============================================

-- ylb: 4, 查随笔,根据feelingId

-- =============================================

select feelingId,content,pubdate from Feeling where feelingId=0





GO

-- =============================================

-- ylb: 5, 最新的随笔,根据userId

-- =============================================

select top 1 feelingId,content,pubdate from Feeling where userId=0 order by feelingId desc

 /2, 3g163Blog/12, RecentVisit.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 15:45 2012/7/7

-- =============================================



-- =============================================

-- ylb-menu: 11, 最近来访|最近访问表的操作与步骤

-- =============================================

select * from RecentVisit



GO

-- =============================================

-- ylb_TestData:

-- =============================================







GO

-- =============================================

-- ylb: 1, 新增一条记录

-- =============================================

select hostId,visitId,type from RecentVisit

--insert into RecentVisit(hostId,visitId,type) values()



GO

-- =============================================

-- ylb: 2, 访问记录

-- =============================================

-- 2.1 最近访问

select recentVisitId,hostId,visitId,pubdate,nickname from RecentVisit rv

inner join Users u on rv.visitId=u.userId

where type='visitor' and hostId=0

order by recentVisitID desc

GO

-- 2.2 最近来访

select recentVisitId,hostId,visitId,pubdate,nickname from RecentVisit rv

inner join Users u on rv.visitId=u.userId

where type='visited' and hostId=0

order by recentVisitID desc

GO

-- =============================================

-- ylb: 2, 

-- =============================================

 /2, 3g163Blog/13, FriendsGroup.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 15:02 2012-07-26

-- =============================================

-- =============================================

-- ylb-menu: 1, 好友组表的操作与步骤

-- =============================================

select friendsGroupId,friendsGroupName,userId from FriendsGroup





GO

-- =============================================

-- ylb: 1, 查好友分组,根据userId

-- =============================================

select friendsGroupId,friendsGroupName from FriendsGroup where userId=0





GO

-- =============================================

-- ylb: 2, 添加一个分组

-- =============================================

select friendsGroupName,userId from FriendsGroup

insert into FriendsGroup(friendsGroupName,userId) values('happy',100)





GO

-- =============================================

-- ylb: 3, 删除一个好友分组

-- =============================================

delete FriendsGroup where friendsGroupId=0



GO

-- =============================================

-- ylb: 1, 

-- =============================================



--select * from Users

 /2, 3g163Blog/14,Friend.sql

View Code
use _3g163Blog

go

-- =============================================

-- ylb: 3g版网易博客

-- url: http://3g.163.com/blog/

-- devloper:ylb,tech

-- author: YuanBo

-- date: 15:02 2012-07-26

-- =============================================

-- =============================================

-- ylb-menu: 1, 好友表的操作与步骤

-- =============================================

select * from Friend



GO

-- =============================================

-- ylb: 1, 查询好友,根据userId, freindsGroupId

-- =============================================

select friendId,pubdate,nickname from Friend f

inner join Users u on f.friendId=u.userId where userId=0



GO

-- =============================================

-- ylb: 1, 

-- =============================================



GO

-- =============================================

-- ylb: 1, 

-- =============================================



GO

-- =============================================

-- ylb: 1, 

-- =============================================

 /2, 3g163Blog/

4.1,前台

5,代码分析

 解决方案属性图

6,示例|讲解案例下载

博客园讲解:  http://ylbtech.cnblogs.com/

百度文库开发文档: http://passport.baidu.com/?business&aid=6&un=ylbtech#7

谷歌开源代码下载: http://code.google.com/p/ylbtechopensource/downloads/list

请单击“搜索框设默认DropDown”

warn 作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

 

最终目标

 代码的国际化标准示例 ylb,tech”,最大程度地规范软件编程开发统一,优质, 高效,易学,为建设软件强国(中国)而努力。

你可能感兴趣的:(架构设计)