/** * 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 FontSchema = new Schema({ "ID" : String, "Name" : String, "FontHeight" : String, "FontColor" : String, "FontBold" : String, "FontItalic" : String, "FontUnderline" : String, "FontStrikeOut" : String, "FontAngle" : String }); let Font = smartcostdb.model("com_fonts", FontSchema, "com_fonts"); let FontDAO = function(){}; //根据id FontDAO.prototype.get = function(id, callback){ Font.find({ID: id}, '-_id', function(err, templates){ if(templates.length){ callback(false, templates[0]); } else{ callback('no record was found!'); } }) } FontDAO.prototype.getAll = function(id, callback){ Font.find({}, '-_id', function(err, templates){ if(templates.length){ callback(false, templates); } else{ callback('no record was found!'); } }) } module.exports = new FontDAO();