wangxz.sql 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. ALTER TABLE `tb_app_user`
  2. ADD COLUMN `device_type` INT(1) NULL COMMENT '1-android 2-ios';
  3. ALTER TABLE .`tb_app_user`
  4. ADD COLUMN `device_no` VARCHAR(255) NULL COMMENT '设备号' AFTER `device_type`;
  5. ALTER TABLE `tb_app_function`
  6. ADD COLUMN `IS_APP` INT(1) DEFAULT 0 NULL COMMENT '是否app功能(0,否;1,是)' AFTER `ORDER_NUMBER`;
  7. ALTER TABLE `tb_app_menu`
  8. ADD COLUMN `IS_APP` INT(1) DEFAULT 0 NULL COMMENT '是否app菜单(0,否;1,是)' AFTER `remark`;
  9. ALTER TABLE `tb_app_menu`
  10. ADD COLUMN `ICON_URL` VARCHAR(200) NULL COMMENT '手机菜单图片链接';
  11. ALTER TABLE `tb_app_menu`
  12. ADD COLUMN `MENU_CODE` VARCHAR(100) NULL COMMENT '菜单编码';
  13. DROP TABLE IF EXISTS tb_repair_bills;
  14. /*==============================================================*/
  15. /* Table: tb_repair_bills */
  16. /*==============================================================*/
  17. CREATE TABLE tb_repair_bills
  18. (
  19. id BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
  20. CODE VARCHAR(255) COMMENT '维修单编号',
  21. STATUS INT(1) COMMENT '维修单状态(1,待审核;2,可抢单;3,进行中;4,挂单中;5,转单中;8,已完成;10,审核未通过)',
  22. repair_user VARCHAR(255) COMMENT '报修人',
  23. contact_way VARCHAR(255) COMMENT '联系方式',
  24. address VARCHAR(500) COMMENT '地址',
  25. description VARCHAR(2000) COMMENT '报修描述',
  26. repair_way BIGINT COMMENT '报修方式',
  27. repair_area BIGINT COMMENT '报修区域',
  28. repair_type BIGINT COMMENT '维修类型',
  29. repair_type_detail BIGINT COMMENT '维修类型小类',
  30. pic_url VARCHAR(2000) COMMENT '上传图片地址多个以;分割',
  31. bill_from INT(1) COMMENT '下单源(1,PC;2,微信;3,Android;4,iOS)',
  32. service_user BIGINT COMMENT '维修人',
  33. bill_user_id BIGINT COMMENT '下单人ID',
  34. has_comment INT(1) DEFAULT '1' COMMENT '是否有评论',
  35. has_return_visit INT(1) DEFAULT '1' COMMENT '是否有回访记录',
  36. creator VARCHAR(100) COMMENT '创建者',
  37. create_time DATETIME COMMENT '创建时间',
  38. MODIFIER VARCHAR(100) COMMENT '修改者',
  39. modify_time DATETIME COMMENT '修改时间',
  40. PRIMARY KEY (id)
  41. )ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='维修单';
  42. DROP TABLE IF EXISTS tb_repair_operate_records;
  43. /*==============================================================*/
  44. /* Table: tb_repair_operate_records */
  45. /*==============================================================*/
  46. CREATE TABLE tb_repair_operate_records
  47. (
  48. id BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
  49. user_id INT(11) COMMENT '操作人ID',
  50. operate_type INT(1) COMMENT '操作类型(1.报修;2,抢单;3,转单;4,挂单;5,派单;6,完成;10,审核)',
  51. repair_bill_id BIGINT COMMENT '维修单ID',
  52. DESCRIPTION VARCHAR(200) COMMENT '操作描述',
  53. pend_bill_reason VARCHAR(200) COMMENT '挂单原因ID(多个以,分割)',
  54. expected_time VARCHAR(100) COMMENT '挂单预计开始时间',
  55. detail VARCHAR(200) COMMENT '操作细节描述',
  56. creator VARCHAR(100) COMMENT '创建者',
  57. create_time DATETIME COMMENT '创建时间',
  58. PRIMARY KEY (id)
  59. )ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='维修单操作记录';
  60. DROP TABLE IF EXISTS tb_user_repair_type;
  61. /*==============================================================*/
  62. /* Table: tb_user_repair_type */
  63. /*==============================================================*/
  64. CREATE TABLE tb_user_repair_type
  65. (
  66. id BIGINT NOT NULL AUTO_INCREMENT COMMENT 'ID',
  67. user_id BIGINT COMMENT '用户ID',
  68. repair_type_id BIGINT COMMENT '维修类型ID',
  69. PRIMARY KEY (id)
  70. );
  71. ALTER TABLE tb_user_repair_type COMMENT '人员维修类型关系表';
  72. DROP TABLE IF EXISTS tb_repair_bill_support_users;
  73. /*==============================================================*/
  74. /* Table: tb_repair_bill_support_users */
  75. /*==============================================================*/
  76. CREATE TABLE tb_repair_bill_support_users
  77. (
  78. bill_id BIGINT COMMENT '维修单ID',
  79. support_user_id INT(11) COMMENT '协办人ID'
  80. );
  81. ALTER TABLE tb_repair_bill_support_users COMMENT '维修单协办人信息表';
  82. ALTER TABLE tb_repair_bill_support_users ADD CONSTRAINT FK_Reference_1 FOREIGN KEY (bill_id)
  83. REFERENCES tb_repair_bills (id) ON DELETE RESTRICT ON UPDATE RESTRICT;
  84. ALTER TABLE tb_repair_bill_support_users ADD CONSTRAINT FK_Reference_2 FOREIGN KEY (support_user_id)
  85. REFERENCES tb_app_user (id) ON DELETE RESTRICT ON UPDATE RESTRICT;
  86. DROP TABLE IF EXISTS tb_repair_bill_materials;
  87. /*==============================================================*/
  88. /* Table: tb_repair_bill_materials */
  89. /*==============================================================*/
  90. CREATE TABLE tb_repair_bill_materials
  91. (
  92. id BIGINT NOT NULL,
  93. bill_id BIGINT COMMENT '维修单ID',
  94. material_name VARCHAR(20) COMMENT '材料名称',
  95. amount INT(10) COMMENT '材料数量',
  96. PRIMARY KEY (id)
  97. );
  98. ALTER TABLE tb_repair_bill_materials COMMENT '维修单耗材信息表';
  99. ALTER TABLE tb_repair_bill_materials ADD CONSTRAINT FK_Reference_3 FOREIGN KEY (bill_id)
  100. REFERENCES tb_repair_bills (id) ON DELETE RESTRICT ON UPDATE RESTRICT;
  101. drop table if exists tb_repair_bill_comments;
  102. /*==============================================================*/
  103. /* Table: tb_repair_bill_comments */
  104. /*==============================================================*/
  105. create table tb_repair_bill_comments
  106. (
  107. id bigint not null auto_increment,
  108. bill_id bigint comment '维修单ID',
  109. open_id varchar(40) comment '评价用户信息',
  110. star int(2) comment '星级',
  111. serviceImpression bigint comment '员工印象',
  112. description varchar(500) comment '描述',
  113. create_time DATETIME COMMENT '创建时间',
  114. primary key (id)
  115. );
  116. alter table tb_repair_bill_comments comment '维修单评价';
  117. alter table tb_repair_bill_comments add constraint FK_Reference_4 foreign key (bill_id)
  118. references tb_repair_bills (id) on delete restrict on update restrict;
  119. DROP TABLE IF EXISTS tb_repair_return_visits;
  120. /*==============================================================*/
  121. /* Table: tb_repair_return_visits */
  122. /*==============================================================*/
  123. CREATE TABLE tb_repair_return_visits
  124. (
  125. id BIGINT NOT NULL AUTO_INCREMENT,
  126. bill_id BIGINT COMMENT '维修单ID',
  127. comment_id BIGINT COMMENT '评价ID',
  128. star INT(2) COMMENT '星级',
  129. description VARCHAR(500) COMMENT '描述',
  130. PRIMARY KEY (id)
  131. );
  132. ALTER TABLE tb_repair_return_visits COMMENT '维修单回访记录';
  133. alter table tb_repair_return_visits add constraint FK_Reference_5 foreign key (bill_id)
  134. references tb_repair_bills (id) on delete restrict on update restrict;
  135. CREATE TABLE `tb_weixin_notify_info` (
  136. `id` BIGINT(20) NOT NULL AUTO_INCREMENT,
  137. `return_code` VARCHAR(16) DEFAULT NULL,
  138. `return_msg` VARCHAR(128) DEFAULT NULL,
  139. `nonce_str` VARCHAR(32) DEFAULT NULL,
  140. `sign` VARCHAR(32) DEFAULT NULL,
  141. `sign_type` VARCHAR(32) DEFAULT NULL,
  142. `result_code` VARCHAR(16) DEFAULT NULL,
  143. `err_code` VARCHAR(32) DEFAULT NULL,
  144. `err_code_des` VARCHAR(128) DEFAULT NULL,
  145. `openid` VARCHAR(128) DEFAULT NULL COMMENT '用户标识',
  146. `is_subscribe` VARCHAR(1) DEFAULT NULL,
  147. `trade_type` VARCHAR(16) DEFAULT NULL,
  148. `bank_type` VARCHAR(16) DEFAULT NULL,
  149. `total_fee` INT(16) DEFAULT NULL,
  150. `settlement_total_fee` INT(16) DEFAULT NULL,
  151. `cash_fee` INT(16) DEFAULT NULL,
  152. `transaction_id` VARCHAR(32) DEFAULT NULL COMMENT '微信支付订单号',
  153. `out_trade_no` VARCHAR(32) DEFAULT NULL COMMENT '商户订单号',
  154. `time_end` VARCHAR(14) DEFAULT NULL,
  155. `create_time` DATETIME NOT NULL COMMENT '创建时间',
  156. PRIMARY KEY (`id`)
  157. ) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT '微信支付调用返回信息'
  158. ALTER TABLE `tb_repair_bills`
  159. ADD COLUMN `repair_cost` DECIMAL(19,2) NULL COMMENT '维修费用' AFTER `bill_user_id`;
  160. ALTER TABLE `tb_repair_bills`
  161. ADD COLUMN has_paid INT(1) DEFAULT '1' COMMENT '是否支付' AFTER `has_return_visit`;
  162. ALTER TABLE `tb_app_user`
  163. CHANGE `PHOTO_URL` `PHOTO_URL` VARCHAR(200) NULL COMMENT '员工照片URL地址';
  164. ALTER TABLE `tb_repair_bills`
  165. ADD COLUMN `end_time` DATETIME NULL COMMENT '单完结时间(完成或者审核拒绝)' AFTER `modify_time`;
  166. ALTER TABLE `tb_app_user`
  167. ADD COLUMN `is_online` INT(1) DEFAULT 1 NULL COMMENT '是否已签到' AFTER `device_no`;
  168. ALTER TABLE `tb_repair_bills`
  169. ADD COLUMN `version` INT DEFAULT 0 NOT NULL COMMENT '版本号' AFTER `end_time`;
  170. ALTER TABLE `tb_wxpublicno`
  171. ADD COLUMN `getAccessTokenUrl` VARCHAR(2000) NULL COMMENT '获取授权token地址' AFTER `wxApiKey`;
  172. ALTER TABLE `tb_serviceprojectallocation`
  173. ADD COLUMN `serviceIcon` VARCHAR(500) NULL COMMENT '个性化服务图片' AFTER `type`;
  174. ALTER TABLE `tb_repair_bill_support_users`
  175. DROP FOREIGN KEY `FK_Reference_2`;
  176. ALTER TABLE `tb_repair_bill_support_users`
  177. CHANGE `support_user_id` `support_user_id` BIGINT(20) NULL COMMENT '协办人ID';
  178. ALTER TABLE `tb_app_user`
  179. CHANGE `ID` `ID` BIGINT(20) NOT NULL AUTO_INCREMENT;
  180. ALTER TABLE tb_repair_bill_support_users ADD CONSTRAINT FK_Reference_2 FOREIGN KEY (support_user_id)
  181. REFERENCES tb_app_user (id) ON DELETE RESTRICT ON UPDATE RESTRICT;
  182. ALTER TABLE `tb_app_role`
  183. ADD COLUMN `ORG_ID` INT(11) NULL COMMENT '项目ID' AFTER `FLOOR_REPAIR`;
  184. ALTER TABLE `tb_goods_release`
  185. ADD COLUMN `orgId` INT(11) NULL COMMENT '项目ID' AFTER `company_headuser`;
  186. ALTER TABLE `tb_goods_release`
  187. ADD COLUMN `virAccountId` BIGINT(20) NULL COMMENT '企业账户ID' AFTER `orgId`;
  188. -- 项目配置账号类型,企业账号或者个人账号 11.20----
  189. ALTER TABLE `tb_organization`
  190. ADD COLUMN `accountType` INT(1) DEFAULT 0 NULL COMMENT '账号类型:0企业账号;1个人账号' AFTER `hdProjectName`;
  191. -- 白名单是否绑定微信用户 11.21----
  192. ALTER TABLE `tb_user`
  193. ADD COLUMN `wxUserId` INT(11) NULL COMMENT '微信用户ID' AFTER `userCode`;
  194. ALTER TABLE `tb_user`
  195. ADD COLUMN `isBinding` INT(1) DEFAULT 0 NULL COMMENT '白名单是否绑定微信用户' AFTER `wxUserId`;
  196. -- 电子放行条白名单使用 11.26----
  197. ALTER TABLE `tb_goods_release`
  198. ADD COLUMN `userId` INT(11) NULL COMMENT '用户ID' AFTER `virAccountId`;
  199. -- 关于我们1221--
  200. CREATE TABLE `tb_about_org`(
  201. `ID` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  202. `org_id` INT(11) DEFAULT NULL COMMENT '项目id',
  203. `title` VARCHAR(200) COMMENT '标题',
  204. `content` TEXT COMMENT '内容',
  205. `create_time` DATETIME DEFAULT NULL COMMENT '创建时间',
  206. `creator` VARCHAR(20) DEFAULT NULL COMMENT '创建人',
  207. `modifier` VARCHAR(20) DEFAULT NULL COMMENT '修改人',
  208. `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间',
  209. `is_enabled` INT(1) DEFAULT 1 COMMENT '是否可用或删除:0 禁用,1 可用',
  210. PRIMARY KEY (`ID`)
  211. ) ENGINE=INNODB CHARSET=utf8 COLLATE=utf8_general_ci;
  212. --- 导航菜单图标 2019.01.09--
  213. ALTER TABLE `tb_app_menu`
  214. ADD COLUMN `menu_icon_url` VARCHAR(200) NULL COMMENT 'WEB导航图标链接' AFTER `MENU_CODE`;
  215. --- 商户信息表2019.1.15 ---
  216. CREATE TABLE `tb_merchant_detail`(
  217. `ID` BIGINT(21) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  218. `org_id` INT(11) COMMENT '项目ID',
  219. `module_code` VARCHAR(20) COMMENT '模块编码',
  220. `name` VARCHAR(50) COMMENT '商户名称',
  221. `app_id` VARCHAR(100) NOT NULL COMMENT '公众号appId',
  222. `app_secret` VARCHAR(100) NOT NULL COMMENT '公众号appSerect',
  223. `mch_id` VARCHAR(100) NOT NULL COMMENT '商户ID',
  224. `wx_apiKey` VARCHAR(100) NOT NULL COMMENT '微信商户API KEY',
  225. `sslcert_path` VARCHAR(200) COMMENT '证书地址',
  226. `sslcert_password` VARCHAR(200) COMMENT '证书密码',
  227. `is_enabled` BIT(1) DEFAULT 1 COMMENT '是否有效',
  228. `creator` VARCHAR(50) COMMENT '创建人',
  229. `create_time` DATETIME COMMENT '创建时间',
  230. `modifier` VARCHAR(50) COMMENT '修改人',
  231. `modify_time` DATETIME COMMENT '修改时间',
  232. PRIMARY KEY (`ID`)
  233. ) ENGINE=INNODB CHARSET=utf8 COLLATE=utf8_general_ci
  234. COMMENT='商户信息';
  235. ALTER TABLE `tb_organization`
  236. CHANGE `hdProjectId` `hdProjectId` VARCHAR(40) CHARSET utf8 COLLATE utf8_general_ci NULL COMMENT '航电项目id',
  237. ADD COLUMN `hdVoiceProjectId` VARCHAR(40) NULL COMMENT '航电客户声音项目ID' AFTER `hdProjectName`,
  238. ADD COLUMN `hdVoiceProjectName` VARCHAR(255) NULL COMMENT '航电客户声音项目名称' AFTER `hdVoiceProjectId`;
  239. ALTER TABLE `tb_goods_release`
  240. ADD COLUMN `releaseUserName` VARCHAR(200) NULL COMMENT '放行人姓名' AFTER `company_headuser`;
  241. ----20190716 报事报修多项目支持 -----
  242. ALTER TABLE `louyu_service_test`.`tb_repair_bills`
  243. ADD COLUMN `orgId` INT(11) NULL COMMENT '项目ID';