/** * Created by Tony on 2016/12/23. */ var mongoose = require('mongoose'); var smartcostdb = require('./../db/smartcostdb'); //var Schema = smartcostdb.mongoose.Schema; var Schema = mongoose.Schema; var RptTemplateSchema = new Schema({ "GROUP_KEY": String, "ID_KEY": String, "主信息": Schema.Types.Mixed, "指标_数据_映射": Schema.Types.Mixed, "布局框_集合": Array, "流水式表_信息": Schema.Types.Mixed, "交叉表_信息": Schema.Types.Mixed, "无映射离散指标_集合": Schema.Types.Mixed, "离散参数_集合": Schema.Types.Mixed, "计算式_集合": Array }); var Template = smartcostdb.mongoose.model("rpt_templates", RptTemplateSchema); //var Template = smartcostdb.model("rpt_templates", RptTemplateSchema); var RplTplDAO = function(){}; //根据id获取试卷 RplTplDAO.prototype.get = function(grpId, id, callback){ Template.find({GROUP_KEY: grpId, ID_KEY: id}, function(err, templates){ if(templates.length){ callback(false, templates[0]); } else{ callback('查找不到报表模板!'); } }) } module.exports = new RplTplDAO();