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

-- 生成时间:2018-11-22 18:21:21 by ebs-core  
CREATE  procedure order_241_2955_wrklink_before(
     @cmpid int, 
     @useruid int,
     @bizid int, 
     @ordid bigint, 
     @wrkid int, 
     @jbid bigint, 
     @wsid int, 
     @wsstatus nvarchar(50), 
     @operation varchar(50) output, 
     @errorinfo nvarchar(4000) output
  ) 
as  
begin  
set nocount on  
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
declare @nonedate datetime 
set @nonedate = CONVERT(datetime,'1910-1-1')
declare @ord2group2 nvarchar(50) 
set @ord2group2 = '' 
declare @sys_recid bigint 
set @sys_recid = 0 
 set @operation = 'continue'
 set @errorinfo = '' 
 --- 以下是预处理事件中的临时表
 
exec drop_temp_table '#detail2' 
select *,null recid into #detail2 from order_241_2 with(nolock) where ord2_ordid=@ordid  
declare @detail2_old  table (ord2_id bigint) 
insert  into @detail2_old (ord2_id) select ord2_id from #detail2

 ---- 以下是开发人员写的 before link job 事件 --------------
 --删除敏感用户数据
delete from #detail2 where exists (select cc_mobile from mps_customer where cc_tag = 0 and cc_ctid = 5 and ord2_hm = cc_mobile)
 ---- 以上是开发人员写的 before libk job 事件 --------------
 
 if (@operation='continue') 
 begin
 set @nonedate= @nonedate  -- here useless 
 
delete order_241_2 with(rowlock) 
from  (select ord2_id from @detail2_old  where ord2_id not in ( 
select recid from #detail2)) a where order_241_2.ord2_id=a.ord2_id 

end 
--- 清除临时表 
exec drop_temp_table '#detail2'

set nocount off 
end