任务列表添加数据库名称

This commit is contained in:
hekaiyu 2025-10-11 14:48:35 +08:00
parent fd102a9518
commit 2b8d1ce7da
2 changed files with 30 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -84,4 +85,11 @@ public class StasTaskConfig implements Serializable {
@Excel(name = "描述", width = 15)
@Schema(description = "描述")
private String description;
/**源库名称*/
@TableField(exist = false)
private String sourceName;
/**目标库名称*/
@TableField(exist = false)
private String targetName;
}

View File

@ -2,6 +2,9 @@ package org.jeecg.taskConfig.controller;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import jakarta.servlet.http.HttpServletRequest;
@ -10,6 +13,8 @@ import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.enums.SyncTaskStatusEnum;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.dataSource.service.IStasDataSourceService;
import org.jeecg.modules.base.entity.StasDataSource;
import org.jeecg.modules.base.entity.StasSyncStrategy;
import org.jeecg.modules.base.entity.StasTaskConfig;
import org.jeecg.quartz.entity.QuartzJob;
@ -47,6 +52,8 @@ public class StasTaskConfigController extends JeecgController<StasTaskConfig, IS
private IStasTaskConfigService stasTaskConfigService;
@Autowired
private IStasSyncStrategyService stasSyncStrategyService;
@Autowired
private IStasDataSourceService stasDataSourceService;
/**
* 分页列表查询
@ -72,6 +79,21 @@ public class StasTaskConfigController extends JeecgController<StasTaskConfig, IS
}
Page<StasTaskConfig> page = new Page<StasTaskConfig>(pageNo, pageSize);
IPage<StasTaskConfig> pageList = stasTaskConfigService.page(page, queryWrapper);
List<StasTaskConfig> records = pageList.getRecords();
Map<String, String> dataSourceMap = stasDataSourceService.list().stream().
collect(Collectors.toMap(StasDataSource::getId, StasDataSource::getInstanceName));
for (StasTaskConfig record : records) {
String sourceName = dataSourceMap.get(record.getSourceId());
if (sourceName != null) {
record.setSourceName(sourceName);
}
String targetName = dataSourceMap.get(record.getTargetId());
if (targetName != null) {
record.setTargetName(targetName);
}
}
pageList.setRecords(records);
return Result.OK(pageList);
}