update QualityMonitoringGoods set materialDefinitionId = (select id from MaterialDefinition where QualityMonitoringGoods.material = case when specification is null then name else name + '['+ specification +']' end) where material is not null and material <> '' and materialDefinitionId is null;