/** * 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 FontSchema = new Schema({ "ID" : String, "Name" : String, "FontHeight" : String, "FontColor" : String, "FontBold" : String, "FontItalic" : String, "FontUnderline" : String, "FontStrikeOut" : String, "FontAngle" : String }); var Font = smartcostdb.mongoose.model("com_fonts", FontSchema); //var Font = smartcostdb.model("com_fonts", FontSchema); var FontDAO = function(){}; //根据id FontDAO.prototype.get = function(id, callback){ Font.find({ID: id}, function(err, templates){ if(templates.length){ callback(false, templates[0]); } else{ callback('查找不到报表模板!'); } }) } FontDAO.prototype.getAll = function(id, callback){ Font.find({}, function(err, templates){ if(templates.length){ callback(false, templates); } else{ callback('查找不到报表模板!'); } }) } module.exports = new FontDAO();