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)