单店预约系统 · 实体关系
erDiagram Customer { int id PK "ID" string phone UK "手机号(UK)" string name "姓名" string gender "性别" int vipLevel "VIP等级" int totalVisits "累计到店" decimal totalSpent "累计消费(元)" datetime lastVisitAt "上次到店" text remark "备注" datetime createdAt "注册时间" } Staff { int id PK "ID" string name "姓名" string level "等级" int years "从业年数" boolean enabled "启用" } Service { int id PK "ID" string name "名称" int durationMin "时长(分钟)" decimal price "价格(元)" string icon "图标" string description "描述" string tag "分类" int sortOrder "排序" boolean enabled "启用" } Appointment { int id PK "ID" int customerId FK "客户FK" int serviceId FK "服务项FK" int staffId FK "发型师FK" datetime startAt "开始时间" datetime endAt "结束时间" string status "状态" string source "来源" text remark "客户备注" datetime createdAt "提交时间" datetime confirmedAt "确认时间" } AppointmentStatusLog { int id PK "ID" int appointmentId FK "预约单FK" string fromStatus "原状态" string toStatus "新状态" string changedBy "操作人" string reason "原因" datetime changedAt "变更时间" } CustomerPreference { int id PK "ID" int customerId FK "客户FK" string tag "标签" string source "来源" datetime updatedAt "更新时间" } SmsLog { int id PK "ID" int customerId FK "收件人FK" string templateCode "模板编码" text content "内容" string status "状态" datetime sentAt "发送时间" decimal cost "费用(分)" } Shop { int id PK "ID" string name "店名" string ownerPhone "老板手机号" string openTime "营业开始" string closeTime "营业结束" } Appointment }o--|| Customer : "属于" Appointment }o--|| Service : "预约" Appointment }o--|| Staff : "指派" AppointmentStatusLog }o--|| Appointment : "记录" CustomerPreference }o--|| Customer : "属于" SmsLog }o--|| Customer : "发送给"