1.本人在項目中經常用到的代碼塊爲:
<update id="updateConsumeStarWithLook">
update sys_user_consume_star
set current_consume_star_amount = current_consume_star_amount + #{currentConsumeStarAmount, jdbcType=VARCHAR},
update_time = #{updateTime, jdbcType=TIMESTAMP},
where id = #{id}
</update>
2、在具體調用上述方法的方法上如果需要加上事務,則需要將事務的隔離級別定義爲讀已提交,不然在查詢的時候會出現髒讀,更新無法成功,導致死循環
@Transactional(rollbackFor = Exception.class,isolation=Isolation.READ_COMMITTED,propagation=Propagation.REQUIRED)