123456789101112131415161718192021222324252627282930313233343536 |
- /**
- * 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_data", RptTemplateDataSchema, "temp_tpl_data");
- var RplTplDataDAO = function(){};
- //根据id获取临时数据
- RplTplDataDAO.prototype.get = function(tpl_id, callback){
- TemplateData.find({"Data_Key": tpl_id}, function(err, templates){
- if(templates.length){
- callback(false, templates[0]);
- }
- else{
- callback('查找不到模板临时数据!');
- }
- })
- };
- RplTplDataDAO.prototype.getPromise = function(tpl_id, callback){
- return TemplateData.findOne({"Data_Key": tpl_id}).exec();
- }
- module.exports = new RplTplDataDAO();
|