rpt_template.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Created by Tony on 2016/12/23.
  3. */
  4. let mongoose = require('mongoose');
  5. let dbm = require("../../../config/db/db_manager");
  6. let smartcostdb = dbm.getCfgConnection("Reports");
  7. let Schema = mongoose.Schema;
  8. let 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. let Template = smartcostdb.model("rpt_templates", RptTemplateSchema, "rpt_templates");
  21. class RplTplDAO{
  22. get(grpId, id, callback){
  23. Template.find({GROUP_KEY: grpId, ID_KEY: id}, '-_id', function(err, templates){
  24. if(templates.length){
  25. callback(false, templates[0]);
  26. }
  27. else{
  28. callback('查找不到报表模板!');
  29. }
  30. })
  31. };
  32. getPromise(grpId, id){
  33. let rst = Template.findOne({GROUP_KEY: grpId, ID_KEY: id}, '-_id').exec() ;
  34. return rst;
  35. }
  36. }
  37. module.exports = new RplTplDAO();