permission.js 1.0 KB

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