mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 07:46:40 +08:00
perf(warehouse): 优化库存商品更新操作的性能
- 在保存库存商品实体后,添加了 EntityManager 的 flush 操作 - 这样可以确保在更新数据库之前,所有待处理的变更都被提交- 从而避免不必要的数据库查询,提高系统性能
This commit is contained in:
@@ -60,6 +60,7 @@ public class WarehouseGoodsService
|
||||
WarehouseGoodsEntity entity = mapper.toEntity(request);
|
||||
|
||||
this.repository.save(entity);
|
||||
em.flush();
|
||||
em.refresh(entity);
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user