明树Git Lab

Commit cd3d8a75 authored by zfp1's avatar zfp1

update

parent 0b9cdcf3
......@@ -5,11 +5,11 @@ async function createDeepPlant(req, res, next) {
const body = req.body;
let count = await DB.ProductDeep.countDocuments(); //没有真实删除 永远递增
body.productNumber = count;
body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
// body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
// body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
body.productPhotos2 = (body.productPhotos2 || []).map(o => {return o && o._id || o});
body.homepageCarouselImgs = (body.homepageCarouselImgs || []).map(o => {return o && o._id || o});
body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
// body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
let ret = await DB.ProductDeep.create(body);
res.sendData(ret);
} catch (error) {
......@@ -26,7 +26,7 @@ async function listDeepPlant(req, res, next) {
search.preProductName = {$regex: req.body.name}
}
const count = await DB.ProductDeep.countDocuments(search);
let list = await DB.ProductDeep.find(search).populate({path: "productPhotos2"}).populate({path: "qualityInsReportImgs"}).populate({path: "flourMerchantImgs"}).populate({path: "pesticidetImgs"}).populate({path: "homepageCarouselImgs"}).populate({path: "monitorInfo.device"}).sort({_id: -1}).skip(skip).limit(pageSize).lean().exec();
let list = await DB.ProductDeep.find(search).populate({path: "productPhotos2"}).populate({path: "homepageCarouselImgs"}).populate({path: "monitorInfo.device"}).sort({_id: -1}).skip(skip).limit(pageSize).lean().exec();
res.sendData({ count, list });
} catch (error) {
next(error);
......@@ -49,11 +49,11 @@ async function updateDeepPlant(req, res, next) {
return res.sendError(errorMessage.resourceNotFound);
}
let body = req.body;
body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
// body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
// body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
body.productPhotos2 = (body.productPhotos2 || []).map(o => {return o && o._id || o});
body.homepageCarouselImgs = (body.homepageCarouselImgs || []).map(o => {return o && o._id || o});
body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
// body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
let upInfo = {
...body,
_id: undefined,
......
......@@ -5,11 +5,11 @@ async function createDirectPlant(req, res, next) {
const body = req.body;
let count = await DB.ProductPlant.countDocuments(); //没有真实删除 永远递增
body.productNumber = count;
body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
// body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
// body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
// body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
body.homepageCarouselImgs = (body.homepageCarouselImgs || []).map(o => {return o && o._id || o});
body.productPhotos2 = (body.productPhotos2 || []).map(o => {return o && o._id || o});
body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
let ret = await DB.ProductPlant.create(body);
res.sendData(ret);
} catch (error) {
......@@ -27,7 +27,7 @@ async function listDirectPlant(req, res, next) {
}
const count = await DB.ProductPlant.countDocuments(search);
let list = await DB.ProductPlant.find(search).populate({path: "plantPlan"}).populate({path: "pesticidetImgs"}).populate({path: "homepageCarouselImgs"}).populate({path: "productPhotos2"}).populate({path: "qualityInsReportImgs"}).populate({path: "flourMerchantImgs"}).populate({path: "monitorInfo.device"}).sort({_id: -1}).skip(skip).limit(pageSize).lean().exec();
let list = await DB.ProductPlant.find(search).populate({path: "plantPlan"}).populate({path: "homepageCarouselImgs"}).populate({path: "productPhotos2"}).populate({path: "monitorInfo.device"}).sort({_id: -1}).skip(skip).limit(pageSize).lean().exec();
res.sendData({ count, list });
} catch (error) {
next(error);
......@@ -50,11 +50,11 @@ async function updateDirectPlant(req, res, next) {
return res.sendError(errorMessage.resourceNotFound);
}
let body = req.body;
body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
// body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
// body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
// body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
body.homepageCarouselImgs = (body.homepageCarouselImgs || []).map(o => {return o && o._id || o});
body.productPhotos2 = (body.productPhotos2 || []).map(o => {return o && o._id || o});
body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
let upInfo = {
...body,
_id: undefined,
......
......@@ -6,9 +6,9 @@ async function createPrePlant(req, res, next) {
const body = req.body;
let count = await DB.ProductPre.countDocuments(); //没有真实删除 永远递增
body.productNumber = count;
body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
// body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
// body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
// body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
body.homepageCarouselImgs = (body.homepageCarouselImgs || []).map(o => {return o && o._id || o});
body.productPhotos2 = (body.productPhotos2 || []).map(o => {return o && o._id || o});
let ret = await DB.ProductPre.create(body);
......@@ -27,7 +27,7 @@ async function listPrePlant(req, res, next) {
search.preProductName = {$regex: req.body.name}
}
const count = await DB.ProductPre.countDocuments(search);
let list = await DB.ProductPre.find(search).populate({path: "productPhotos2"}).populate({path: "sourcePlantProduct"}).populate({path: "qualityInsReportImgs"}).populate({path: "flourMerchantImgs"}).populate({path: "pesticidetImgs"}).populate({path: "homepageCarouselImgs"}).populate({path: "monitorInfo.device"}).sort({_id: -1}).skip(skip).limit(pageSize).lean().exec();
let list = await DB.ProductPre.find(search).populate({path: "productPhotos2"}).populate({path: "sourcePlantProduct"}).populate({path: "homepageCarouselImgs"}).populate({path: "monitorInfo.device"}).sort({_id: -1}).skip(skip).limit(pageSize).lean().exec();
res.sendData({ count, list });
} catch (error) {
next(error);
......@@ -50,9 +50,9 @@ async function updatePrePlant(req, res, next) {
return res.sendError(errorMessage.resourceNotFound);
}
let body = req.body;
body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
// body.qualityInsReportImgs = (body.qualityInsReportImgs || []).map(o => {return o && o._id || o});
// body.flourMerchantImgs = (body.flourMerchantImgs || []).map(o => {return o && o._id || o});
// body.pesticidetImgs = (body.pesticidetImgs || []).map(o => {return o && o._id || o});
body.homepageCarouselImgs = (body.homepageCarouselImgs || []).map(o => {return o && o._id || o});
body.productPhotos2 = (body.productPhotos2 || []).map(o => {return o && o._id || o});
let upInfo = {
......
This diff is collapsed.
......@@ -99,6 +99,28 @@ const letianProTraceCodeSchema = new Schema({
type: Boolean,
},
flourMerchantImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "面粉商原料检测报告图"
}
],
qualityInsReportImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "质检报告图"
}
],
pesticidetImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "农残质检报告"
}
],
creator: {
type: mongoose.Types.ObjectId,
ref: 'User',
......
......@@ -43,13 +43,6 @@ const letianProductDeepSchema = new Schema({
comment: "产品详情轮播图"
}
],
pesticidetImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "农残质检报告"
}
],
sellByDate: {
type: String,
comment: "保质期"
......@@ -83,13 +76,6 @@ const letianProductDeepSchema = new Schema({
type: String,
comment: "产品编号"
},
qualityInsReportImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "质检报告图"
}
],
monitorInfo: {
type: [
{
......@@ -164,14 +150,6 @@ const letianProductDeepSchema = new Schema({
get: v => moment(v).format("YYYY-MM-DD"),
comment: "生产日期"
},
flourMerchantImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "面粉商原料检测报告图"
}
],
createdAt: {
......
......@@ -70,20 +70,20 @@ const letianProductPlantSchema = new Schema({
type: Number,
comment: "产品编号"
},
qualityInsReportImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "质检报告图"
}
],
pesticidetImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "农残质检报告"
}
],
// qualityInsReportImgs: [
// {
// type: mongoose.Types.ObjectId,
// ref: 'File',
// comment: "质检报告图"
// }
// ],
// pesticidetImgs: [
// {
// type: mongoose.Types.ObjectId,
// ref: 'File',
// comment: "农残质检报告"
// }
// ],
monitorInfo: {
type: [
{
......@@ -145,13 +145,13 @@ const letianProductPlantSchema = new Schema({
get: v => moment(v).format("YYYY-MM-DD"),
comment: "生产日期"
},
flourMerchantImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "面粉商原料检测报告图"
}
],
// flourMerchantImgs: [
// {
// type: mongoose.Types.ObjectId,
// ref: 'File',
// comment: "面粉商原料检测报告图"
// }
// ],
createdAt: {
type: Date,
......
......@@ -76,20 +76,20 @@ const letianProductPreSchema = new Schema({
type: String,
comment: "产品编号"
},
qualityInsReportImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "质检报告图"
}
],
pesticidetImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "农残质检报告"
}
],
// qualityInsReportImgs: [
// {
// type: mongoose.Types.ObjectId,
// ref: 'File',
// comment: "质检报告图"
// }
// ],
// pesticidetImgs: [
// {
// type: mongoose.Types.ObjectId,
// ref: 'File',
// comment: "农残质检报告"
// }
// ],
monitorInfo: { //农业
type: [
{
......@@ -152,13 +152,13 @@ const letianProductPreSchema = new Schema({
get: v => moment(v).format("YYYY-MM-DD"),
comment: "生产日期"
},
flourMerchantImgs: [
{
type: mongoose.Types.ObjectId,
ref: 'File',
comment: "面粉商原料检测报告图"
}
],
// flourMerchantImgs: [
// {
// type: mongoose.Types.ObjectId,
// ref: 'File',
// comment: "面粉商原料检测报告图"
// }
// ],
createdAt: {
type: Date,
......
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