@fistid nvarchar(4), --//类型ID
@pagetype int,--//当前页的 类型
@pagecount int,--//当前页数
@numcount int,--//总记录
@numpage int --//总页数
as
if @pagetype=0 --判断是不是首页
begin
select top 10 Bus_ID, Ent_ID,ClassID,Bus_Title,Bus_Remark,Bus_AddTime from Ece_Business where left(ClassNumber,4)=@fistid and Ent_ID is not null order by Bus_ID
end
if @pagetype=1--判断是不是尾页
begin
select top(@numcount-(@numpage-1)*10)Bus_ID,Ent_ID,ClassID, Bus_Title,Bus_Remark,Bus_AddTime from Ece_Business where left(ClassNumber,4)=@fistid and Ent_ID is not null order by Bus_ID desc
end
if(@pagetype=2)
begin
if @pagecount<@numpage
begin
if @pagecount>0
begin
select top 10 Bus_ID,Ent_ID,ClassID,Bus_Title,Bus_Remark,Bus_AddTime from Ece_Business where left(ClassNumber,4)=@fistid and Bus_ID>(selecT max(aa.bus_id) from (select top(@pagecount*10) bus_id from dbo.Ece_Business where left(ClassNumber,4)=@fistid order by bus_id)as aa) and Ent_ID is not null order by Bus_ID
end
else
begin
select top 10 Bus_ID, Ent_ID,ClassID,Bus_Title,Bus_Remark,Bus_AddTime from Ece_Business where left(ClassNumber,4)=@fistid and Ent_ID is not null order by Bus_ID
end
end
else
begin
select top(@numcount-(@numpage-1)*10)Bus_ID,Ent_ID,ClassID, Bus_Title,Bus_Remark,Bus_AddTime from Ece_Business where left(ClassNumber,4)=@fistid and Ent_ID is not null order by Bus_ID desc
end
end