rpt_temp_data.js 898 B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Created by Tony on 2016/12/28.
  3. */
  4. var smartcostdb = require('./smartcostdb');
  5. var Schema = smartcostdb.mongoose.Schema;
  6. var RptTemplateDataSchema = new Schema({
  7. "Data_Key": String,
  8. "discrete_data": Array,
  9. "master_data": Array,
  10. "detail_data": Array
  11. });
  12. var TemplateData = smartcostdb.mongoose.model("temp_tpl_datas", RptTemplateDataSchema);
  13. var RplTplDataDAO = function(){};
  14. //根据id获取临时数据
  15. RplTplDataDAO.prototype.get = function(tpl_id, callback){
  16. //TemplateData.find({"Data_Key": tpl_id}, function(err, templates){
  17. //TemplateData.find({}, function(err, templates){
  18. TemplateData.find({"Data_Key": tpl_id}, function(err, templates){
  19. if(templates.length){
  20. callback(false, templates[0]);
  21. }
  22. else{
  23. callback('查找不到模板临时数据!');
  24. }
  25. })
  26. }
  27. module.exports = new RplTplDataDAO();