product_statistics.sql 3.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. CREATE TABLE product_statistics
  2. (
  3. id bigint AUTO_INCREMENT COMMENT '编号,主键自增' PRIMARY KEY,
  4. time date NOT NULL COMMENT '统计日期',
  5. spu_id bigint NOT NULL COMMENT '商品SPU编号',
  6. browse_count int DEFAULT 0 NOT NULL COMMENT '浏览量',
  7. browse_user_count int DEFAULT 0 NOT NULL COMMENT '访客量',
  8. favorite_count int DEFAULT 0 NOT NULL COMMENT '收藏数量',
  9. cart_count int DEFAULT 0 NOT NULL COMMENT '加购数量',
  10. order_count int DEFAULT 0 NOT NULL COMMENT '下单件数',
  11. order_pay_count int DEFAULT 0 NOT NULL COMMENT '支付件数',
  12. order_pay_price int DEFAULT 0 NOT NULL COMMENT '支付金额,单位:分',
  13. after_sale_count int DEFAULT 0 NOT NULL COMMENT '退款件数',
  14. after_sale_refund_price int DEFAULT 0 NOT NULL COMMENT '退款金额,单位:分',
  15. browse_convert_percent int DEFAULT 0 NOT NULL COMMENT '访客支付转化率(百分比)',
  16. creator varchar(64) DEFAULT '' NULL COMMENT '创建者',
  17. create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
  18. updater varchar(64) DEFAULT '' NULL COMMENT '更新者',
  19. update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  20. deleted bit DEFAULT b'0' NOT NULL COMMENT '是否删除',
  21. tenant_id bigint DEFAULT 0 NOT NULL COMMENT '租户编号'
  22. )
  23. COMMENT '商品统计表';
  24. CREATE INDEX idx_time
  25. ON product_statistics (time);
  26. CREATE INDEX idx_spu_id
  27. ON product_statistics (spu_id);
  28. INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES ('商品统计', '', 2, 6, 2358, 'product', 'fa:product-hunt', 'statistics/product/index', 'ProductStatistics', 0, true, true, true, '', '2023-12-15 18:54:28', '', '2023-12-15 18:54:33', false);
  29. SELECT @parentId1 := LAST_INSERT_ID();
  30. INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES ('商品统计查询', 'statistics:product:query', 3, 1, @parentId, '', '', '', null, 0, true, true, true, '', '2023-09-30 03:22:40', '', '2023-09-30 03:22:40', false);
  31. INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name, status, visible, keep_alive, always_show, creator, create_time, updater, update_time, deleted) VALUES ('商品统计导出', 'statistics:product:export', 3, 2, @parentId, '', '', '', null, 0, true, true, true, '', '2023-09-30 03:22:40', '', '2023-09-30 03:22:40', false);