szj_configs.js 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. 'use strict';
  2. module.exports = app => {
  3. const DataTypes = app.Sequelize;
  4. const sequelize = app.model;
  5. const attributes = {
  6. configId: {
  7. type: DataTypes.INTEGER(10).UNSIGNED,
  8. allowNull: false,
  9. defaultValue: null,
  10. primaryKey: true,
  11. autoIncrement: true,
  12. comment: "配置ID",
  13. field: "config_id"
  14. },
  15. fieldIndex: {
  16. type: DataTypes.STRING(100),
  17. allowNull: false,
  18. defaultValue: null,
  19. primaryKey: false,
  20. autoIncrement: false,
  21. comment: "索引字段",
  22. field: "field_index"
  23. },
  24. fieldType: {
  25. type: DataTypes.STRING(20),
  26. allowNull: false,
  27. defaultValue: null,
  28. primaryKey: false,
  29. autoIncrement: false,
  30. comment: "字段类型仅支持[text,textarea,number,switch,datetime,image,images]",
  31. field: "field_type"
  32. },
  33. fieldLabel: {
  34. type: DataTypes.STRING(20),
  35. allowNull: false,
  36. defaultValue: null,
  37. primaryKey: false,
  38. autoIncrement: false,
  39. comment: "表单label",
  40. field: "field_label"
  41. },
  42. fieldGroup: {
  43. type: DataTypes.STRING(50),
  44. allowNull: false,
  45. defaultValue: null,
  46. primaryKey: false,
  47. autoIncrement: false,
  48. comment: "所属分组",
  49. field: "field_group"
  50. },
  51. fieldOptions: {
  52. type: DataTypes.STRING(255),
  53. allowNull: false,
  54. defaultValue: null,
  55. primaryKey: false,
  56. autoIncrement: false,
  57. comment: "其它选项",
  58. field: "field_options"
  59. },
  60. fieldDesc: {
  61. type: DataTypes.STRING(50),
  62. allowNull: false,
  63. defaultValue: null,
  64. primaryKey: false,
  65. autoIncrement: false,
  66. comment: "提示文字",
  67. field: "field_desc"
  68. },
  69. fieldStatus: {
  70. type: DataTypes.INTEGER(1).UNSIGNED,
  71. allowNull: false,
  72. defaultValue: null,
  73. primaryKey: false,
  74. autoIncrement: false,
  75. comment: "配置状态",
  76. field: "field_status"
  77. },
  78. fieldValue: {
  79. type: DataTypes.TEXT,
  80. allowNull: false,
  81. defaultValue: null,
  82. primaryKey: false,
  83. autoIncrement: false,
  84. comment: "字段值",
  85. field: "field_value"
  86. },
  87. fieldSort: {
  88. type: DataTypes.INTEGER(10).UNSIGNED,
  89. allowNull: false,
  90. defaultValue: null,
  91. primaryKey: false,
  92. autoIncrement: false,
  93. comment: "配置排序",
  94. field: "field_sort"
  95. },
  96. adminId: {
  97. type: DataTypes.INTEGER(10).UNSIGNED,
  98. allowNull: false,
  99. defaultValue: null,
  100. primaryKey: false,
  101. autoIncrement: false,
  102. comment: "管理员ID",
  103. field: "admin_id"
  104. },
  105. updateTime: {
  106. type: DataTypes.DATE,
  107. allowNull: false,
  108. defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
  109. primaryKey: false,
  110. autoIncrement: false,
  111. comment: "更新时间",
  112. field: "update_time"
  113. },
  114. createTime: {
  115. type: DataTypes.DATE,
  116. allowNull: false,
  117. defaultValue: null,
  118. primaryKey: false,
  119. autoIncrement: false,
  120. comment: "创建时间",
  121. field: "create_time"
  122. }
  123. };
  124. const options = {
  125. tableName: "szj_configs",
  126. comment: "",
  127. indexes: [{
  128. name: "config_name",
  129. unique: false,
  130. type: "BTREE",
  131. fields: ["field_index"]
  132. }]
  133. };
  134. const SzjConfigsModel = sequelize.define("szjConfigsModel", attributes, options);
  135. return SzjConfigsModel;
  136. };