明树Git Lab

Commit 6a05e673 authored by zfp1's avatar zfp1

update

parent c22dd2cf
......@@ -18,7 +18,7 @@ async function listPlantCycle(req, res, next) {
search.name = req.body.name;
}
const count = await DB.PlantCycle.countDocuments(search);
let list = await DB.PlantCycle.find(search).sort({_id: -1}).skip(skip).limit(pageSize);
let list = await DB.PlantCycle.find(search).sort({_id: -1}).populate({path: "img"}).skip(skip).limit(pageSize);
res.sendData({ count, list });
} catch (error) {
next(error)
......
......@@ -19,7 +19,7 @@ async function listDeepPlant(req, res, next) {
let skip = (page - 1) * pageSize;
const count = await DB.ProductDeep.countDocuments(search);
let list = await DB.ProductDeep.find(search).sort({_id: -1}).skip(skip).limit(pageSize);
let list = await DB.ProductDeep.find(search).populate({path: "productPhotos"}).sort({_id: -1}).skip(skip).limit(pageSize);
res.sendData({ count, list });
} catch (error) {
next(error);
......
......@@ -19,7 +19,7 @@ async function listDirectPlant(req, res, next) {
let skip = (page - 1) * pageSize;
const count = await DB.ProductPlant.countDocuments(search);
let list = await DB.ProductPlant.find(search).sort({_id: -1}).skip(skip).limit(pageSize);
let list = await DB.ProductPlant.find(search).populate({path: "productPhotos"}).sort({_id: -1}).skip(skip).limit(pageSize);
res.sendData({ count, list });
} catch (error) {
next(error);
......
......@@ -20,7 +20,7 @@ async function listPrePlant(req, res, next) {
let skip = (page - 1) * pageSize;
const count = await DB.ProductPre.countDocuments(search);
let list = await DB.ProductPre.find(search).sort({_id: -1}).skip(skip).limit(pageSize);
let list = await DB.ProductPre.find(search).populate({pat: "productPhotos"}).sort({_id: -1}).skip(skip).limit(pageSize);
res.sendData({ count, list });
} catch (error) {
next(error);
......
......@@ -29,8 +29,11 @@ const letianProductPreSchema = new Schema({
comment: "库存量"
},
productPhotos: {
type: String,
comment: "产品照片"
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "物品照片",
default: null,
set: v => {if(!v) {return null;} else {return v;}}
},
introduction: {
type: String,
......
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