12345678910111213141516171819202122232425262728293031323334353637383940 |
- /**
- * Created by Tony on 2016/12/23.
- */
- let mongoose = require('mongoose');
- let dbm = require("../../../config/db/db_manager");
- let smartcostdb = dbm.getCfgConnection("Reports");
- let Schema = mongoose.Schema;
- let 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
- });
- let Template = smartcostdb.model("rpt_templates", RptTemplateSchema, "rpt_templates");
- class RplTplDAO{
- get(grpId, id, callback){
- Template.find({GROUP_KEY: grpId, ID_KEY: id}, '-_id', function(err, templates){
- if(templates.length){
- callback(false, templates[0]);
- }
- else{
- callback('查找不到报表模板!');
- }
- })
- };
- getPromise(grpId, id){
- let rst = Template.findOne({GROUP_KEY: grpId, ID_KEY: id}, '-_id').exec() ;
- return rst;
- }
- }
- module.exports = new RplTplDAO();
|