/*
 Navicat Premium Dump SQL

 Source Server         : mixue
 Source Server Type    : MySQL
 Source Server Version : 90001 (9.0.1)
 Source Host           : localhost:3306
 Source Schema         : ai_article

 Target Server Type    : MySQL
 Target Server Version : 90001 (9.0.1)
 File Encoding         : 65001

 Date: 16/12/2025 11:29:17
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for ai_statistics_days
-- ----------------------------
DROP TABLE IF EXISTS `ai_statistics_days`;
CREATE TABLE `ai_statistics_days`  (
  `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  `author_id` int NOT NULL DEFAULT 0 COMMENT '作者ID',
  `author_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '作者名称',
  `channel` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1=baidu|2=toutiao|3=weixin',
  `stat_date` date NOT NULL COMMENT '统计日期（自然日）',
  `daily_published_count` int NULL DEFAULT 0 COMMENT '单日发文量',
  `cumulative_published_count` int NULL DEFAULT 0 COMMENT '累计发文量（当月1号至stat_date的累计发文量）',
  `day_revenue` decimal(18, 2) NULL DEFAULT 0.00 COMMENT '当日收益',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_author_stat_date`(`author_id` ASC, `channel` ASC, `stat_date` ASC) USING BTREE,
  INDEX `idx_stat_date`(`stat_date` ASC) USING BTREE,
  INDEX `idx_author_id`(`author_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'AI内容每日核心指标汇总表（日粒度数据）' ROW_FORMAT = Dynamic;

-- ----------------------------
-- Records of ai_statistics_days
-- ----------------------------
-- 数据已清空，由导入脚本从CSV文件导入

SET FOREIGN_KEY_CHECKS = 1;
