Merge pull request #1484 from congyuluo/identifier-refactorings

Refactored Identifiers
This commit is contained in:
Chat2DB
2024-10-28 13:53:32 +08:00
committed by GitHub
4 changed files with 14 additions and 14 deletions

View File

@ -66,8 +66,8 @@ public class DashboardServiceImpl implements DashboardService {
@Override
public ActionResult updateWithPermission(DashboardUpdateParam param) {
Dashboard data = queryExistent(param.getId()).getData();
PermissionUtils.checkOperationPermission(data.getUserId());
Dashboard dashboardData = queryExistent(param.getId()).getData();
PermissionUtils.checkOperationPermission(dashboardData.getUserId());
param.setGmtModified(LocalDateTime.now());
DashboardDO dashboardDO = dashboardConverter.updateParam2do(param);
@ -106,14 +106,14 @@ public class DashboardServiceImpl implements DashboardService {
if (CollectionUtils.isEmpty(page.getRecords())) {
throw new DataNotFoundException();
}
Dashboard data = dashboardConverter.do2model(page.getRecords().get(0));
Dashboard dashboardData = dashboardConverter.do2model(page.getRecords().get(0));
LambdaQueryWrapper<DashboardChartRelationDO> dashboardChartRelationQueryWrapper = new LambdaQueryWrapper<>();
dashboardChartRelationQueryWrapper.eq(DashboardChartRelationDO::getDashboardId, param.getId());
List<DashboardChartRelationDO> relationDO = getMapper1().selectList(
dashboardChartRelationQueryWrapper);
List<Long> chartIds = relationDO.stream().map(DashboardChartRelationDO::getChartId).toList();
data.setChartIds(chartIds);
return DataResult.of(data);
dashboardData.setChartIds(chartIds);
return DataResult.of(dashboardData);
}
@Override

View File

@ -87,16 +87,16 @@ public class DatabaseServiceImpl implements DatabaseService {
log.error("get url error", e);
}
// If the database name contains the name of the current database, the current database is placed in the first place
int num = -1;
int targetIndex = -1;
for (int i = 0; i < schemas.size(); i++) {
String schema = schemas.get(i).getName();
if (StringUtils.isNotBlank(ulr) && schema!=null && ulr.contains(schema)) {
num = i;
targetIndex = i;
break;
}
}
if (num != -1 && num != 0) {
Collections.swap(schemas, num, 0);
if (targetIndex != -1 && targetIndex != 0) {
Collections.swap(schemas, targetIndex, 0);
}
}