// ============================================================================ // 【文件说明】HwPortalConfig.cs - 门户配置实体类 // ============================================================================ // 这个实体类对应数据库表 hw_portal_config,用于存储门户的配置信息。 // // 【业务场景】 // 门户配置是官网的核心配置数据,包括: // - 首页轮播图配置 // - 导航菜单配置 // - 页面区块配置 // - 按钮和路由配置 // // 这个表支持树形结构(parent_id + ancestors),可以形成层级配置。 // ============================================================================ namespace Admin.NET.Plugin.HwPortal; /// /// 门户配置实体类。 /// /// 【业务说明】 /// 门户配置用于管理官网的各种配置项,支持: /// 1. 树形结构:parent_id + ancestors 实现层级配置 /// 2. 分类管理:portal_config_type 区分不同类型的配置 /// 3. 排序控制:portal_config_order 控制展示顺序 /// 4. 路由配置:router_address 配置跳转地址 /// /// [SugarTable("hw_portal_config")] public class HwPortalConfig : HwPortalBaseEntity { /// /// 配置主键ID。 /// [SugarColumn(ColumnName = "portal_config_id", IsPrimaryKey = true, IsIdentity = true)] public long? PortalConfigId { get; set; } /// /// 配置类型。 /// /// 【业务说明】 /// 用于区分不同类型的配置,如: /// - "1": 首页配置 /// - "2": 产品配置 /// - "3": 案例配置 /// /// [SugarColumn(ColumnName = "portal_config_type")] public string PortalConfigType { get; set; } /// /// 配置类型ID。 /// /// 【业务说明】 /// 关联 hw_portal_config_type 表的主键。 /// /// [SugarColumn(ColumnName = "portal_config_type_id")] public long? PortalConfigTypeId { get; set; } /// /// 配置标题。 /// [SugarColumn(ColumnName = "portal_config_title")] public string PortalConfigTitle { get; set; } /// /// 排序号。 /// [SugarColumn(ColumnName = "portal_config_order")] public long? PortalConfigOrder { get; set; } /// /// 配置描述。 /// [SugarColumn(ColumnName = "portal_config_desc")] public string PortalConfigDesc { get; set; } /// /// 按钮名称。 /// /// 【业务说明】 /// 如果这个配置项需要展示按钮,这里配置按钮的文字。 /// 例如:"了解更多"、"立即咨询"。 /// /// [SugarColumn(ColumnName = "button_name")] public string ButtonName { get; set; } /// /// 路由地址。 /// /// 【业务说明】 /// 点击配置项后跳转的路由地址。 /// 例如:"/product/detail"、"http://external.com"。 /// /// [SugarColumn(ColumnName = "router_address")] public string RouterAddress { get; set; } /// /// 配置图片。 /// /// 【业务说明】 /// 配置项的图片URL,用于轮播图、缩略图等。 /// /// [SugarColumn(ColumnName = "portal_config_pic")] public string PortalConfigPic { get; set; } /// /// 配置类型名称(冗余字段)。 /// [SugarColumn(ColumnName = "config_type_name")] public string ConfigTypeName { get; set; } /// /// 首页配置类型图片。 /// [SugarColumn(ColumnName = "home_config_type_pic")] public string HomeConfigTypePic { get; set; } /// /// 首页配置类型图标。 /// [SugarColumn(ColumnName = "config_type_icon")] public string HomeConfigTypeIcon { get; set; } /// /// 首页配置类型名称。 /// [SugarColumn(ColumnName = "home_config_type_name")] public string HomeConfigTypeName { get; set; } /// /// 首页配置类型分类。 /// [SugarColumn(ColumnName = "config_type_classfication")] public string HomeConfigTypeClassfication { get; set; } /// /// 父配置ID。 /// /// 【树形结构说明】 /// 用于构建层级配置结构: /// - parent_id 为 null 或 0:顶级配置 /// - parent_id 有值:子配置 /// /// [SugarColumn(ColumnName = "parent_id")] public long? ParentId { get; set; } /// /// 祖级列表。 /// /// 【树形结构说明】 /// ancestors 存储从根节点到当前节点的完整路径,用逗号分隔。 /// 例如:"0,100,101" 表示:根节点(0) -> 一级节点(100) -> 当前节点(101) /// /// 【为什么需要 ancestors?】 /// 1. 快速查询所有子节点:WHERE ancestors LIKE '0,100,%' /// 2. 快速查询所有父节点:按 ancestors 中的 ID 逐级查询 /// 3. 避免递归查询:不需要递归就能获取层级关系 /// /// 对比 Java 若依: /// 若依的菜单、部门等树形结构也使用 ancestors 字段。 /// 这是若依框架的标准设计模式。 /// /// [SugarColumn(ColumnName = "ancestors")] public string Ancestors { get; set; } }