添加字段和表
parent
9d2957bbec
commit
d52b2f8768
|
@ -13,5 +13,5 @@ import com.muyu.common.domian.resp.TaskInfoResp;
|
||||||
public interface TaskInfoService extends IService<TaskInfo> {
|
public interface TaskInfoService extends IService<TaskInfo> {
|
||||||
Page<TaskInfoResp> selectList(TaskInfoListReq req);
|
Page<TaskInfoResp> selectList(TaskInfoListReq req);
|
||||||
|
|
||||||
String findByFieName(Long taskId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,59 +63,4 @@ public class TaskInfoServiceImpl extends ServiceImpl<TaskInfoMapper, TaskInfo> i
|
||||||
return respPage;
|
return respPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String findByFieName(Long taskId) {
|
|
||||||
QueryWrapper<TaskInput> wrapper = new QueryWrapper<>();
|
|
||||||
wrapper.eq("task_id", taskId);
|
|
||||||
HashSet<Long> longs = new HashSet<>();
|
|
||||||
List<TaskInput> list = taskInputService.list(wrapper);
|
|
||||||
if (CollectionUtils.isEmpty(list)) {
|
|
||||||
return "没有选择字段";
|
|
||||||
}
|
|
||||||
String fieName = "";
|
|
||||||
for (int i = 0; i < list.size(); i++) {
|
|
||||||
fieName += "," + list.get(i).getTableAsFieId();
|
|
||||||
Long databaseId = list.get(i).getDatabaseId();
|
|
||||||
longs.add(databaseId);
|
|
||||||
}
|
|
||||||
if (longs.size() > 1) {
|
|
||||||
return "你选择的不是同一个数据库";
|
|
||||||
}
|
|
||||||
QueryWrapper<NodeJoint> jointQueryWrapper = new QueryWrapper<>();
|
|
||||||
jointQueryWrapper.eq("task_id", taskId);
|
|
||||||
List<NodeJoint> jointList = nodeJointService.list(jointQueryWrapper);
|
|
||||||
String joint = "";
|
|
||||||
if (!CollectionUtils.isEmpty(jointList)) {
|
|
||||||
for (NodeJoint nodeJoint : jointList) {
|
|
||||||
String oneNodeId = nodeJoint.getOneNodeId();
|
|
||||||
TaskInput taskInput = taskInputService.selectByNodeId(oneNodeId);
|
|
||||||
String tableName = taskInput.getTableName();
|
|
||||||
String tableAsName = taskInput.getTableAsName();
|
|
||||||
|
|
||||||
String twoNodeId = nodeJoint.getTwoNodeId();
|
|
||||||
TaskInput taskInputTwo = taskInputService.selectByNodeId(twoNodeId);
|
|
||||||
String tableNameTwo = taskInputTwo.getTableName();
|
|
||||||
String tableAsNameTwo = taskInputTwo.getTableAsName();
|
|
||||||
joint += " " + tableName + " " + " " + tableAsName + " " + nodeJoint.getJoint()
|
|
||||||
+ " " + tableNameTwo + " " + " " + tableAsNameTwo + " on " + nodeJoint.getOneFie()
|
|
||||||
+ " = " + nodeJoint.getTwoFie();
|
|
||||||
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
TaskInput taskInput = taskInputService.selectByTaskId(taskId);
|
|
||||||
String tableName = taskInput.getTableName();
|
|
||||||
String tableAsName = taskInput.getTableAsName();
|
|
||||||
joint=" "+ tableName+" "+tableAsName;
|
|
||||||
}
|
|
||||||
Long basicId = taskInputService.selectByBasicId(taskId);
|
|
||||||
fieName = fieName.substring(1);
|
|
||||||
String sql = " SELECT " + fieName + " FROM "+ joint;
|
|
||||||
System.out.println(sql);
|
|
||||||
Result<List<List<DataValue>>> tableValueResult = datasourceFeign.findTableValue(basicId, sql);
|
|
||||||
List<List<DataValue>> tableValue = tableValueResult.getData();
|
|
||||||
for (List<DataValue> dataValues : tableValue) {
|
|
||||||
System.out.println(dataValues);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
where task_id =${taskId}
|
where task_id =${taskId}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByBasicId" resultType="java.lang.Long">
|
<select id="selectByBasicId" resultType="java.lang.Long">
|
||||||
SELECT DISTINCT basic_id
|
SELECT DISTINCT database_id
|
||||||
FROM etl_task_input e left join table_info t on e.database_id=t.id
|
FROM etl_task_input e left join table_info t on e.database_id=t.id
|
||||||
where task_id =${taskId}
|
where task_id =${taskId}
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in New Issue