rpt_template.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Created by Tony on 2016/12/23.
  3. */
  4. var mongoose = require('mongoose');
  5. var smartcostdb = require('./../db/smartcostdb');
  6. //var Schema = smartcostdb.mongoose.Schema;
  7. var Schema = mongoose.Schema;
  8. var RptTemplateSchema = new Schema({
  9. "GROUP_KEY": String,
  10. "ID_KEY": String,
  11. "主信息": Schema.Types.Mixed,
  12. "指标_数据_映射": Schema.Types.Mixed,
  13. "布局框_集合": Array,
  14. "流水式表_信息": Schema.Types.Mixed,
  15. "交叉表_信息": Schema.Types.Mixed,
  16. "无映射离散指标_集合": Schema.Types.Mixed,
  17. "离散参数_集合": Schema.Types.Mixed,
  18. "计算式_集合": Array
  19. });
  20. var Template = smartcostdb.mongoose.model("rpt_templates", RptTemplateSchema);
  21. //var Template = smartcostdb.model("rpt_templates", RptTemplateSchema);
  22. var RplTplDAO = function(){};
  23. //根据id获取试卷
  24. RplTplDAO.prototype.get = function(grpId, id, callback){
  25. Template.find({GROUP_KEY: grpId, ID_KEY: id}, function(err, templates){
  26. if(templates.length){
  27. callback(false, templates[0]);
  28. }
  29. else{
  30. callback('查找不到报表模板!');
  31. }
  32. })
  33. }
  34. module.exports = new RplTplDAO();