CREATE TABLE `sales_area_report` (
  `report_id` bigint NOT NULL AUTO_INCREMENT COMMENT '提报ID',
  `product_category` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品大类编码',
  `product_category_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '产品大类名称',
  `sales_area_code` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '销售区域编码',
  `sales_area_name` varchar(100) COLLATE utf8mb4_general_ci NOT NULL COMMENT '销售区域名称',
  `manager_id` bigint NOT NULL COMMENT '负责人ID',
  `manager_name` varchar(64) COLLATE utf8mb4_general_ci NOT NULL COMMENT '负责人姓名',
  `report_status` char(1) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '提报状态（0初始化 1已提交）',
  `report_time` datetime DEFAULT NULL COMMENT '提报时间',
  `create_by` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者',
  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`report_id`),
  KEY `idx_product_category` (`product_category`),
  KEY `idx_sales_area` (`sales_area_code`),
  KEY `idx_manager` (`manager_id`),
  KEY `idx_report_status` (`report_status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci 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('区域提报', '3', '1', 'report', 'system/report/index', 1, 0, 'C', '0', '0', 'system:report:list', 'form', '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', 'system:report: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', 'system:report: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', 'system:report: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', 'system:report: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', 'system:report:export',       '#', 'admin', sysdate(), '', null, '');