杨村长Vue3开源组件库实战(Vue3+Vite+VitePress+TSX+Tailwind)
long count = this.count(paymentOrderLambdaQueryWrapper);
//存在相同业务单号的付款单则抛异常
if(count>0){
throw new RuntimeException("不可重单");
}else{
//无重复数据,创建付款单
this.save(paymentOrder);
//其他DB操作
...
}
} finally {
// 释放锁
if (lock.isLocked() && lock.isHeldByCurrentThread()) {
lock.unlock();
}
}}