-- ----------------------------
-- 新增群体标签表
-- ----------------------------
DROP TABLE IF EXISTS `biz_user_tag`;
CREATE TABLE `biz_user_tag` (
  `user_tag_id` int NOT NULL AUTO_INCREMENT,
  `user_id` varchar(64) DEFAULT NULL COMMENT '用户ID',
  `tag` varchar(64) DEFAULT NULL COMMENT '标签',
  PRIMARY KEY (`user_tag_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;

-- ----------------------------
-- 初始化所有所有注册用户的群体标签
-- ----------------------------
INSERT INTO `biz_user_tag` (`user_id`, `tag`)
SELECT `user_id`, '居民' FROM `biz_user` WHERE resident_id is not null;

INSERT INTO `biz_user_tag` (`user_id`, `tag`)
SELECT `user_id`, '其他' FROM `biz_user` WHERE resident_id is null;

-- ----------------------------
-- 为所有注册用户都初始化一条积分数据:
--      荣誉积分和消费积分初始值都为 0
-- ----------------------------
INSERT INTO che_points (user_id, honor_points, spend_points)
SELECT user_id, 0 as honor_points, 0 as spend_points
FROM biz_user
WHERE user_id NOT IN (SELECT user_id FROM che_points);

-- ----------------------------
-- 插入活动数据
-- ----------------------------
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('04d28037-9eb7-4e6f-9f1e-a0ae0cb9f33f','中海南溪社区弘扬生态文明 共建绿色南溪--植树主题活动','hjws',NULL,'2023-03-23 01:00:00','2023-03-23 02:00:00','2023-03-23 00:00:00','2023-03-23 00:37:52',NULL,'community','1',NULL,NULL,'',NULL,'3',60,'2023-06-02 19:38:35',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('0f555410-e9ee-42c9-a881-0e1cf67d7f80','中海南溪社区“绿色有氧魅五月  健康养生献母亲”母亲节活动','whyl',NULL,'2023-05-12 01:00:00','2023-05-12 02:00:00','2023-05-12 00:00:00','2023-05-12 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-02 19:31:38','2023-06-02 19:33:01',NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('107b2ef1-63ca-486b-9c67-35b4555e2ace','中海南溪社区“义诊进社区 情暖邻里心”义诊活动','jyxj',NULL,'2023-03-02 01:00:00','2023-03-02 02:00:00','2023-03-02 00:00:00','2023-03-02 00:02:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-02 19:29:46','2023-06-02 19:30:14',NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('145fd84d-0ae9-4a8d-b3d3-da1234a62331','学雷锋志愿服务 清理白色垃圾净化美好家园--志愿服务活动','zyfu',NULL,'2023-02-28 01:00:00','2023-02-28 02:00:00','2023-02-28 00:00:00','2023-02-28 00:01:00',NULL,'community','1',NULL,NULL,'15888888888',NULL,'3',10,'2023-06-07 15:12:37',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('15cfdc92-46ab-4338-85c9-86abfb4c28d3','环城社区“认领微心愿”活动','zyfu',NULL,'2023-02-23 01:00:00','2023-02-23 02:00:00','2023-02-23 00:00:00','2023-02-23 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-05 19:44:22',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('1d1cb0ab-d726-45b1-b00a-05b043371b21','无偿献血彩绘人生  拯救生命筑造爱的工程','zyfu',NULL,'2023-03-18 01:00:00','2023-03-18 02:00:00','2023-03-18 00:00:00','2023-03-18 00:01:00',NULL,'community','1',NULL,NULL,'15888888888',NULL,'3',10,'2023-06-07 15:11:36',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('4858f34d-fd76-4d0d-966a-9d8701956e01','中海南溪社区志愿帮扶活动','zyfu',NULL,'2023-05-10 01:00:00','2023-05-10 02:00:00','2023-05-10 00:00:00','2023-05-10 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',60,'2023-06-02 19:39:26','2023-06-05 19:40:33',NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('5016593d-711d-44a8-bd0b-f587f59076c6','环城社区消防安全培训','zlff',NULL,'2023-04-22 01:00:00','2023-04-22 02:00:00','2023-04-22 00:00:00','2023-04-22 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-05 19:42:17',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('50894d61-2174-496b-ad22-eb215f5e3b76','环城社区参与志愿活动','zyfu',NULL,'2023-03-19 01:00:00','2023-03-19 02:00:00','2023-03-19 00:00:00','2023-03-19 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-05 19:43:14',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('545327d6-5169-48c8-8e13-b7cba4dfa996','环城社区参与垃圾分类活动','hjws',NULL,'2023-03-30 01:00:00','2023-03-30 02:00:00','2023-03-30 00:00:00','2023-03-30 00:01:00',NULL,'community','1',NULL,NULL,'15888888888',NULL,'3',20,'2023-06-07 16:07:12',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('57c72eb1-65ff-4fb4-b1ea-a356e3873812','中海南溪社区防金融诈骗 共建平安和谐社区--知识讲座','jyxj',NULL,'2023-02-17 01:00:00','2023-02-17 02:00:00','2023-02-17 00:00:00','2023-02-17 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-02 19:32:44','2023-06-02 19:32:56',NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('5ac471b5-76ce-40e7-af4e-bd98b57bdd93','中海南溪社区防震减灾消防培训','zlff',NULL,'2023-05-08 01:00:00','2023-05-08 02:00:00','2023-05-08 00:00:00','2023-05-08 00:02:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-02 19:28:45','2023-06-02 19:30:20',NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('6902b064-5708-4580-96a2-ccb485a07ae8','幸福小区零距离 普法宣传进社区--普法宣传志愿服务活动','zyfu',NULL,'2023-05-18 01:00:00','2023-05-18 02:00:00','2023-05-18 00:00:00','2023-05-18 00:01:00',NULL,'community','1',NULL,NULL,'15888888888',NULL,'3',10,'2023-06-07 15:10:24',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('7a3047c3-d295-40a7-b0b7-48e5579b07b4','环城社区“邻里互助日”活动','gafw',NULL,'2023-02-27 01:00:00','2023-02-27 02:00:00','2023-02-27 00:00:00','2023-02-27 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-05 19:47:13',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('83273d0e-2d35-4b0e-8665-ab654d986074','环城社区开展“浓情妇女节烘焙暖人心”活动','whyl',NULL,'2023-03-07 01:00:00','2023-03-07 02:00:00','2023-03-07 00:00:00','2023-03-07 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-05 19:45:17',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('9cc5fee0-dad7-4468-851b-34f76aaf0813','中海南溪社区“党的二十大，发润中国心”普法宣传活动','jyxj',NULL,'2023-03-06 00:00:02','2023-03-06 00:01:02','2023-03-06 00:00:00','2023-03-06 00:00:01',50,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-02 19:23:00','2023-06-02 19:30:48',NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('9d6a3cf6-248d-4b19-a7d0-18902c75d730','“书香沁润心田  阅读点亮人生”--全民阅读主题活动','whyl',NULL,'2023-04-21 01:00:00','2023-04-21 02:00:00','2023-04-21 00:00:00','2023-04-21 00:01:00',NULL,'community','1',NULL,NULL,'15888888888',NULL,'3',10,'2023-06-07 15:07:53',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('a85096b2-fcbb-40fb-8762-dea16b05a81a','环城社区“多方联动开展世界读书日”活动','jyxj',NULL,'2023-04-23 01:00:00','2023-04-23 02:00:00','2023-04-23 00:00:00','2023-04-23 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-05 19:46:25',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('b5dfcebd-9fd7-418a-a8da-9b582b88b654','环城社区用电安全培训','jyxj',NULL,'2023-05-24 01:00:00','2023-05-24 02:00:00','2023-05-24 00:00:00','2023-05-24 00:01:00',NULL,'community','1',NULL,NULL,'15888888888',NULL,'3',20,'2023-06-07 16:04:00',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('bda42aa3-7e2c-4f80-a8e8-eef1b88538fa','春暖三月学雷锋 志愿服务我先行--志愿服务活动','zyfu',NULL,'2023-03-03 01:00:00','2023-03-03 02:00:00','2023-03-03 00:00:00','2023-03-03 00:01:00',NULL,'community','1',NULL,NULL,'15888888888',NULL,'3',10,'2023-06-07 15:09:12',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('bf8997e9-a506-45aa-a842-a88e3abd4d33','环城社区燃气安全宣传活动','jyxj',NULL,'2023-05-28 01:00:00','2023-05-28 02:00:00','2023-05-28 00:00:00','2023-05-28 00:01:00',NULL,'community','1',NULL,NULL,'15888888888',NULL,'3',20,'2023-06-07 16:05:08',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('c3610eca-7454-46aa-9c50-15c505426979','中海南溪社区“全民反诈，你我同行”','zlff',NULL,'2023-05-06 01:00:00','2023-05-06 02:00:00','2023-05-06 00:00:00','2023-05-06 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-02 19:27:46','2023-06-02 19:30:26',NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('c999a47f-75e9-481c-8932-8c6f538ffa14','环城社区“居民健康大管家”活动','jyxj',NULL,'2023-05-16 01:00:00','2023-05-16 02:00:00','2023-05-16 00:00:00','2023-05-16 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-05 19:48:01',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('e3cc3483-61c7-4316-8d4b-6e323fc5400c','中海南溪社区环保志愿活动','hjws',NULL,'2023-05-04 01:00:00','2023-05-04 02:00:00','2023-05-04 00:00:00','2023-05-04 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',60,'2023-06-02 19:34:52',NULL,NULL);
INSERT INTO `che_activity` (`activity_id`,`topic`,`type`,`image`,`start_time`,`end_time`,`reg_start_time`,`reg_end_time`,`reg_max_count`,`sponsor_type`,`sponsor_sys_id`,`sponsor_user_id`,`sponsor_name`,`sponsor_phone`,`description`,`status`,`point`,`create_time`,`update_time`,`remark`) VALUES ('f7cb12e4-a886-45ae-aa28-9f159b127615','环城社区“百日攻坚活动”','zlff',NULL,'2023-05-21 01:00:00','2023-05-21 02:00:00','2023-05-21 00:00:00','2023-05-21 00:01:00',NULL,'community','1',NULL,NULL,'',NULL,'3',20,'2023-06-05 19:40:14',NULL,NULL);

-- ----------------------------
-- 插入字典数据
-- ----------------------------
INSERT INTO `sys_dict_type` (`dict_name`,`dict_type`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES ('用户标签','user_tags','0','admin','2023-05-26 10:45:25','',NULL,NULL);
INSERT INTO `sys_dict_type` (`dict_name`,`dict_type`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES ('代金券种类','voucher_category','0','admin','2023-05-26 13:51:58','',NULL,NULL);

INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (0,'下沉干部','下沉干部','user_tags',NULL,'default','N','0','admin','2023-05-26 10:45:44','admin','2023-06-07 10:35:38',NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (1,'在职党员','在职党员','user_tags',NULL,'default','N','0','admin','2023-06-06 11:00:59','admin','2023-06-07 10:35:47',NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (2,'网格长','网格长','user_tags',NULL,'default','N','0','admin','2023-05-26 10:45:52','admin','2023-06-07 10:35:57',NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (3,'楼栋长','楼栋长','user_tags',NULL,'default','N','0','admin','2023-05-26 10:46:00','admin','2023-06-07 10:36:03',NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (4,'单元长','单元长','user_tags',NULL,'default','N','0','admin','2023-05-26 10:46:06','admin','2023-06-07 10:36:08',NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (5,'志愿者','志愿者','user_tags',NULL,'default','N','0','admin','2023-05-26 10:45:38','admin','2023-06-07 10:36:16',NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (6,'社区工作者','社区工作者','user_tags',NULL,'default','N','0','admin','2023-05-26 10:46:13','admin','2023-06-07 10:38:15',NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (7,'居民','居民','user_tags',NULL,'default','N','0','admin','2023-05-26 10:46:18','admin','2023-06-07 10:38:20',NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (8,'其他','其他','user_tags',NULL,'default','N','0','admin','2023-06-01 15:12:19','admin','2023-06-07 10:34:27',NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (0,'餐券','food','voucher_category',NULL,'default','N','0','admin','2023-05-26 13:52:49','admin','2023-05-26 16:40:40','life');
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (0,'课程','course','voucher_category',NULL,'default','N','0','admin','2023-05-26 13:53:08','admin','2023-05-26 16:40:58','entertainment');
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (0,'商超','supermarket','voucher_category',NULL,'default','N','0','admin','2023-05-26 13:53:29','admin','2023-05-26 16:40:45','life');
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (0,'生活服务','life','voucher_category',NULL,'default','N','0','admin','2023-05-26 16:39:42','',NULL,NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (0,'文化娱乐','entertainment','voucher_category',NULL,'default','N','0','admin','2023-05-26 16:40:08','',NULL,NULL);
INSERT INTO `sys_dict_data` (`dict_sort`,`dict_label`,`dict_value`,`dict_type`,`css_class`,`list_class`,`is_default`,`status`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES (0,'其他','other','voucher_category',NULL,'default','N','0','admin','2023-05-26 16:41:09','',NULL,NULL);

-- ----------------------------
-- 插入菜单配置
-- ----------------------------
INSERT INTO `sys_menu` (`menu_name`,`parent_id`,`order_num`,`path`,`component`,`query`,`is_frame`,`is_cache`,`menu_type`,`visible`,`status`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES ('群体管理',3000,3,'usertags','community/usertags/index',NULL,1,0,'C','0','0','','wechat','admin','2023-05-26 10:40:41','admin','2023-05-31 10:47:49','');

INSERT INTO `sys_menu` (`menu_name`,`parent_id`,`order_num`,`path`,`component`,`query`,`is_frame`,`is_cache`,`menu_type`,`visible`,`status`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES ('统计分析',0,14,'stat',NULL,NULL,1,0,'M','0','0','','chart','admin','2023-06-02 13:57:26','admin','2023-06-02 14:00:14','');
SELECT @parentId := LAST_INSERT_ID();

INSERT INTO `sys_menu` (`menu_name`,`parent_id`,`order_num`,`path`,`component`,`query`,`is_frame`,`is_cache`,`menu_type`,`visible`,`status`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES ('活动统计',@parentId,0,'activity','stat/activity/index',NULL,1,0,'C','0','0','stat:activity:query','monitor','admin','2023-06-02 13:59:08','',NULL,'');
INSERT INTO `sys_menu` (`menu_name`,`parent_id`,`order_num`,`path`,`component`,`query`,`is_frame`,`is_cache`,`menu_type`,`visible`,`status`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES ('按活动主题统计',@parentId,1,'activity-table-a','stat/activity/activity-table-a',NULL,1,0,'C','0','0','stat:activity:query','monitor','admin','2023-06-06 17:05:38','admin','2023-06-06 17:08:17','');
INSERT INTO `sys_menu` (`menu_name`,`parent_id`,`order_num`,`path`,`component`,`query`,`is_frame`,`is_cache`,`menu_type`,`visible`,`status`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) VALUES ('按活动次数统计',@parentId,2,'activity-table-b','stat/activity/activity-table-b',NULL,1,0,'C','0','0','stat:activity:query','monitor','admin','2023-06-06 17:07:10','admin','2023-06-06 17:08:50','');

-- ----------------------------
-- 修改志愿服务对应的活动类型
-- ----------------------------
UPDATE che_activity SET type='zyfu'
where activity_id = '9a796e8e-fdee-407f-b041-5c89be5f5b7a';

-- ----------------------------
-- 创建触发器，每新增一条biz_user记录就插入一条biz_user_tag记录，tag默认为居民
-- ----------------------------
DELIMITER $$
CREATE TRIGGER `insert_biz_user_tag` AFTER INSERT ON `biz_user` FOR EACH ROW
BEGIN
  INSERT INTO `biz_user_tag` (`user_id`, `tag`) VALUES (NEW.user_id, '居民');
END$$
DELIMITER ;