日期:2014-05-17 浏览次数:20501 次
USE [HLT_HIEP_V2]
GO
/****** Object: StoredProcedure [dbo].[master_querySupplierCertificate] Script Date: 06/08/2013 10:54:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[master_querySupplierCertificate]
@OrganizationDomain NVARCHAR(20),
@PartnerId nvarchar(20),
@CertificateId nvarchar(20),
@CertificateName nvarchar(80),
@CertificateType int,
@StartValidDate datetime,
@EndValidDate datetime,
@CertificatePhoto nvarchar(128),
@Markers int,
@StartCreateDate datetime,
@EndCreateDate datetime,
@PageIndex int,
@PageSize int,
@SortField nvarchar(20),
@SortMethod nvarchar(20)
as
begin
DECLARE @PageLowerBound int
DECLARE @PageUpperBound int
DECLARE @TotalRecords int
SET @PageLowerBound = @PageSize * @PageIndex
SET @PageUpperBound = @PageSize - 1 + @PageLowerBound
--设置排序字段和规则
IF(@SortField IS NULL OR @SortMethod IS NULL OR @SortField='' OR @SortMethod='')
BEGIN
SET @SortField = 'PartnerId'
SET @SortMethod = 'DESC'
END
--拼SQL 按条件排序查询
DECLARE @SqlStr nvarchar(1000)
SET @SqlStr=''
DECLARE @OrganizationProviderId uniqueidentifier
IF(@OrganizationDomain IS NOT NULL AND @OrganizationDomain<>'' AND @OrganizationDomain<>'%' AND @OrganizationDomain<>'%%')
BEGIN