mybatis中数据库字段直接更新操作
BigDecimal size = new BigDecimal("1000");
// <>里面是对应的实体信息
UpdateWrapper<StandMaterialFolderInfo> updateWrapper = Wrappers.update();
// 更新字段
updateWrapper.setSql(" folder_size = folder_size+" + size)
// 查询条件
.in("id", ids);
return update(updateWrapper);
在这里插入代码片
这样操作直接利用数据库的排他锁进行相应金额字段的更新,是线程安全的。