if exists(select 1 from sysobjects where name='pr_down_item_cls')
  drop procedure pr_down_item_cls
go

create PROCEDURE pr_down_item_cls
(
	@item_clsno   varchar(20),
	@item_clsname varchar(20),
	@cls_parent	  varchar(6),
	@outParam varchar(20) output
)
AS
BEGIN
	--下传商品类别
	--比对用不t_sys_cm_breakpoint中com_table里等于t_bd_item_cls is_change列等于1的下载比对
	--实例select * from t_sys_cm_breakpoint where com_table='t_bd_item_cls' and is_change='1' and branch_no='门店编号',同步完修改is_change='0'

	if not exists(select * from t_bd_item_cls where item_clsno=@item_clsno)
	begin
		insert into t_bd_item_cls(item_clsno,item_clsname,cls_parent)
				values(@item_clsno,@item_clsname,@cls_parent)
	end 
	else
	begin
		update t_bd_item_cls
		set item_clsname=@item_clsname
		where item_clsno=@item_clsno
	end

	select @outParam=''
End
go