main
黄海 2 years ago
parent 3ff5856344
commit eeb7f3a744

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