123456789101112131415161718192021222324252627282930313233 |
- /**
- * Created by Tony on 2016/12/28.
- */
- var mongoose = require('mongoose');
- var dbm = require("../../../config/db/db_manager");
- var smartcostdb = dbm.getCfgConnection("Reports");
- var Schema = mongoose.Schema;
- var RptTemplateDataSchema = new Schema({
- "Data_Key": String,
- "discrete_data": Array,
- "master_data": Array,
- "detail_data": Array
- });
- 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();
|