update GoodPurchaseItem set disposableGoodsId = (select id from DisposableGoods where GoodPurchaseItem.name= case when specification is null then name else name + '['+ specification +']' end)
where disposableGoodsId is null;

update GoodPurchaseItem set materialDefinitionId = (select id from MaterialDefinition where GoodPurchaseItem.name= case when specification is null then name else name + '['+ specification +']' end)
where materialDefinitionId is null;

update TousseDefinition set ancestorID=id where ancestorID is null;

select id , name into temp  from TousseDefinition where tousseType in ('消毒物品') and forDisplay=1;
update TousseDefinition set ancestorID=(select id from temp where name=TousseDefinition.name) where tousseType in ('消毒物品') and forDisplay=0 and (select id from temp where name=TousseDefinition.name) is not null;
drop table temp;