CodePudding user response:
Add a timestamp timestamp field optimistic locking, program came in to check inventory quantity of timestamp values
The select timestamp from store name='watermelon'
Find out timestamp=11111
To update the stock
The update store set amount=amount - 1 where timestamp=11111 and name='watermelon'
The update is successful effects & gt; 0, deduct success means the inventory
CodePudding user response:
Bosses have practical application?