|
@@ -77,7 +77,7 @@ public class OnlineTableServiceImpl extends BaseService<OnlineTable, Long> imple
|
|
|
public OnlineTable saveNewFromSqlTable(SqlTable sqlTable) {
|
|
|
OnlineTable onlineTable = new OnlineTable();
|
|
|
onlineTable.setDblinkId(sqlTable.getDblinkId());
|
|
|
- onlineTable.setTableId(idGenerator.nextLongId() + "");
|
|
|
+ onlineTable.setTableId(idGenerator.nextLongId());
|
|
|
onlineTable.setTableName(sqlTable.getTableName());
|
|
|
String modelName = CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, sqlTable.getTableName());
|
|
|
onlineTable.setModelName(modelName);
|
|
@@ -115,7 +115,7 @@ public class OnlineTableServiceImpl extends BaseService<OnlineTable, Long> imple
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public boolean remove(String tableId) {
|
|
|
+ public boolean remove(Long tableId) {
|
|
|
if (onlineTableMapper.deleteById(tableId) == 0) {
|
|
|
return false;
|
|
|
}
|
|
@@ -131,7 +131,7 @@ public class OnlineTableServiceImpl extends BaseService<OnlineTable, Long> imple
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public void removeByTableIdSet(Set<String> tableIdSet) {
|
|
|
+ public void removeByTableIdSet(Set<Long> tableIdSet) {
|
|
|
tableIdSet.forEach(this::evictTableCache);
|
|
|
onlineTableMapper.delete(
|
|
|
new QueryWrapper<OnlineTable>().lambda().in(OnlineTable::getTableId, tableIdSet));
|
|
@@ -200,14 +200,14 @@ public class OnlineTableServiceImpl extends BaseService<OnlineTable, Long> imple
|
|
|
* @return 查询后的在线表对象。
|
|
|
*/
|
|
|
@Override
|
|
|
- public OnlineTable getOnlineTableFromCache(String tableId) {
|
|
|
+ public OnlineTable getOnlineTableFromCache(Long tableId) {
|
|
|
String redisKey = OnlineRedisKeyUtil.makeOnlineTableKey(tableId);
|
|
|
RBucket<String> tableBucket = redissonClient.getBucket(redisKey);
|
|
|
if (tableBucket.isExists()) {
|
|
|
String tableInfo = tableBucket.get();
|
|
|
return JSON.parseObject(tableInfo, OnlineTable.class);
|
|
|
}
|
|
|
- OnlineTable table = this.getByIdWithRelation(Long.valueOf(tableId), MyRelationParam.full());
|
|
|
+ OnlineTable table = this.getByIdWithRelation(tableId, MyRelationParam.full());
|
|
|
if (table == null) {
|
|
|
return null;
|
|
|
}
|
|
@@ -220,7 +220,7 @@ public class OnlineTableServiceImpl extends BaseService<OnlineTable, Long> imple
|
|
|
table.setLogicDeleteColumn(column);
|
|
|
}
|
|
|
}
|
|
|
- Map<String, OnlineColumn> columnMap =
|
|
|
+ Map<Long, OnlineColumn> columnMap =
|
|
|
table.getColumnList().stream().collect(Collectors.toMap(OnlineColumn::getColumnId, c -> c));
|
|
|
table.setColumnMap(columnMap);
|
|
|
table.setColumnList(null);
|
|
@@ -230,7 +230,7 @@ public class OnlineTableServiceImpl extends BaseService<OnlineTable, Long> imple
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public OnlineColumn getOnlineColumnFromCache(String tableId, String columnId) {
|
|
|
+ public OnlineColumn getOnlineColumnFromCache(Long tableId, Long columnId) {
|
|
|
OnlineTable table = this.getOnlineTableFromCache(tableId);
|
|
|
if (table == null) {
|
|
|
return null;
|
|
@@ -238,7 +238,7 @@ public class OnlineTableServiceImpl extends BaseService<OnlineTable, Long> imple
|
|
|
return table.getColumnMap().get(columnId);
|
|
|
}
|
|
|
|
|
|
- private void evictTableCache(String tableId) {
|
|
|
+ private void evictTableCache(Long tableId) {
|
|
|
String tableIdKey = OnlineRedisKeyUtil.makeOnlineTableKey(tableId);
|
|
|
redissonClient.getBucket(tableIdKey).delete();
|
|
|
}
|