rpt_font.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 FontSchema = new Schema({
  9. "ID" : String,
  10. "Name" : String,
  11. "FontHeight" : String,
  12. "FontColor" : String,
  13. "FontBold" : String,
  14. "FontItalic" : String,
  15. "FontUnderline" : String,
  16. "FontStrikeOut" : String,
  17. "FontAngle" : String
  18. });
  19. var Font = smartcostdb.mongoose.model("com_fonts", FontSchema);
  20. //var Font = smartcostdb.model("com_fonts", FontSchema);
  21. var FontDAO = function(){};
  22. //根据id
  23. FontDAO.prototype.get = function(id, callback){
  24. Font.find({ID: id}, function(err, templates){
  25. if(templates.length){
  26. callback(false, templates[0]);
  27. }
  28. else{
  29. callback('查找不到报表模板!');
  30. }
  31. })
  32. }
  33. FontDAO.prototype.getAll = function(id, callback){
  34. Font.find({}, function(err, templates){
  35. if(templates.length){
  36. callback(false, templates);
  37. }
  38. else{
  39. callback('查找不到报表模板!');
  40. }
  41. })
  42. }
  43. module.exports = new FontDAO();