/** * Created by Tony on 2017/6/6. */ class cfgCommon{ constructor(modelObj) { this.modelObj = modelObj; } get(id, callback){ this.modelObj.find({ID: id}, '-_id', function(err, templates){ if(templates.length){ callback(false, templates[0]); } else{ callback('no record was found!'); } }) }; getAll(id, callback){ this.modelObj.find({}, '-_id', function(err, templates){ if(templates.length){ callback(false, templates); } else{ callback('no record was found!'); } }) }; }; //module.exports = new cfgCommon(null); module.exports = cfgCommon;