cfg_font.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * Created by Tony on 2016/12/23.
  3. */
  4. var mongoose = require('mongoose');
  5. var dbm = require("../../../config/db/db_manager");
  6. var smartcostdb = dbm.getCfgConnection("Reports");
  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.model("com_fonts", FontSchema, "com_fonts");
  20. var FontDAO = function(){};
  21. //根据id
  22. FontDAO.prototype.get = function(id, callback){
  23. Font.find({ID: id}, '-_id', function(err, templates){
  24. if(templates.length){
  25. callback(false, templates[0]);
  26. }
  27. else{
  28. callback('no record was found!');
  29. }
  30. })
  31. }
  32. FontDAO.prototype.getAll = function(id, callback){
  33. Font.find({}, '-_id', function(err, templates){
  34. if(templates.length){
  35. callback(false, templates);
  36. }
  37. else{
  38. callback('no record was found!');
  39. }
  40. })
  41. }
  42. module.exports = new FontDAO();