IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_prdctg_delete]') AND type = 'TR')
DROP TRIGGER [dbo].[mps_prdctg_delete]
GO
--产品类别删除的触发器
CREATE trigger [dbo].[mps_prdctg_delete] on [dbo].[mps_prdctg] for delete as
begin
    
declare @cmpid int 
select top 1 @cmpid = pc_cmpid from  deleted 
set @cmpid = isnull(@cmpid,0)

update mps_tableupdated set tu_updated=0 where  tu_table='mps_prdctg' and tu_cmpid=@cmpid 
insert into mps_sync(sk_type,sk_bizid,sk_objid,sk_operation,sk_tag2) 
select 22 , pc_id , pc_id , -1 , 0 from deleted 

delete mps_prdctg_users from deleted where pp_pcid=pc_id 

    
end