From 341eae8c7b1a35d9654a682425dae00d5bb004ba Mon Sep 17 00:00:00 2001 From: ycl Date: Fri, 15 Aug 2025 18:03:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20llms-full.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- llms-full.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llms-full.txt b/llms-full.txt index 8840e98..37f4a3d 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -1442,5 +1442,7 @@ requestParams为请求参数列表,response为返回结构,requestParams中 - 本章节描述的是参数选择的**优先级原则**,不是绝对限制 - API参数的绝对限制请参考2.14章节 - "优先使用QTO/BTO"意思是在满足规范的前提下,根据场景选择最合适的参数类型 +#### 4.2 在处理先读,后更新的场景的时候,为了避免并发引起的数据脏写,应该充分利用BoService的校验功能。 例如:在账户扣钱的情况,为了避免账户在并发扣除余额不足,在用raw sql实现中,我们一般会 通过 update account set balance = balance - amount where user_id = xxx and blance > amount 的 where 条件保护;在toco中, +应该1、在写方案中使用incr字段。 2、 在boService中,添加类似保护代码 if(userBo.getBalance >= 0) 进行保护;或则通过userBo的业务不变性,添加balance>=0的校验 -----------------------------------------------------------------------------