1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /**
- * Created by Tony on 2016/12/23.
- */
- let mongoose = require('mongoose');
- let dbm = require("../../../config/db/db_manager");
- let smartcostdb = dbm.getCfgConnection("Reports");
- let Schema = mongoose.Schema;
- let CtrlSchema = new Schema({
- "ID" : String,
- "Shrink" : String,
- "ShowZero" : String,
- "Horizon" : String,
- "Vertical" : String,
- "Wrap" : String
- });
- let Control = smartcostdb.model("com_ctrls", CtrlSchema, "com_ctrls");
- let 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();
|