opt: 查询空框锁优化

This commit is contained in:
yanps
2024-08-19 17:12:17 +08:00
parent 3eb61381fb
commit 00ae54b0dc

View File

@@ -68,7 +68,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Autowired
private ISysNoticeService noticeService;
private final String nameClass = "SchBasePoint";
private final Object lock = new Object();
@Override
@@ -389,7 +389,7 @@ public class SchBasePointServiceImpl extends ServiceImpl<SchBasePointMapper, Sch
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public SchBasePoint selectByEmptyCage(String region_code, String vehicle_type, String pointStatus, boolean isVehicle, SchBaseTask task) {
synchronized (this.nameClass){
synchronized (lock){
List<SchBasePoint> schBasePoints = pointMapper.selectList(Wrappers.lambdaQuery(SchBasePoint.class)
.eq(SchBasePoint::getIs_lock, false)
.eq(SchBasePoint::getIs_used, true)