sql语句批量更新的简单写法

最近需要批量更新一批数据,需要用到批量更新的方式,看了一点动态sql,写了个这个,虽然性能不算很高,勉强能用,日后有机会在把case when的高性能sql研究一下

传入的是个map,map里面放着一个list.


	    
		 UPDATE account_generalledger SET initialAmount = #{item.initialAmount,jdbcType=DECIMAL},
		 		debit = #{item.debit,jdbcType=DECIMAL},
		 		credit = #{item.credit,jdbcType=DECIMAL},
		 		totalAmount = #{item.totalAmount,jdbcType=DECIMAL},
				initialFC = #{item.initialFC,jdbcType=DECIMAL},
				debitFC = #{item.debitFC,jdbcType=DECIMAL},
				creditFC = #{item.creditFC,jdbcType=DECIMAL},
				totalFC = #{item.totalFC,jdbcType=DECIMAL},
				initialNum = #{item.initialNum,jdbcType=DECIMAL},
				debitNum = #{item.debitNum,jdbcType=DECIMAL},
				creditNum = #{item.creditNum,jdbcType=DECIMAL},
				totalNum = #{item.totalNum,jdbcType=DECIMAL},
				updateUserCode = #{updateUserCode,jdbcType=VARCHAR},
				updateTime = SYSDATE() 
		 WHERE companyId = #{companyId,jdbcType=VARCHAR} 
		 AND subjectId = #{item.subjectId,jdbcType=INTEGER} 
		 AND periodId = #{item.periodId,jdbcType=INTEGER}
	   
	

 

你可能感兴趣的:(代码篇)