明树Git Lab

Commit 141f898b authored by zengfanpei's avatar zengfanpei

update

parent c2df2c74
...@@ -37,7 +37,14 @@ async function list(req, res, next) { ...@@ -37,7 +37,14 @@ async function list(req, res, next) {
let skip = (page - 1) * pageSize; let skip = (page - 1) * pageSize;
let count = await collectIPSModule.count(search); let count = await collectIPSModule.count(search);
let data = await collectIPSModule.findList(search, {skip, limit: pageSize}); let data = await collectIPSModule.findList(search, {skip, limit: pageSize});
res.sendData({list: data, count}); let list = [];
for (let index = 0; index < data.length; index++) {
let element = data[index].toJSON();
let collectIPSResults = await DB.CollectIPSResult.find({data: element._id}).select('deviceNumber name count time _id').populate({path: "plan", select: 'name controlPlan'});
element.collectIPSResults = collectIPSResults;
list.push(element)
}
res.sendData({list, count});
} catch (error) { } catch (error) {
next(error); next(error);
} }
......
...@@ -45,14 +45,18 @@ const collectIPSResultSchema = new Schema({ ...@@ -45,14 +45,18 @@ const collectIPSResultSchema = new Schema({
type: mongoose.Types.ObjectId, type: mongoose.Types.ObjectId,
ref: "CollectIPSType", ref: "CollectIPSType",
comment: "虫子种类表id", comment: "虫子种类表id",
ref: "CollectIPSType"
}, },
plan: { plan: {
type: mongoose.Types.ObjectId, type: mongoose.Types.ObjectId,
comment: "防治建议表id", comment: "防治建议表id",
ref: "CollectIPSPlan"
}, },
data: { data: {
type: mongoose.Types.ObjectId, type: mongoose.Types.ObjectId,
comment: "硬件采集数据的id", comment: "硬件采集数据的id",
ref: "CollectIPS"
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment