1234567891011121314151617181920212223242526272829303132333435363738394041 |
- /**
- * Created by Tony on 2016/12/23.
- */
- var mongoose = require('mongoose');
- var smartcostdb = require('./../db/smartcostdb');
- //var Schema = smartcostdb.mongoose.Schema;
- var Schema = mongoose.Schema;
- var StyleSchema = new Schema({
- "ID" : String,
- "border_style" : Array
- });
- var Style = smartcostdb.mongoose.model("com_styles", StyleSchema);
- //var Style = smartcostdb.model("com_styles", StyleSchema);
- var StyleDAO = function(){};
- //根据id
- StyleDAO.prototype.get = function(id, callback){
- Style.find({ID: id}, function(err, templates){
- if(templates.length){
- callback(false, templates[0]);
- }
- else{
- callback('查找不到报表模板!');
- }
- })
- }
- StyleDAO.prototype.getAll = function(id, callback){
- Style.find({}, function(err, templates){
- if(templates.length){
- callback(false, templates);
- }
- else{
- callback('查找不到报表模板!');
- }
- })
- }
- module.exports = new StyleDAO();
|