From 149e93dc9a8346c6894a45d555329fd3905a7573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Thu, 23 Jul 2026 01:44:08 +0800 Subject: [PATCH] =?UTF-8?q?refactor(cms):=20=E7=A7=BB=E9=99=A4=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E5=88=86=E7=B1=BB=E4=B8=AD=E7=9A=84parentId=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=8F=8A=E7=9B=B8=E5=85=B3=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 从实体类CmsProductCategory中删除parentId字段及其注释 - 从参数类CmsProductCategoryParam中删除parentId查询字段及注释 - 删除数据库表cms_product_category中parent_id列及其索引定义 - 保留兼容已有库的parent_id列创建语句,确保前向兼容性 - 优化数据库表结构,简化产品分类层级设计 --- .../java/com/gxwebsoft/cms/entity/CmsProductCategory.java | 3 --- .../com/gxwebsoft/cms/param/CmsProductCategoryParam.java | 4 ---- src/main/java/com/gxwebsoft/cms/sql/cms_new_modules.sql | 7 +------ 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/main/java/com/gxwebsoft/cms/entity/CmsProductCategory.java b/src/main/java/com/gxwebsoft/cms/entity/CmsProductCategory.java index 9d7b494..5006a96 100644 --- a/src/main/java/com/gxwebsoft/cms/entity/CmsProductCategory.java +++ b/src/main/java/com/gxwebsoft/cms/entity/CmsProductCategory.java @@ -31,9 +31,6 @@ public class CmsProductCategory implements Serializable { @TableId(value = "category_id", type = IdType.AUTO) private Integer categoryId; - @Schema(description = "上级分类ID, 0=顶级") - private Integer parentId; - @Schema(description = "分类名称") private String categoryName; diff --git a/src/main/java/com/gxwebsoft/cms/param/CmsProductCategoryParam.java b/src/main/java/com/gxwebsoft/cms/param/CmsProductCategoryParam.java index e379bec..5130866 100644 --- a/src/main/java/com/gxwebsoft/cms/param/CmsProductCategoryParam.java +++ b/src/main/java/com/gxwebsoft/cms/param/CmsProductCategoryParam.java @@ -23,10 +23,6 @@ public class CmsProductCategoryParam extends BaseParam { @QueryField(type = QueryType.EQ) private Integer categoryId; - @Schema(description = "上级分类ID, 0=顶级") - @QueryField(type = QueryType.EQ) - private Integer parentId; - @Schema(description = "分类名称") @QueryField(type = QueryType.LIKE) private String categoryName; diff --git a/src/main/java/com/gxwebsoft/cms/sql/cms_new_modules.sql b/src/main/java/com/gxwebsoft/cms/sql/cms_new_modules.sql index 0f0e2cd..1d2f254 100644 --- a/src/main/java/com/gxwebsoft/cms/sql/cms_new_modules.sql +++ b/src/main/java/com/gxwebsoft/cms/sql/cms_new_modules.sql @@ -4,7 +4,6 @@ -- ---------------------------- CREATE TABLE IF NOT EXISTS `cms_product_category` ( `category_id` INT NOT NULL AUTO_INCREMENT COMMENT '分类ID', - `parent_id` INT NOT NULL DEFAULT 0 COMMENT '上级分类ID, 0=顶级', `category_name` VARCHAR(100) NOT NULL COMMENT '分类名称', `status` TINYINT NOT NULL DEFAULT 1 COMMENT '状态: 1启用 0禁用', `sort_number` INT NOT NULL DEFAULT 0 COMMENT '排序(数字越小越靠前)', @@ -13,13 +12,9 @@ CREATE TABLE IF NOT EXISTS `cms_product_category` ( `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`category_id`), - KEY `idx_tenant_id` (`tenant_id`), - KEY `idx_parent_id` (`parent_id`) + KEY `idx_tenant_id` (`tenant_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='产品分类'; --- 兼容已有库:补齐 parent_id 列(已存在则忽略) --- ALTER TABLE `cms_product_category` ADD COLUMN `parent_id` INT NOT NULL DEFAULT 0 COMMENT '上级分类ID, 0=顶级' AFTER `category_id`, ADD KEY `idx_parent_id` (`parent_id`); - -- ---------------------------- -- 产品表 -- 官网展示的云产品