数据库篇之存储过程[bsp_getuserorderlist]-BrnShop1.9升级至2.1升级说明(非官方版本)

差异如下图

根据差异图片可以到数据库执行语句中找不到图片二的内容

是创建一个存储过程

处理方式

1.删除原先的存储过程[bsp_getuserorderlist]

2.新建存储过程[bsp_getuserorderlist]

GO 
DROP PROCEDURE [bsp_getuserorderlist]
GO
CREATE PROCEDURE [bsp_getuserorderlist]
@uid int,
@pagesize int,
@pagenumber int,
@startaddtime varchar(30),
@endaddtime varchar(30),
@orderstate tinyint
AS
BEGIN
	SET NOCOUNT ON;
	DECLARE @condition nvarchar(1000);
	SET @condition = '';
	
	IF @orderstate > 0
	SET @condition = ' AND [orderstate]=' + STR(@orderstate);
	
	IF @startaddtime <> ''
	SET @condition = @condition + ' AND [addtime]>=''' + @startaddtime + '''';
	
	IF @endaddtime <> ''
	SET @condition = @condition + ' AND [addtime]<=''' + @endaddtime + '''';
	
	IF @pagenumber=1
	BEGIN
		EXEC('SELECT TOP ' + @pagesize + ' [oid],[osn],[uid],[orderstate],[orderamount],[parentid],[isreview],[addtime],[shipfriendname],[payfriendname],[paymode],[consignee] FROM [bsp_orders] WHERE [uid]=' + @uid + @condition + ' ORDER BY [oid] DESC');
	END
	ELSE
	BEGIN
	    DECLARE @count int;
	    SET @count = @pagesize*(@pagenumber-1);
		EXEC('SELECT TOP ' + @pagesize + ' [oid],[osn],[uid],[orderstate],[orderamount],[parentid],[isreview],[addtime],[shipfriendname],[payfriendname],[paymode],[consignee] FROM [bsp_orders] WHERE [uid]=' + @uid + @condition + ' AND [oid]<(SELECT MIN([oid]) FROM (SELECT TOP ' + @count + ' [oid] FROM [bsp_orders] WHERE [uid]=' + @uid + @condition + ' ORDER BY [oid] DESC) AS [temp]) ORDER BY [oid] DESC');
	END
END
GO


©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页