12345678910111213141516171819202122232425262728293031323334 |
- /**
- * Created by Tony on 2016/12/28.
- */
- let mongoose = require('mongoose');
- let dbm = require("../../../config/db/db_manager");
- let smartcostdb = dbm.getCfgConnection("Reports");
- let Schema = mongoose.Schema;
- let RptTemplateDataSchema = new Schema({
- "Data_Key": String,
- "discrete_data": Array,
- "master_data": Array,
- "detail_data": Array
- });
- let TemplateData = smartcostdb.model("temp_tpl_data", RptTemplateDataSchema, "temp_tpl_data");
- class RplTplDataDAO{
- //根据id获取临时数据
- get(tpl_id, callback){
- TemplateData.find({"Data_Key": tpl_id}, function(err, templates){
- if(templates.length){
- callback(false, templates[0]);
- }
- else{
- callback('查找不到模板临时数据!');
- }
- })
- };
- getPromise(tpl_id, callback){
- return TemplateData.findOne({"Data_Key": tpl_id}).exec();
- }
- };
- module.exports = new RplTplDataDAO();
|