main
黄海 2 years ago
parent 3ff5856344
commit eeb7f3a744

@ -1727,18 +1727,34 @@ public class CollectModel {
* @return
*/
public List<Record> getTableDataByJobId(int job_id, String table_name) {
String sql = "select job_id from t_collect_job where parent_id=?";
List<Record> list = Db.find(sql, job_id);
List<Integer> jobList = new ArrayList<>();
dfsJob(job_id, jobList);
String ids = job_id + ",";
for (Record record : list) {
ids += record.getStr("job_id") + ",";
for (Integer x : jobList) {
ids += x + ",";
}
if (ids.length() > 0) ids = ids.substring(0, ids.length() - 1);
sql = "select * from " + table_name + " where job_id in(" + ids + ")";
String sql = "select * from " + table_name + " where job_id in(" + ids + ")";
return Db.find(sql);
}
/**
* IDS
*
* @param job_id
* @param jobList
*/
public void dfsJob(int job_id, List<Integer> jobList) {
String sql = "select job_id from t_collect_job where parent_id=?";
List<Record> list = Db.find(sql, job_id);
jobList.add(job_id);
for (Record record : list) {
jobList.add(record.getInt("job_id"));
dfsJob(record.getInt("job_id"), jobList);
}
}
/**
*
*

Loading…
Cancel
Save