/**
 * 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(){};

//根据id
StyleDAO.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();
