明树Git Lab

Commit ea2181a5 authored by zengfanpei's avatar zengfanpei

update

parent 1f2d5b07
......@@ -42,7 +42,7 @@ async function list (req, res, next) {
search.name = { $regex: req.body.name };
}
const count = await DB.Land.countDocuments(search);
const list = await DB.Land.find(search).skip(skip).limit(pageSize);
const list = await DB.Land.find(search).populate({path: "zone"}).skip(skip).limit(pageSize).lean().exec();
return res.sendData({ list, count });
} catch (error) {
next(error);
......
......@@ -7,7 +7,9 @@ const moment = require('moment');
*/
const AgrTaskSchema = new Schema({
content: {
},
creator: {
type: mongoose.Types.ObjectId,
......
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const moment = require('moment');
/**
* 农资管理-农资基础信息表
*/
const AgrMaterialSchema = new Schema({
type: {
type: mongoose.Types.ObjectId,
comment: "农资类型"
},
name: {
type: mongoose.Types.ObjectId,
comment: "农资名称"
},
count: {
type: Number,
comment: "农资库存数量"
},
createdAt: {
type: Date,
default: Date.now,
get: v => moment(v).format("YYYY-MM-DD HH:mm:ss"),
},
updatedAt: {
type: Date,
default: Date.now,
get: v => moment(v).format("YYYY-MM-DD HH:mm:ss"),
},
del: {
type: Number,
default: 0,
comment: '默认0 , 1:表示删除, 若有其他隐藏业务 不要混用此字段。'
}
}, {
toJSON: {
getters: true
}
});
const AgrMaterial = mongoose.model('AgrMaterial', AgrMaterialSchema, 'letianAgrMaterial');
module.exports = AgrMaterial;
\ No newline at end of file
......@@ -39,6 +39,7 @@ const landSchema = new Schema({
},
zone: {
type: mongoose.Types.ObjectId,
ref: "Zone",
comment: "地块隶属于哪一个园区, 理论上每一级都可以绑定地块, 建议只能选择zone的最后一级"
},
/* -----地理信息----- */
......
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