accesss.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* indent size: 2 */
  2. module.exports = app => {
  3. const DataTypes = app.Sequelize;
  4. const Model = app.model.define('Accesss', {
  5. access_id: {
  6. type: DataTypes.INTEGER(10).UNSIGNED,
  7. primaryKey: true,
  8. autoIncrement: true
  9. },
  10. access_name: {
  11. type: DataTypes.STRING(20)
  12. },
  13. pid: {
  14. type: DataTypes.INTEGER(10).UNSIGNED
  15. },
  16. router_path: {
  17. type: DataTypes.STRING(255)
  18. },
  19. router_name: {
  20. type: DataTypes.STRING(100)
  21. },
  22. access_icon: {
  23. type: DataTypes.STRING(30)
  24. },
  25. access_sort: {
  26. type: DataTypes.INTEGER(10).UNSIGNED
  27. },
  28. level:{
  29. type: DataTypes.INTEGER(1).UNSIGNED
  30. },
  31. is_nav: {
  32. type: DataTypes.INTEGER(1).UNSIGNED
  33. },
  34. admin_id: {
  35. type: DataTypes.INTEGER(10).UNSIGNED
  36. },
  37. access_status: {
  38. type: DataTypes.INTEGER(1).UNSIGNED
  39. },
  40. vuecomponent:{
  41. type:DataTypes.STRING(255)
  42. },
  43. mobile_show:{
  44. type:DataTypes.INTEGER(1).UNSIGNED
  45. },
  46. update_time: {
  47. type: DataTypes.TIME,
  48. },
  49. create_time: {
  50. type: DataTypes.DATE
  51. }
  52. }, {
  53. tableName: 'szj_accesss'
  54. });
  55. Model.associate = function() {
  56. //关联管理员表
  57. Model.belongsTo(app.model.AdminUser,{foreignKey:'admin_id',targetKey:'admin_id',as:'admin_user'});
  58. }
  59. //同步:没有就新建,有就不变
  60. Model.sync();
  61. return Model;
  62. };