sql.sql 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. create table city
  2. (
  3. city_id serial not null
  4. constraint city_pk
  5. primary key,
  6. city_name_zh varchar,
  7. city_name_en varchar,
  8. ord integer
  9. );
  10. alter table city
  11. owner to postgres;
  12. create table role
  13. (
  14. role_id serial not null
  15. constraint role_pk
  16. primary key,
  17. role_name varchar,
  18. create_time date,
  19. update_time date
  20. );
  21. alter table role
  22. owner to postgres;
  23. create table table_user
  24. (
  25. user_id serial not null
  26. constraint user_pk
  27. primary key,
  28. login_id varchar,
  29. user_name varchar,
  30. mobile varchar,
  31. email varchar,
  32. city_id integer,
  33. status integer,
  34. remark varchar,
  35. create_time date,
  36. update_time date
  37. );
  38. alter table table_user
  39. owner to postgres;
  40. create table user_role
  41. (
  42. id serial not null
  43. constraint user_role_pk
  44. primary key,
  45. user_id integer,
  46. role_id integer,
  47. create_time date,
  48. update_time date
  49. );
  50. alter table user_role
  51. owner to postgres;
  52. create table table2_user
  53. (
  54. login_id serial not null
  55. constraint table2_user_pk
  56. primary key,
  57. login_name varchar,
  58. user_name varchar,
  59. phone varchar,
  60. email varchar,
  61. province varchar,
  62. city varchar,
  63. county varchar,
  64. tsfx_per integer,
  65. tsys_per integer,
  66. tsdp_per integer,
  67. tsgdlz_per integer,
  68. ceate_time date,
  69. update_time date
  70. );
  71. comment on column table2_user.login_id is '主键自增';
  72. comment on column table2_user.login_name is '登录用户名';
  73. comment on column table2_user.user_name is '用户姓名';
  74. comment on column table2_user.phone is '手机号码';
  75. comment on column table2_user.email is '邮箱';
  76. comment on column table2_user.province is '归属省份';
  77. comment on column table2_user.city is '归属地市';
  78. comment on column table2_user.county is '归属区县';
  79. comment on column table2_user.tsfx_per is ' 投诉工单分析权限 0,1,2 0无权限 1地市级 2省级
  80. ';
  81. comment on column table2_user.tsys_per is '投诉预测权限 0,1,2 0无权限 1地市级 2省级
  82. ';
  83. comment on column table2_user.tsdp_per is '是否具备投诉大屏权限 0,1,2 0无权限 1地市级 2省级
  84. ';
  85. comment on column table2_user.tsgdlz_per is '是否投诉工单流转流程权限 0,1 0否 1有
  86. ';
  87. comment on column table2_user.ceate_time is '用户创建时间';
  88. comment on column table2_user.update_time is '用户修改时间';
  89. alter table table2_user
  90. owner to postgres;
  91. create table role_middle
  92. (
  93. role_middle_id serial not null
  94. constraint role_middle_pk
  95. primary key,
  96. user_id integer,
  97. role_id integer
  98. );
  99. alter table role_middle
  100. owner to postgres;