use of com.dtstack.taier.develop.dto.devlop.ReadWriteLockVO in project Taier by DTStack.
the class ReadWriteLockService method addOrUpdateLock.
/**
* 新增、更新 锁信息
* @param tenantId
* @param userId
* @param type
* @param fileId
* @return
*/
@Transactional(rollbackFor = Exception.class)
public ReadWriteLockVO addOrUpdateLock(Long tenantId, Long userId, String type, Long fileId) {
ReadWriteLockVO readWriteLockVO;
BatchReadWriteLock readWriteLock = developReadWriteLockDao.getByTenantIdAndRelationIdAndType(tenantId, fileId, type);
if (readWriteLock == null) {
readWriteLockVO = this.insert(tenantId, fileId, type, userId);
} else {
Integer result = 0;
result = developReadWriteLockDao.updateVersionAndModifyUserId(readWriteLock.getId(), null, userId);
readWriteLock = developReadWriteLockDao.getOne(readWriteLock.getId());
readWriteLockVO = ReadWriteLockVO.toVO(readWriteLock);
String userName = userService.getUserName(readWriteLock.getModifyUserId());
readWriteLockVO.setLastKeepLockUserName(userName);
}
return readWriteLockVO;
}
Aggregations