/*根据id号获取新闻数据*/
create proc tgr_GetNewsInfoByNid @KeyId int
as
begin
select * from RTO_TbNews where Nid=@KeyID
end
/*增加新闻点评信息*/
create proc tgr_AddCommentInfo @StrA nvarchar(500) ,@StrB nvarchar(500), @IntA int
as
begin
insert into RTO_Commen values(@Stra,@StrB,@IntA,getdate())
end
/*添加新闻数据*/
create proc tgr_AddNewsDataInfo @StrA nvarchar(500),@StrB nvarchar(500),@StrC ntext,@IntA int,@IntB int,
@IntC int,@StrD nvarchar(500),@StrE nvarchar(500),@StrF nvarchar(500)
as
begin
declare @Flags int
select @Flags=Nid from RTO_TbNews where Title=@StrA
if @Flags is null
begin
insert into RTO_TbNews(Title,Author,N_Content,ClickNum,Ntype,Bid,Sid,Position,ImgUrl,HtmlFileName,Bind,AddDate)
values(@StrA,@StrB,@StrC,0,@IntA,@IntB,@IntC,@StrD,@strE,@strF,0,getdate())
select @@identity as returnflag
end
else
begin
select 0 as returnflag
end
end
/*删除数据通用过程*/
create proc tgr_DelDataByID @KeyID int,@KeyS nvarchar(50)
as
begin
--删除大类信息--
if @KeyS='Bclass'
begin
set xact_abort on
begin transaction
delete from RTO_Bclass where Bid=@KeyID
commit transaction
end
--删除小类信息--
else if @KeyS='Sclass'
begin
set xact_abort on
begin transaction
delete from RTO_Sclass where Sid =@KeyID
commit transaction
end
--删除标签信息--
else if @KeyS='Flags'
begin
set xact_abort on
begin transaction
delete from RTO_SysFlg where Pid=@KeyID
commit transaction
end
--删除新闻信息--
else if @keys='News'
begin
set xact_abort on
begin transaction
delete from RTO_TbNews where Nid=@KeyID
commit transaction
end
--删除评论--
else if @KeyS='Comment'
begin
set xact_abort on
begin transaction
delete from RTO_Commen where Did=@KeyID
commit transaction
end
end
/*根据id号更新新闻信息*/
create proc tgr_UpdNewsDataInfo @StrA nvarchar(500),@StrB nvarchar(500),
@StrC ntext,@IntA int,@IntB int,@IntC int,@IntD int,@StrD nvarchar(500),@StrE nvarchar(500)
as
begin
begin
set xact_abort on
begin transaction
update RTO_TbNews set Title=@StrA, Author=@StrB,N_Content=@StrC,Ntype=@IntA,
Bid=@IntB,Sid=@IntC,Position=@StrD,ImgUrl=@StrE where Nid=@IntD
commit transaction
end
end