permission.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * 后台管理权限数据模型
  3. *
  4. * @author EllisRan
  5. * @date 2018/12/06
  6. * @version
  7. */
  8. // import mongoose from 'mongoose';
  9. let mongoose = require("mongoose");
  10. let Schema = mongoose.Schema;
  11. let collectionName = 'permission';
  12. let modelSchema = {
  13. // ID
  14. ID: {
  15. type: Number,
  16. default: 0
  17. },
  18. // 权限名称
  19. name: {
  20. type: String,
  21. index: true
  22. },
  23. // 控制器名称
  24. controller: String,
  25. // 针对工具里一个页面多个控制器的问题(特殊优化)
  26. otherController: String,
  27. // 方法名称
  28. action: String,
  29. // 路径
  30. url: String,
  31. // 图标类名
  32. iconClass: String,
  33. // 父级id(初始默认0为父级)
  34. pid: {
  35. type: Number,
  36. default: 0
  37. },
  38. // 是否属于菜单列表里的
  39. isMenu: {
  40. type: Boolean,
  41. default: true
  42. },
  43. // 创建时间
  44. create_time: {
  45. type: Number,
  46. default: 0
  47. },
  48. };
  49. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));