IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[order_48_startmessage_3203]') AND type = 'P')
DROP PROCEDURE [dbo].[order_48_startmessage_3203]
GO

-- 生成时间:2018-06-12 11:05:15 by ebs-core  
create  procedure order_48_startmessage_3203(
     @cmpid int, 
     @ordid bigint,
     @jbid bigint
  ) 
  as  
  begin  
set nocount on  

------ 给执行人发消息  ----------  

------ 给监督人发消息  ----------  

------ 给协作人发消息  ----------  

------ 给知会人发消息  ----------  

------ 给日志参与人发消息  ----------  

------ 给员工1发消息  ----------  

insert into ebs_kernel.dbo.pub_message(msg_cmpid,msg_mpid,msg_text,msg_senddate,msg_type,msg_target,msg_cuid)  
select @cmpid,21,'亲，快快快，有新的培训课程可以报名啦！
课程主题：【'+ord_kczt+'】
课程编号：【'+ord_no+'】
预计开课：【'+convert(nvarchar(100),ord_ksrq,23)+'】
培训讲师：【'+isnull(ord_empname,'')+'】
推送时间：【'+convert(nvarchar(100),getdate(),120)+'】
点我查看详情'
+'{title}培训开课:'+ord_type+char(9)
+'{url}/order/biztop.mobile.htm?crmid='+CONVERT(varchar,ord_bizid)+'&ordid='+CONVERT(varchar,ord_id)+'&jbid='+CONVERT(varchar,jb_id)+'&expired='+convert(nvarchar(50),ord_jsrq,120),getdate(),'QYH',substring(cu_qyh , 20,50)    , cu_id 
from order_48,order_48_105,mps_job,mps_login 
where  ord_id=@ordid and  ord2_ordid=@ordid and  jb_id=@jbid and ord2_pxcuid=cu_id and  
cu_type=0 and cu_qyh>'' 

------ 给员工2发消息  ----------  

------ 给员工3发消息  ----------  


set nocount off  
end