update ic_on_hand_num set product_date=#{productDate, jdbcType=DATE}, expire_date=#{expireDate, jdbcType=DATE},nonhandnum = nonhandnum + #{nonhandnum}, pk_modified=#{pkModified},modified_time=#{modifiedTime} where del_flag=0 and pk_id=#{pkId} merge into ic_on_hand_num a using( select #{item.pkId} pk_id,#{item.nonhandnum} nonhandnum, #{item.pkModified} pk_modified,#{item.modifiedTime} modified_time from dual ) b on (a.pk_id=b.pk_id) when matched then update set a.nonhandnum = a.nonhandnum + b.nonhandnum, a.pk_modified=b.pk_modified,a.modified_time=b.modified_time where a.del_flag=0 and a.nonhandnum + b.nonhandnum >=0 merge into ic_on_hand_num a using( select pk_onhandnum pk_id,sum(nnum) nnum,#{pkMember} pk_modified,sysdate modified_time from ( select #{item.pkOnhandnum} pk_onhandnum,#{item.nnum} nnum from dual ) group by pk_onhandnum ) b on (a.pk_id=b.pk_id) when matched then update set a.nonhandnum = a.nonhandnum + b.nnum, a.pk_modified=b.pk_modified,a.modified_time=b.modified_time