/** * Created by Tony on 2016/12/28. */ var mongoose = require('mongoose'); var smartcostdb = require('./../db/smartcostdb'); //var Schema = smartcostdb.mongoose.Schema; var Schema = mongoose.Schema; var RptTemplateDataSchema = new Schema({ "Data_Key": String, "discrete_data": Array, "master_data": Array, "detail_data": Array }); var TemplateData = smartcostdb.mongoose.model("temp_tpl_datas", RptTemplateDataSchema); //var TemplateData = smartcostdb.model("temp_tpl_datas", RptTemplateDataSchema); var RplTplDataDAO = function(){}; //根据id获取临时数据 RplTplDataDAO.prototype.get = function(tpl_id, callback){ //TemplateData.find({"Data_Key": tpl_id}, function(err, templates){ //TemplateData.find({}, function(err, templates){ TemplateData.find({"Data_Key": tpl_id}, function(err, templates){ if(templates.length){ callback(false, templates[0]); } else{ callback('查找不到模板临时数据!'); } }) } module.exports = new RplTplDataDAO();