v11.3.2.sql 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. SET NAMES utf8mb4;
  2. SET FOREIGN_KEY_CHECKS = 0;
  3. DROP TABLE IF EXISTS `wk_oa_log_user_favour`;
  4. CREATE TABLE `wk_oa_log_user_favour` (
  5. `id` int(11) NOT NULL AUTO_INCREMENT,
  6. `user_id` bigint(20) NOT NULL COMMENT '用户id',
  7. `log_id` int(11) NOT NULL COMMENT '日志id',
  8. PRIMARY KEY (`id`) USING BTREE,
  9. UNIQUE INDEX `user_id`(`user_id`, `log_id`) USING BTREE
  10. ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户点赞日志关系表 ' ROW_FORMAT = Dynamic;
  11. ALTER TABLE `wk_crm_field` ADD COLUMN `form_assist_id` int(12) NULL COMMENT '表单辅助id,前端生成' AFTER `min_num_restrict`;
  12. ALTER TABLE `wk_oa_examine_field` ADD COLUMN `form_assist_id` int(12) NULL COMMENT '表单辅助id,前端生成' AFTER `min_num_restrict`;
  13. DROP TABLE IF EXISTS `wk_crm_field_extend`;
  14. CREATE TABLE `wk_crm_field_extend` (
  15. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  16. `parent_field_id` int(11) NOT NULL COMMENT '对应主字段id',
  17. `field_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '自定义字段英文标识',
  18. `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '字段名称',
  19. `type` int(2) NOT NULL DEFAULT 1 COMMENT '字段类型 1 单行文本 2 多行文本 3 单选 4日期 5 数字 6 小数 7 手机 8 文件 9 多选 10 人员 11 附件 12 部门 13 日期时间 14 邮箱 15客户 16 商机 17 联系人 18 地图 19 产品类型 20 合同 21 回款计划',
  20. `remark` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字段说明',
  21. `input_tips` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '输入提示',
  22. `max_length` int(12) NULL DEFAULT NULL COMMENT '最大长度',
  23. `default_value` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '默认值',
  24. `is_unique` int(1) NULL DEFAULT 0 COMMENT '是否唯一 1 是 0 否',
  25. `is_null` int(1) NULL DEFAULT 0 COMMENT '是否必填 1 是 0 否',
  26. `sorting` int(5) NULL DEFAULT 1 COMMENT '排序 从小到大',
  27. `options` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '如果类型是选项,此处不能为空,多个选项以,隔开',
  28. `operating` int(1) NULL DEFAULT 255 COMMENT '是否允许编辑',
  29. `is_hidden` int(1) NOT NULL DEFAULT 0 COMMENT '是否隐藏 0不隐藏 1隐藏',
  30. `update_time` timestamp(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间',
  31. `field_type` int(2) NOT NULL DEFAULT 0 COMMENT '字段来源 0.自定义 1.原始固定 2原始字段但值存在扩展表中',
  32. `style_percent` int(3) NULL DEFAULT 50 COMMENT '样式百分比%',
  33. `precisions` int(2) NULL DEFAULT NULL COMMENT '精度,允许的最大小数位',
  34. `form_position` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表单定位 坐标格式: 1,1',
  35. `max_num_restrict` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '限制的最大数值',
  36. `min_num_restrict` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '限制的最小数值',
  37. `form_assist_id` int(12) NULL DEFAULT NULL COMMENT '表单辅助id,前端生成',
  38. PRIMARY KEY (`id`) USING BTREE,
  39. INDEX `update_time`(`update_time`) USING BTREE
  40. ) ENGINE = InnoDB AUTO_INCREMENT = 12231 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义字段表' ROW_FORMAT = Dynamic;
  41. DROP TABLE IF EXISTS `wk_oa_examine_field_extend`;
  42. CREATE TABLE `wk_oa_examine_field_extend` (
  43. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  44. `parent_field_id` int(11) NOT NULL COMMENT '对应主字段id',
  45. `field_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '自定义字段英文标识',
  46. `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '字段名称',
  47. `type` int(2) NOT NULL DEFAULT 1 COMMENT '字段类型 1 单行文本 2 多行文本 3 单选 4日期 5 数字 6 小数 7 手机 8 文件 9 多选 10 人员 11 附件 12 部门 13 日期时间 14 邮箱 15客户 16 商机 17 联系人 18 地图 19 产品类型 20 合同 21 回款计划',
  48. `remark` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字段说明',
  49. `input_tips` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '输入提示',
  50. `max_length` int(12) NULL DEFAULT NULL COMMENT '最大长度',
  51. `default_value` varchar(3000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '默认值',
  52. `is_unique` int(1) NULL DEFAULT 0 COMMENT '是否唯一 1 是 0 否',
  53. `is_null` int(1) NULL DEFAULT 0 COMMENT '是否必填 1 是 0 否',
  54. `sorting` int(5) NULL DEFAULT 1 COMMENT '排序 从小到大',
  55. `options` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '如果类型是选项,此处不能为空,多个选项以,隔开',
  56. `operating` int(1) NULL DEFAULT 255 COMMENT '是否可以删除修改',
  57. `is_hidden` int(1) NOT NULL DEFAULT 0 COMMENT '是否隐藏 0不隐藏 1隐藏',
  58. `update_time` timestamp(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间',
  59. `field_type` int(2) NOT NULL DEFAULT 0 COMMENT '字段来源 0.自定义 1.原始固定 2原始字段但值存在扩展表中',
  60. `style_percent` int(3) NULL DEFAULT 50 COMMENT '样式百分比%',
  61. `precisions` int(2) NULL DEFAULT NULL COMMENT '精度,允许的最大小数位',
  62. `form_position` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表单定位 坐标格式: 1,1',
  63. `max_num_restrict` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '限制的最大数值',
  64. `min_num_restrict` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '限制的最小数值',
  65. `form_assist_id` int(12) NULL DEFAULT NULL COMMENT '表单辅助id,前端生成',
  66. PRIMARY KEY (`id`) USING BTREE
  67. ) ENGINE = InnoDB AUTO_INCREMENT = 5645 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义字段表' ROW_FORMAT = Dynamic;
  68. DELETE FROM `wk_crm_field` WHERE label ='18';
  69. INSERT INTO `wk_crm_field` (
  70. SELECT NULL AS field_id,'invoice_apply_number' AS field_name,'发票申请编号' AS NAME,1 AS type,18 AS label,NULL AS remark,NULL AS input_tips,NULL AS max_length,'' AS default_value,1 AS is_unique,1 AS is_null,0 AS sorting,NULL AS OPTIONS,176 AS operating,0 AS is_hidden,now() AS update_time,1 AS field_type,NULL AS relevant,50 AS style_percent,NULL AS precisions,'0,0' AS form_position,NULL AS max_num_restrict,NULL AS min_num_restrict,NULL AS form_assist_id FROM wk_crm_field LIMIT 1);
  71. INSERT INTO `wk_crm_field` (
  72. SELECT NULL AS field_id,'customer_id' AS field_name,'客户名称' AS NAME,15 AS type,18 AS label,NULL AS remark,NULL AS input_tips,NULL AS max_length,'' AS default_value,0 AS is_unique,1 AS is_null,1 AS sorting,NULL AS OPTIONS,148 AS operating,0 AS is_hidden,now() AS update_time,1 AS field_type,NULL AS relevant,50 AS style_percent,NULL AS precisions,'0,1' AS form_position,NULL AS max_num_restrict,NULL AS min_num_restrict,NULL AS form_assist_id FROM wk_crm_field LIMIT 1);
  73. INSERT INTO `wk_crm_field` (
  74. SELECT NULL AS field_id,'contract_id' AS field_name,'合同编号' AS NAME,20 AS type,18 AS label,NULL AS remark,NULL AS input_tips,NULL AS max_length,'' AS default_value,0 AS is_unique,1 AS is_null,2 AS sorting,NULL AS OPTIONS,148 AS operating,0 AS is_hidden,now() AS update_time,1 AS field_type,NULL AS relevant,50 AS style_percent,NULL AS precisions,'1,0' AS form_position,NULL AS max_num_restrict,NULL AS min_num_restrict,NULL AS form_assist_id FROM wk_crm_field limit 1);
  75. INSERT INTO `wk_crm_field` (
  76. SELECT NULL AS field_id,'contract_money' AS field_name,'合同金额' AS NAME,6 AS type,18 AS label,NULL AS remark,NULL AS input_tips,NULL AS max_length,'' AS default_value,0 AS is_unique,0 AS is_null,3 AS sorting,NULL AS OPTIONS,144 AS operating,0 AS is_hidden,now() AS update_time,1 AS field_type,NULL AS relevant,50 AS style_percent,2 AS precisions,'1,1' AS form_position,NULL AS max_num_restrict,NULL AS min_num_restrict,NULL AS form_assist_id FROM wk_crm_field limit 1);
  77. INSERT INTO `wk_crm_field` (
  78. SELECT NULL AS field_id,'invoice_money' AS field_name,'开票金额' AS NAME,6 AS type,18 AS label,NULL AS remark,NULL AS input_tips,NULL AS max_length,'' AS default_value,0 AS is_unique,1 AS is_null,4 AS sorting,NULL AS OPTIONS,148 AS operating,0 AS is_hidden,now() AS update_time,1 AS field_type,NULL AS relevant,50 AS style_percent,2 AS precisions,'2,0' AS form_position,NULL AS max_num_restrict,NULL AS min_num_restrict,NULL AS form_assist_id FROM wk_crm_field limit 1);
  79. INSERT INTO `wk_crm_field` (
  80. SELECT NULL AS field_id,'invoice_date' AS field_name,'开票日期' AS NAME,13 AS type,18 AS label,NULL AS remark,NULL AS input_tips,NULL AS max_length,'' AS default_value,0 AS is_unique,0 AS is_null,5 AS sorting,NULL AS OPTIONS,190 AS operating,0 AS is_hidden,now() AS update_time,1 AS field_type,NULL AS relevant,50 AS style_percent,NULL AS precisions,'2,1' AS form_position,NULL AS max_num_restrict,NULL AS min_num_restrict,NULL AS form_assist_id FROM wk_crm_field limit 1);
  81. INSERT INTO `wk_crm_field` (
  82. SELECT NULL AS field_id,'invoice_type' AS field_name,'开票类型' AS NAME,3 AS type,18 AS label,NULL AS remark,NULL AS input_tips,NULL AS max_length,'' AS default_value,0 AS is_unique,1 AS is_null,6 AS sorting,'增值税专用发票,增值税普通发票,国税通用机打发票,地税通用机打发票,收据' AS OPTIONS,158 AS operating,0 AS is_hidden,now() AS update_time,1 AS field_type,NULL AS relevant,50 AS style_percent,NULL AS precisions,'3,0' AS form_position,NULL AS max_num_restrict,NULL AS min_num_restrict,NULL AS form_assist_id FROM wk_crm_field limit 1);
  83. INSERT INTO `wk_crm_field` (
  84. SELECT NULL AS field_id,'remark' AS field_name,'备注' AS NAME,2 AS type,18 AS label,NULL AS remark,NULL AS input_tips,255 AS max_length,'' AS default_value,0 AS is_unique,0 AS is_null,7 AS sorting,null AS OPTIONS,190 AS operating,0 AS is_hidden,now() AS update_time,1 AS field_type,NULL AS relevant,50 AS style_percent,NULL AS precisions,'3,1' AS form_position,NULL AS max_num_restrict,NULL AS min_num_restrict,NULL AS form_assist_id FROM wk_crm_field limit 1);
  85. UPDATE `wk_oa_examine_field` SET `precisions` = 2 WHERE `field_type` = '1' AND `type` = '6';
  86. UPDATE `wk_crm_field` SET `precisions` = 2 WHERE `field_type` = '1' AND `type` = '6';
  87. UPDATE `wk_admin_menu` SET `realm_url` = null WHERE `menu_id` = 164;
  88. INSERT INTO `wk_admin_menu` ( `menu_id`, `parent_id`, `menu_name`, `realm`, `realm_url`, `realm_module`, `menu_type`, `sort`, `status`, `remarks` ) VALUES ( 933, 11, '编辑团队成员', 'teamsave', '/crmContacts/addMembers,/crmContacts/updateMembers,/crmContacts/exitTeam', NULL, 3, 1, 1, NULL );
  89. INSERT INTO `wk_admin_menu` ( `menu_id`, `parent_id`, `menu_name`, `realm`, `realm_url`, `realm_module`, `menu_type`, `sort`, `status`, `remarks` ) VALUES ( 934, 14, '编辑团队成员', 'teamsave', '/crmReceivables/addMembers,/crmReceivables/updateMembers,/crmReceivables/exitTeam', NULL, 3, 1, 1, NULL );
  90. INSERT INTO `wk_admin_menu`( `menu_id`,`parent_id`, `menu_name`, `realm`, `menu_type`, `sort`) VALUES (935,166, '角色权限查看', 'read', 3, 8);
  91. INSERT INTO `wk_admin_menu`(`menu_id`, `parent_id`, `menu_name`, `realm`, `realm_url`, `realm_module`, `menu_type`, `sort`, `status`, `remarks`) VALUES (932, 420, '导出', 'excelexport', '/crmInvoice/allExportExcel', NULL, 3, 1, 1, NULL);
  92. UPDATE `wk_crm_field` SET `is_unique` = 0 WHERE label='18' and field_name in('contract_id','customer_id');
  93. DELETE FROM wk_crm_role_field WHERE field_id in (SELECT field_id from wk_crm_field WHERE type='50');
  94. INSERT INTO `wk_km_auth_user`
  95. SELECT NULL AS r_id,auth_id,create_user_id AS user_id,1 AS auth,now() AS create_time,create_user_id AS create_user_id FROM (
  96. SELECT (
  97. SELECT COUNT(1) FROM wk_km_auth_user WHERE auth_id=a.auth_id) AS num,create_user_id,auth_id FROM wk_km_folder AS a) AS a WHERE a.num='0';
  98. INSERT INTO `wk_km_auth_user`
  99. SELECT NULL AS r_id,auth_id,create_user_id AS user_id,1 AS auth,now() AS create_time,create_user_id AS create_user_id FROM (
  100. SELECT (
  101. SELECT COUNT(1) FROM wk_km_auth_user WHERE auth_id=a.auth_id) AS num,create_user_id,auth_id FROM wk_km_document AS a) AS a WHERE a.num='0';
  102. ALTER TABLE `wk_examine`
  103. ADD COLUMN `examine_init_id` bigint(20) NULL COMMENT '审批初始化Id' AFTER `examine_id`;
  104. UPDATE `wk_examine` SET `examine_init_id` = examine_id;
  105. DELETE FROM `wk_crm_scene` WHERE is_system='1' and name ='我参与的客户';
  106. DELETE FROM `wk_crm_scene` WHERE is_system='1' and name ='我参与的合同';
  107. DELETE FROM `wk_crm_scene` WHERE is_system='1' and name ='我参与的商机';
  108. CREATE TABLE `wk_crm_team_members` (
  109. `id` int(11) NOT NULL AUTO_INCREMENT,
  110. `type` int(1) NOT NULL COMMENT '类型,同crm类型',
  111. `type_id` int(11) NOT NULL COMMENT '对应类型主键ID',
  112. `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  113. `power` int(1) DEFAULT NULL COMMENT '1 只读 2 读写 3 负责人',
  114. `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  115. `expires_time` datetime DEFAULT NULL COMMENT '过期时间',
  116. PRIMARY KEY (`id`),
  117. KEY `type` (`type`,`type_id`),
  118. KEY `user_id` (`user_id`)
  119. ) ENGINE=InnoDB AUTO_INCREMENT=348 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='crm团队成员表';
  120. INSERT INTO `wk_crm_team_members` (`type`,`type_id`,`user_id`,`power`,`create_time`,`expires_time`)
  121. SELECT 2 AS type,a.type_id,user_id,2 AS power,now() AS create_time,NULL AS expires_time FROM (
  122. SELECT a.customer_id AS type_id,substring_index(substring_index(a.rw_user_id,',',b.help_topic_id+1),',',-1) AS user_id FROM wk_crm_customer AS a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.rw_user_id)-length(
  123. REPLACE (a.rw_user_id,',',''))+1) WHERE a.rw_user_id !=',') AS a WHERE a.user_id !='';
  124. INSERT INTO `wk_crm_team_members` (`type`,`type_id`,`user_id`,`power`,`create_time`,`expires_time`)
  125. SELECT 2 AS type,a.type_id,user_id,1 AS power,now() AS create_time,NULL AS expires_time FROM (
  126. SELECT a.customer_id AS type_id,substring_index(substring_index(a.ro_user_id,',',b.help_topic_id+1),',',-1) AS user_id FROM wk_crm_customer AS a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.ro_user_id)-length(
  127. REPLACE (a.ro_user_id,',',''))+1) WHERE a.ro_user_id !=',') AS a WHERE a.user_id !='';
  128. INSERT INTO `wk_crm_team_members` (`type`,`type_id`,`user_id`,`power`,`create_time`,`expires_time`)
  129. SELECT 6 AS type,a.type_id,user_id,2 AS power,now() AS create_time,NULL AS expires_time FROM (
  130. SELECT a.contract_id AS type_id,substring_index(substring_index(a.rw_user_id,',',b.help_topic_id+1),',',-1) AS user_id FROM wk_crm_contract AS a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.rw_user_id)-length(
  131. REPLACE (a.rw_user_id,',',''))+1) WHERE a.rw_user_id !=',') AS a WHERE a.user_id !='';
  132. INSERT INTO `wk_crm_team_members` (`type`,`type_id`,`user_id`,`power`,`create_time`,`expires_time`)
  133. SELECT 6 AS type,a.type_id,user_id,1 AS power,now() AS create_time,NULL AS expires_time FROM (
  134. SELECT a.contract_id AS type_id,substring_index(substring_index(a.ro_user_id,',',b.help_topic_id+1),',',-1) AS user_id FROM wk_crm_contract AS a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.ro_user_id)-length(
  135. REPLACE (a.ro_user_id,',',''))+1) WHERE a.ro_user_id !=',') AS a WHERE a.user_id !='';
  136. INSERT INTO `wk_crm_team_members` (`type`,`type_id`,`user_id`,`power`,`create_time`,`expires_time`)
  137. SELECT 5 AS type,a.type_id,user_id,2 AS power,now() AS create_time,NULL AS expires_time FROM (
  138. SELECT a.business_id AS type_id,substring_index(substring_index(a.rw_user_id,',',b.help_topic_id+1),',',-1) AS user_id FROM wk_crm_business AS a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.rw_user_id)-length(
  139. REPLACE (a.rw_user_id,',',''))+1) WHERE a.rw_user_id !=',') AS a WHERE a.user_id !='';
  140. INSERT INTO `wk_crm_team_members` (`type`,`type_id`,`user_id`,`power`,`create_time`,`expires_time`)
  141. SELECT 5 AS type,a.type_id,user_id,1 AS power,now() AS create_time,NULL AS expires_time FROM (
  142. SELECT a.business_id AS type_id,substring_index(substring_index(a.ro_user_id,',',b.help_topic_id+1),',',-1) AS user_id FROM wk_crm_business AS a JOIN mysql.help_topic b ON b.help_topic_id< (length(a.ro_user_id)-length(
  143. REPLACE (a.ro_user_id,',',''))+1) WHERE a.ro_user_id !=',') AS a WHERE a.user_id !='';
  144. CREATE TABLE `wk_admin_role_auth` (
  145. `id` int(11) NOT NULL AUTO_INCREMENT,
  146. `role_id` int(11) NOT NULL COMMENT '角色ID',
  147. `menu_id` int(11) NOT NULL COMMENT '菜单ID',
  148. `auth_role_id` int(11) DEFAULT NULL COMMENT '能查询的角色ID',
  149. `remark` varchar(100) DEFAULT NULL COMMENT '备注',
  150. PRIMARY KEY (`id`) USING BTREE,
  151. KEY `role_type` (`auth_role_id`) USING BTREE
  152. ) ENGINE=InnoDB AUTO_INCREMENT=5449 DEFAULT CHARSET=utf8 COMMENT='角色表';
  153. CREATE TABLE `wk_crm_invoice_data` (
  154. `id` int(11) NOT NULL AUTO_INCREMENT,
  155. `field_id` int(11) NOT NULL,
  156. `name` varchar(255) NOT NULL COMMENT '字段名称',
  157. `value` longtext,
  158. `create_time` datetime NOT NULL,
  159. `batch_id` varchar(32) NOT NULL,
  160. PRIMARY KEY (`id`) USING BTREE,
  161. KEY `batch_id` (`batch_id`) USING BTREE,
  162. KEY `name` (`name`) USING BTREE
  163. ) ENGINE=InnoDB AUTO_INCREMENT=2250 DEFAULT CHARSET=utf8mb4 COMMENT='发票扩展字段数据表';
  164. INSERT INTO `wk_crm_field_sort`
  165. SELECT null as id,null as field_id,'teamMemberIds' as field_name,'相关团队' as name,2 as label,10 as type,100 as style,24 as sort,user_id,0 as is_hide FROM wk_crm_field_sort WHERE label ='2' GROUP BY user_id;
  166. INSERT INTO `wk_crm_field_sort`
  167. SELECT null as id,null as field_id,'teamMemberIds' as field_name,'相关团队' as name,3 as label,10 as type,100 as style,24 as sort,user_id,0 as is_hide FROM wk_crm_field_sort WHERE label ='3' GROUP BY user_id;
  168. INSERT INTO `wk_crm_field_sort`
  169. SELECT null as id,null as field_id,'teamMemberIds' as field_name,'相关团队' as name,5 as label,10 as type,100 as style,24 as sort,user_id,0 as is_hide FROM wk_crm_field_sort WHERE label ='5' GROUP BY user_id;
  170. INSERT INTO `wk_crm_field_sort`
  171. SELECT null as id,null as field_id,'teamMemberIds' as field_name,'相关团队' as name,6 as label,10 as type,100 as style,24 as sort,user_id,0 as is_hide FROM wk_crm_field_sort WHERE label ='6' GROUP BY user_id;
  172. INSERT INTO `wk_crm_field_sort`
  173. SELECT null as id,null as field_id,'teamMemberIds' as field_name,'相关团队' as name,7 as label,10 as type,100 as style,24 as sort,user_id,0 as is_hide FROM wk_crm_field_sort WHERE label ='7' GROUP BY user_id;
  174. ALTER TABLE `wk_crm_business`
  175. MODIFY COLUMN `ro_user_id` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '只读权限' AFTER `batch_id`,
  176. MODIFY COLUMN `rw_user_id` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '读写权限' AFTER `ro_user_id`;
  177. SET FOREIGN_KEY_CHECKS = 1;