rpt_style.js 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * Created by Tony on 2016/12/23.
  3. */
  4. var mongoose = require('mongoose');
  5. var smartcostdb = require('./../db/smartcostdb');
  6. //var Schema = smartcostdb.mongoose.Schema;
  7. var Schema = mongoose.Schema;
  8. var StyleSchema = new Schema({
  9. "ID" : String,
  10. "border_style" : Array
  11. });
  12. var Style = smartcostdb.mongoose.model("com_styles", StyleSchema);
  13. //var Style = smartcostdb.model("com_styles", StyleSchema);
  14. var StyleDAO = function(){};
  15. //根据id
  16. StyleDAO.prototype.get = function(id, callback){
  17. Style.find({ID: id}, function(err, templates){
  18. if(templates.length){
  19. callback(false, templates[0]);
  20. }
  21. else{
  22. callback('查找不到报表模板!');
  23. }
  24. })
  25. }
  26. StyleDAO.prototype.getAll = function(id, callback){
  27. Style.find({}, function(err, templates){
  28. if(templates.length){
  29. callback(false, templates);
  30. }
  31. else{
  32. callback('查找不到报表模板!');
  33. }
  34. })
  35. }
  36. module.exports = new StyleDAO();