| 12345678910111213141516171819202122232425262728293031323334353637383940 | 
							- /**
 
-  * 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 StyleSchema = new Schema({
 
-     "ID" : String,
 
-     "border_style" : Array
 
- });
 
- let Style = smartcostdb.model("com_styles", StyleSchema, "com_styles");
 
- let 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();
 
 
  |