IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[cc_desk_gethistory]') AND type = 'P')
DROP PROCEDURE [dbo].[cc_desk_gethistory]
GO
create PROCEDURE [dbo].[cc_desk_gethistory] 
-- Add the parameters for the stored procedure here
@pagesize int,
@pagecount int ,
@mobile nvarchar(50)
AS
BEGIN

SET NOCOUNT ON;
if(@mobile = '') return;



--t1 查询有多少个
select count(*) cnt from order_261
where ord_no not like '%临%' and ord_khdh like '%'+@mobile+'%'

--t2 查询所有id值

select ord_id from order_261
where ord_no not like '%临%' and ord_khdh like '%'+@mobile+'%'

--t3 查询客户【咨询历史】信息
select  top (@pagesize) ord_no,ord_date,ord_type,ord_zxmd,ord_creator,ord_status,ord_id,261 as ord_bizid
from order_261
where ord_no not like '%临%' and ord_khdh like '%'+@mobile+'%'
order by ord_date desc
set nocount off

END