szj_accesss.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. 'use strict';
  2. module.exports = app => {
  3. const DataTypes = app.Sequelize;
  4. const sequelize = app.model;
  5. const attributes = {
  6. accessId: {
  7. type: DataTypes.INTEGER(10).UNSIGNED,
  8. allowNull: false,
  9. defaultValue: null,
  10. primaryKey: true,
  11. autoIncrement: true,
  12. comment: "节点ID",
  13. field: "access_id"
  14. },
  15. accessName: {
  16. type: DataTypes.STRING(20),
  17. allowNull: false,
  18. defaultValue: null,
  19. primaryKey: false,
  20. autoIncrement: false,
  21. comment: "节点名称",
  22. field: "access_name"
  23. },
  24. pid: {
  25. type: DataTypes.INTEGER(10).UNSIGNED,
  26. allowNull: false,
  27. defaultValue: null,
  28. primaryKey: false,
  29. autoIncrement: false,
  30. comment: "上级ID",
  31. field: "pid"
  32. },
  33. routerPath: {
  34. type: DataTypes.STRING(255),
  35. allowNull: false,
  36. defaultValue: null,
  37. primaryKey: false,
  38. autoIncrement: false,
  39. comment: "跳转地址",
  40. field: "router_path"
  41. },
  42. routerName: {
  43. type: DataTypes.STRING(100),
  44. allowNull: false,
  45. defaultValue: null,
  46. primaryKey: false,
  47. autoIncrement: false,
  48. comment: "节点路由 对应vue路由",
  49. field: "router_name"
  50. },
  51. accessIcon: {
  52. type: DataTypes.STRING(30),
  53. allowNull: false,
  54. defaultValue: null,
  55. primaryKey: false,
  56. autoIncrement: false,
  57. comment: "节点图标",
  58. field: "access_icon"
  59. },
  60. accessSort: {
  61. type: DataTypes.INTEGER(10).UNSIGNED,
  62. allowNull: false,
  63. defaultValue: null,
  64. primaryKey: false,
  65. autoIncrement: false,
  66. comment: "节点排序",
  67. field: "access_sort"
  68. },
  69. level: {
  70. type: DataTypes.INTEGER(1).UNSIGNED,
  71. allowNull: false,
  72. defaultValue: null,
  73. primaryKey: false,
  74. autoIncrement: false,
  75. comment: "节点等级",
  76. field: "level"
  77. },
  78. isNav: {
  79. type: DataTypes.INTEGER(1).UNSIGNED,
  80. allowNull: false,
  81. defaultValue: null,
  82. primaryKey: false,
  83. autoIncrement: false,
  84. comment: "是否导航节点",
  85. field: "is_nav"
  86. },
  87. adminId: {
  88. type: DataTypes.INTEGER(10).UNSIGNED,
  89. allowNull: false,
  90. defaultValue: null,
  91. primaryKey: false,
  92. autoIncrement: false,
  93. comment: "操作管理员",
  94. field: "admin_id"
  95. },
  96. accessStatus: {
  97. type: DataTypes.INTEGER(1).UNSIGNED,
  98. allowNull: false,
  99. defaultValue: null,
  100. primaryKey: false,
  101. autoIncrement: false,
  102. comment: "节点状态",
  103. field: "access_status"
  104. },
  105. vuecomponent: {
  106. type: DataTypes.STRING(255),
  107. allowNull: false,
  108. defaultValue: null,
  109. primaryKey: false,
  110. autoIncrement: false,
  111. comment: "加载页面",
  112. field: "vuecomponent"
  113. },
  114. mobileShow: {
  115. type: DataTypes.INTEGER(1).UNSIGNED,
  116. allowNull: false,
  117. defaultValue: null,
  118. primaryKey: false,
  119. autoIncrement: false,
  120. comment: "移动端是否显示",
  121. field: "mobile_show"
  122. },
  123. updateTime: {
  124. type: DataTypes.DATE,
  125. allowNull: false,
  126. defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
  127. primaryKey: false,
  128. autoIncrement: false,
  129. comment: "变动时间",
  130. field: "update_time"
  131. },
  132. createTime: {
  133. type: DataTypes.DATE,
  134. allowNull: false,
  135. defaultValue: null,
  136. primaryKey: false,
  137. autoIncrement: false,
  138. comment: "创建时间",
  139. field: "create_time"
  140. }
  141. };
  142. const options = {
  143. tableName: "szj_accesss",
  144. comment: "",
  145. indexes: [{
  146. name: "is_nav",
  147. unique: false,
  148. type: "BTREE",
  149. fields: ["is_nav", "access_status"]
  150. }, {
  151. name: "mobile_show",
  152. unique: false,
  153. type: "BTREE",
  154. fields: ["mobile_show"]
  155. }]
  156. };
  157. const SzjAccesssModel = sequelize.define("szjAccesssModel", attributes, options);
  158. return SzjAccesssModel;
  159. };