123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /**
- * Created by Tony on 2017/6/14.
- */
- let mongoose = require('mongoose');
- let dbm = require("../../../config/db/db_manager");
- let smartcostdb = dbm.getCfgConnection("Reports");
- let Schema = mongoose.Schema;
- let FormatSchema = new Schema({
- "ID" : String,
- "CfgDispName": String,
- "Shrink" : String,
- "ShowZero" : String,
- "Horizon" : String,
- "Vertical" : String,
- "Wrap" : String
- });
- let FontSchema = new Schema({
- "ID" : String,
- "Name" : String,
- "CfgDispName": String,
- "FontHeight" : String,
- "FontColor" : String,
- "FontBold" : String,
- "FontItalic" : String,
- "FontUnderline" : String,
- "FontStrikeOut" : String,
- "FontAngle" : String
- });
- let LineSchema = new Schema({
- "Position": String,
- "LineWeight": String,
- "DashStyle": String,
- "Color": String
- });
- let StyleSchema = new Schema({
- "ID" : String,
- "CfgDispName": String,
- "border_style" : [LineSchema]
- });
- let RptCfgSchema = new Schema({
- "userId" : String,
- "fonts": [FontSchema],
- "borders" : [StyleSchema],
- "formats" : [FormatSchema]
- });
- let Rpt_Cfg_Mdl = smartcostdb.model("rpt_cfg", RptCfgSchema, "rpt_cfg");
- class RptCfgDAO {
- getByUserId(userId, callback){
- Rpt_Cfg_Mdl.find({userId: userId}, '-_id', function(err, templates){
- if(templates.length){
- callback(false, templates[0]);
- }
- else{
- callback('no record was found!');
- }
- })
- };
- getAll(id, callback){
- Rpt_Cfg_Mdl.find({}, '-_id', function(err, templates){
- if(templates.length){
- callback(false, templates);
- }
- else{
- callback('no record was found!');
- }
- })
- };
- };
- module.exports = new RptCfgDAO();
|