| 12345678910111213141516171819202122232425262728293031323334353637383940 | /** * Created by Tony on 2016/12/23. */var mongoose = require('mongoose');var dbm = require("../../../config/db/db_manager");var smartcostdb = dbm.getCfgConnection("Reports");var Schema = mongoose.Schema;var StyleSchema = new Schema({    "ID" : String,    "border_style" : Array});var Style = smartcostdb.model("com_styles", StyleSchema, "com_styles");var StyleDAO = function(){};//根据idStyleDAO.prototype.get = function(id, callback){    Style.find({ID: id}, '-_id', function(err, templates){        if(templates.length){            callback(false, templates[0]);        }        else{            callback('no record was found!');        }    })}StyleDAO.prototype.getAll = function(id, callback){    Style.find({}, '-_id', function(err, templates){        if(templates.length){            callback(false, templates);        }        else{            callback('no record was found!');        }    })}module.exports = new StyleDAO();
 |