refactor(shop): 优化商城信息获取和缓存逻辑
- 移除 ShopMainController 中的 debug 日志 - 修改 ShopWebsiteServiceImpl 中的缓存键前缀为 PascalCase - 删除 ShopWebsiteServiceImpl 中的冗余打印语句 - 删除整个 debug_navigation_data.sql 文件
This commit is contained in:
@@ -1,110 +0,0 @@
|
||||
-- 检查导航数据的SQL查询
|
||||
-- 请将 {tenantId} 替换为实际的租户ID
|
||||
|
||||
-- 1. 检查网站基本信息
|
||||
SELECT
|
||||
website_id,
|
||||
tenant_id,
|
||||
tenant_name,
|
||||
website_name,
|
||||
running,
|
||||
version,
|
||||
expiration_time,
|
||||
create_time
|
||||
FROM cms_website
|
||||
WHERE tenant_id = {tenantId};
|
||||
|
||||
-- 2. 检查顶部导航数据
|
||||
SELECT
|
||||
navigation_id,
|
||||
title,
|
||||
parent_id,
|
||||
model,
|
||||
path,
|
||||
icon,
|
||||
color,
|
||||
hide,
|
||||
top,
|
||||
bottom,
|
||||
position,
|
||||
sort_number,
|
||||
target,
|
||||
tenant_id,
|
||||
deleted
|
||||
FROM cms_navigation
|
||||
WHERE tenant_id = {tenantId}
|
||||
AND deleted = 0
|
||||
AND hide = 0
|
||||
AND (top = 0 OR position = 1)
|
||||
ORDER BY sort_number ASC, position ASC, navigation_id ASC;
|
||||
|
||||
-- 3. 检查底部导航数据
|
||||
SELECT
|
||||
navigation_id,
|
||||
title,
|
||||
parent_id,
|
||||
model,
|
||||
path,
|
||||
icon,
|
||||
color,
|
||||
hide,
|
||||
top,
|
||||
bottom,
|
||||
position,
|
||||
sort_number,
|
||||
target,
|
||||
tenant_id,
|
||||
deleted
|
||||
FROM cms_navigation
|
||||
WHERE tenant_id = {tenantId}
|
||||
AND deleted = 0
|
||||
AND hide = 0
|
||||
AND (bottom = 0 OR position = 2)
|
||||
ORDER BY sort_number ASC, position ASC, navigation_id ASC;
|
||||
|
||||
-- 4. 检查所有导航数据(包括隐藏的)
|
||||
SELECT
|
||||
navigation_id,
|
||||
title,
|
||||
parent_id,
|
||||
model,
|
||||
path,
|
||||
icon,
|
||||
color,
|
||||
hide,
|
||||
top,
|
||||
bottom,
|
||||
position,
|
||||
sort_number,
|
||||
target,
|
||||
tenant_id,
|
||||
deleted,
|
||||
status
|
||||
FROM cms_navigation
|
||||
WHERE tenant_id = {tenantId}
|
||||
ORDER BY deleted ASC, hide ASC, sort_number ASC;
|
||||
|
||||
-- 5. 统计导航数据
|
||||
SELECT
|
||||
'总导航数' as type,
|
||||
COUNT(*) as count
|
||||
FROM cms_navigation
|
||||
WHERE tenant_id = {tenantId}
|
||||
UNION ALL
|
||||
SELECT
|
||||
'有效导航数' as type,
|
||||
COUNT(*) as count
|
||||
FROM cms_navigation
|
||||
WHERE tenant_id = {tenantId} AND deleted = 0
|
||||
UNION ALL
|
||||
SELECT
|
||||
'顶部导航数' as type,
|
||||
COUNT(*) as count
|
||||
FROM cms_navigation
|
||||
WHERE tenant_id = {tenantId} AND deleted = 0 AND hide = 0 AND (top = 0 OR position = 1)
|
||||
UNION ALL
|
||||
SELECT
|
||||
'底部导航数' as type,
|
||||
COUNT(*) as count
|
||||
FROM cms_navigation
|
||||
WHERE tenant_id = {tenantId} AND deleted = 0 AND hide = 0 AND (bottom = 0 OR position = 2);
|
||||
@@ -42,6 +42,7 @@ public class ShopMainController extends BaseController {
|
||||
try {
|
||||
// 使用专门的商城信息获取方法
|
||||
ShopVo shopVo = shopWebsiteService.getShopInfo(tenantId);
|
||||
// log.debug("获取商城信息成功: {}", shopVo);
|
||||
return success(shopVo);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return fail(e.getMessage(), null);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class ShopWebsiteServiceImpl implements ShopWebsiteService {
|
||||
/**
|
||||
* 商城信息缓存键前缀
|
||||
*/
|
||||
private static final String SHOP_INFO_KEY_PREFIX = "shop_info:";
|
||||
private static final String SHOP_INFO_KEY_PREFIX = "ShopInfo:";
|
||||
|
||||
@Override
|
||||
public ShopVo getShopInfo(Integer tenantId) {
|
||||
@@ -55,7 +55,6 @@ public class ShopWebsiteServiceImpl implements ShopWebsiteService {
|
||||
|
||||
// 直接调用 CMS 服务获取站点信息,然后使用商城专用缓存
|
||||
ShopVo shopVO = cmsWebsiteService.getSiteInfo(tenantId);
|
||||
System.out.println("shopVO = " + shopVO);
|
||||
if (shopVO == null) {
|
||||
throw new RuntimeException("请先创建商城");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user