Files
guilixu-admin/offline-statistics-menu-10606.sql
gxwebsoft ced8c7cff7 feat(shop-zone): 新增专区销量统计功能
- 后端新增专区销量统计相关 VO 并扩展 ShopHomeSection 实体
- 新增批量查询专区销量汇总与商品排行的 Mapper 方法及接口
- Controller 增加获取专区销量统计的接口支持时间范围查询
- 前端接口定义新增专区销量统计类型及请求方法
- 专区管理页面列表新增销量件数、销售额列及销量详情按钮
- 实现专区销量统计弹窗支持时间筛选、汇总展示和排行显示
- 完成前端相关界面和交互设计,保证功能完整可用
- 统计口径基于已支付且未取消/退款订单商品实际成交数据
2026-08-17 12:40:08 +08:00

53 lines
2.2 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ============================================================
-- 报表统计菜单(tenant_id=10606,挂在「商城」顶级菜单下)
-- 作用:让前端动态路由 /statistics 自动生效(component=shop/statistics
-- 说明:sys_menu 在 gxwebsoft_core 库;本 SQL 用全限定名,可在任意有权限的库执行。
-- ============================================================
-- 1) 插入报表统计菜单
-- parent_id / app_id 自动取自「商城」顶级菜单(title 含"商城"parent_id=0
-- NOT EXISTS 防止重复插入(重复执行安全)
INSERT INTO gxwebsoft_core.sys_menu
(parent_id, title, path, component, menu_type, sort_number, authority, icon, hide, tenant_id, app_id, deleted)
SELECT
p.menu_id, -- 商城父级 menu_id
'报表统计',
'/statistics',
'shop/statistics',
0, -- 0=菜单
60, -- 排序号(放商城菜单末尾)
'shop:statistics:view',
'BarChartOutlined',
0, -- 0=显示
10606,
p.app_id,
0
FROM gxwebsoft_core.sys_menu p
WHERE p.tenant_id = 10606
AND p.parent_id = 0
AND p.title LIKE '%商城%'
AND NOT EXISTS (
SELECT 1 FROM gxwebsoft_core.sys_menu s
WHERE s.tenant_id = 10606 AND s.component = 'shop/statistics'
)
LIMIT 1;
-- 2) 把新菜单分配给「商城」父级已有的角色(否则角色没有该菜单权限,左侧导航看不到)
INSERT INTO gxwebsoft_core.sys_role_menu (role_id, menu_id)
SELECT rm.role_id, m.menu_id
FROM gxwebsoft_core.sys_menu m
JOIN gxwebsoft_core.sys_menu p ON p.menu_id = m.parent_id
JOIN gxwebsoft_core.sys_role_menu rm ON rm.menu_id = p.menu_id
WHERE m.tenant_id = 10606
AND m.component = 'shop/statistics'
AND NOT EXISTS (
SELECT 1 FROM gxwebsoft_core.sys_role_menu x
WHERE x.role_id = rm.role_id AND x.menu_id = m.menu_id
);
-- ============================================================
-- 排查辅助:若第1步未插入(商城父级标题不含"商城"),先用下面语句确认父级 menu_id
-- SELECT menu_id, title, app_id FROM gxwebsoft_core.sys_menu
-- WHERE tenant_id=10606 AND parent_id=0 AND title LIKE '%商城%';
-- ============================================================