refactor(cms): 移除产品分类中的parentId字段及相关索引
- 从实体类CmsProductCategory中删除parentId字段及其注释 - 从参数类CmsProductCategoryParam中删除parentId查询字段及注释 - 删除数据库表cms_product_category中parent_id列及其索引定义 - 保留兼容已有库的parent_id列创建语句,确保前向兼容性 - 优化数据库表结构,简化产品分类层级设计
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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`);
|
||||
|
||||
-- ----------------------------
|
||||
-- 产品表
|
||||
-- 官网展示的云产品
|
||||
|
||||
Reference in New Issue
Block a user