rpt_control.js 975 B

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