and batch = #{batch} and (batch IS NULL OR batch = '') INSERT INTO asr_loc_detl(loc_no,zpallet,anfme,matnr,maktx,batch,specs,model,color,brand,price ,origin,weight,volume,modi_time,modi_user,appe_time,appe_user) VALUES ( #{item.locNo}, #{item.zpallet}, #{item.anfme}, #{item.matnr}, #{item.maktx}, #{item.batch}, #{item.specs}, #{item.model}, #{item.color}, #{item.brand}, #{item.price}, #{item.origin}, #{item.weight}, #{item.volume}, #{item.modiTime}, #{item.modiUser}, #{item.appeTime}, #{item.appeUser} ) delete from asr_loc_detl where 1=1 and loc_no = #{locNo} and matnr = #{matnr} update asr_loc_detl set anfme = #{anfme} , modi_time = getdate() where 1=1 and loc_no = #{locNo} and matnr = #{matnr} delete from asr_loc_detl where 1=1 and loc_no = #{locNo} and model = #{model} update asr_loc_detl set anfme = #{anfme} , modi_time = getdate() where 1=1 and loc_no = #{locNo} and model = #{model} and a.loc_no like '%' + #{loc_no} + '%' and a.matnr like '%' + #{matnr} + '%' and a.maktx like '%' + #{maktx} + '%' and a.anfme like '%' + #{anfme} + '%' and a.modi_time between #{startTime} and #{endTime} and b.crn_no=#{crnNo} and a.batch like '%' + #{batch} + '%' and a.specs like '%' + #{specs} + '%' UPDATE a SET a.matnr=b.matnr, a.specs=b.specs, a.maktx=b.maktx, a.unit=b.unit FROM asr_loc_detl a INNER JOIN man_mat b ON a.matnr=#{matnrOld} AND b.matnr=#{matnr};