From b46341bd32cf7bbdccb032ce53ddacb01f6cb0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Fri, 22 Aug 2025 15:52:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(shop):=20=E4=BC=98=E5=8C=96=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E4=BF=A1=E6=81=AF=E8=8E=B7=E5=8F=96=E5=92=8C=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 ShopMainController 中的 debug 日志 - 修改 ShopWebsiteServiceImpl 中的缓存键前缀为 PascalCase - 删除 ShopWebsiteServiceImpl 中的冗余打印语句 - 删除整个 debug_navigation_data.sql 文件 --- debug_navigation_data.sql | 110 ------------------ .../shop/controller/ShopMainController.java | 1 + .../service/impl/ShopWebsiteServiceImpl.java | 3 +- 3 files changed, 2 insertions(+), 112 deletions(-) delete mode 100644 debug_navigation_data.sql diff --git a/debug_navigation_data.sql b/debug_navigation_data.sql deleted file mode 100644 index 35bb568..0000000 --- a/debug_navigation_data.sql +++ /dev/null @@ -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); diff --git a/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java b/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java index 1cf862c..5b96b22 100644 --- a/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java +++ b/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java @@ -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); diff --git a/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java b/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java index a9ec410..9eda00b 100644 --- a/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java +++ b/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java @@ -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("请先创建商城"); }