| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | 
							- /**
 
-  * 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 CtrlSchema = new Schema({
 
-     "ID" : String,
 
-     "Shrink" : String,
 
-     "ShowZero" : String,
 
-     "Horizon" : String,
 
-     "Vertical" : String,
 
-     "Wrap" : String
 
- });
 
- var Control = smartcostdb.model("com_ctrls", CtrlSchema);
 
- var CtrlDAO = function(){};
 
- //根据id
 
- CtrlDAO.prototype.get = function(id, callback){
 
-     Control.find({ID: id}, '-_id', function(err, templates){
 
-         if(templates.length){
 
-             callback(false, templates[0]);
 
-         }
 
-         else{
 
-             callback('no record was found!');
 
-         }
 
-     })
 
- }
 
- CtrlDAO.prototype.getAll = function(id, callback){
 
-     Control.find({}, '-_id', function(err, templates){
 
-         if(templates.length){
 
-             callback(false, templates);
 
-         }
 
-         else{
 
-             callback('no record was found!');
 
-         }
 
-     })
 
- }
 
- module.exports = new CtrlDAO();
 
 
  |