


CREATE TABLE `fs_user_course_company_statistics` (
 `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
 `project_id` BIGINT DEFAULT NULL COMMENT '项目ID',

 `complete_watch_count` INT DEFAULT NULL COMMENT '完播次数（人次）',
 `watch_count` INT DEFAULT NULL COMMENT '观看次数（人次）',

 `answer_count` INT DEFAULT NULL COMMENT '答题人次',
 `correct_count` INT DEFAULT NULL COMMENT '正确人次',

 `receive_count` INT DEFAULT NULL COMMENT '领取次数',
 `receive_amount` DECIMAL(10,2) DEFAULT NULL COMMENT '领取金额（元）',

 `user_count` INT DEFAULT NULL COMMENT '会员数量',
 `user_blacklist_count` INT DEFAULT NULL COMMENT '会员黑名单数量',
 `company_id` BIGINT DEFAULT NULL COMMENT '公司ID',
 `company_name` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '公司名称',

 `create_date` DATE DEFAULT NULL COMMENT '统计日期',
 `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
 `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
 `create_by` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人',
 `update_by` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '更新人',

 PRIMARY KEY (`id`) USING BTREE,
 KEY `idx_project_id` (`project_id`),
 KEY `idx_create_date` (`create_date`)
) ENGINE=InnoDB
  DEFAULT CHARSET=utf8mb4
  COLLATE=utf8mb4_0900_ai_ci
  ROW_FORMAT=DYNAMIC
    COMMENT='用户看课统计表（含完播率、答题统计、领取信息等）';



-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('会员每日看课统计', '1680', '1', 'statistics', 'course/statistics/index', 1, 0, 'C', '0', '0', 'course:statistics:list', '#', 'admin', sysdate(), '', null, '会员每日看课统计菜单');

-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();

-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('会员每日看课统计查询', @parentId, '1',  '#', '', 1, 0, 'F', '0', '0', 'course:statistics:query',        '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('会员每日看课统计新增', @parentId, '2',  '#', '', 1, 0, 'F', '0', '0', 'course:statistics:add',          '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('会员每日看课统计修改', @parentId, '3',  '#', '', 1, 0, 'F', '0', '0', 'course:statistics:edit',         '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('会员每日看课统计删除', @parentId, '4',  '#', '', 1, 0, 'F', '0', '0', 'course:statistics:remove',       '#', 'admin', sysdate(), '', null, '');

insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('会员每日看课统计导出', @parentId, '5',  '#', '', 1, 0, 'F', '0', '0', 'course:statistics:export',       '#', 'admin', sysdate(), '', null, '');



