/** * 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 StyleSchema = new Schema({ "ID" : String, "border_style" : Array }); var Style = smartcostdb.mongoose.model("com_styles", StyleSchema); //var Style = smartcostdb.model("com_styles", StyleSchema); var StyleDAO = function(){}; //根据id StyleDAO.prototype.get = function(id, callback){ Style.find({ID: id}, function(err, templates){ if(templates.length){ callback(false, templates[0]); } else{ callback('查找不到报表模板!'); } }) } StyleDAO.prototype.getAll = function(id, callback){ Style.find({}, function(err, templates){ if(templates.length){ callback(false, templates); } else{ callback('查找不到报表模板!'); } }) } module.exports = new StyleDAO();