### Question:
GoodsRepository { public int minus(long goodsId, int delta) { if (goodsId < 1) { log.error("goodsId<1"); return 0; } final String queryVersionSql = "SELECT stock, version from " + TABLE_NAME + " WHERE id=?"; Map<String, Object> map = jdbcTemplate.queryForMap(queryVersionSql, new Object[]{goodsId} , new int[]{Types.BIGINT}); if (map != null && map.size() > 0) { int stock = (int) map.get("stock"); int versionValue = (int) map.get("version"); int newVersion = versionValue + 1; final String minusSql = "update " + TABLE_NAME + " set stock=?, version=? WHERE id=? AND version=?"; if (stock < 1) { log.info("---StockIsZero,goodsId={},version={}---", goodsId, newVersion); return 0; } if (versionValue < delta) { log.error("---versionValue<{}", delta); } int updatedCount = jdbcTemplate.update(minusSql , new Object[]{stock - delta, newVersion, goodsId, versionValue} , new int[]{Types.INTEGER, Types.INTEGER, Types.BIGINT, Types.INTEGER}); if (updatedCount == 0) { log.info("---MinusOperationIsRejected,goodsId={},newVersion={}", goodsId, newVersion); } return updatedCount; } return 0; }  TableData byPage(int page, int size, int type); @Deprecated int minusNotSafe(long goodsId, int delta); int minus(long goodsId, int delta); Optional<Goods> findById(long goodsId); int add(Goods goods); int update(Goods goods); int delete(long id);  }### Answer:
@Test public void minus() { long goodsId = 436665195520065536L; for (int i = 0; i < 80; i++) { goodsRepository.minus(goodsId, 1); } System.out.println("-----Done---"); }