html: embed_local_images: false embed_svg: true offline: false toc: false
print_background: false export_on_save:
erDiagram
%% 用户模块
User ||--o{ UserAddress : "居住"
User ||--o{ Order : "下单"
User ||--|| Wallet : "拥有"
User {
int id PK "用户ID"
string phone "手机号"
string name "姓名"
string avatar "头像"
string gender "性别"
datetime birthdate "出生日期"
datetime created_at "创建时间"
datetime updated_at "更新时间"
int status "状态: 0-未激活, 1-活跃, 2-禁用"
}
UserAddress {
int id PK "地址ID"
int user_id FK "用户ID"
string province "省份"
string city "城市"
string district "区县"
string address "详细地址"
string postal_code "邮政编码"
string contact_name "联系人姓名"
string contact_phone "联系人电话"
boolean is_default "是否默认地址"
}
%% 技师模块
Technician ||--o{ TechnicianCertificate : "持有"
Technician ||--o{ TechnicianSkill : "掌握"
Technician ||--o{ Order : "服务"
Technician {
int id PK "技师ID"
string name "姓名"
string phone "手机号"
string avatar "头像"
string gender "性别"
string id_card "身份证号"
string qualification "资格证书"
int status "状态: 0-离线, 1-在线, 2-服务中"
datetime created_at "创建时间"
}
TechnicianCertificate {
int id PK "证书ID"
int technician_id FK "技师ID"
string cert_type "证书类型"
string cert_no "证书编号"
string cert_image "证书图片"
datetime issue_date "发证日期"
datetime expire_date "过期日期"
}
TechnicianSkill {
int id PK "技能ID"
int technician_id FK "技师ID"
string skill_name "技能名称"
int level "技能等级"
}
%% 订单模块
Order ||--o{ OrderService : "包含"
Order ||--o{ OrderEvaluation : "评价"
Order {
int id PK "订单ID"
int user_id FK "用户ID"
int technician_id FK "技师ID"
decimal total_amount "总金额"
int status "状态: 0-待确认, 1-已确认, 2-进行中, 3-已完成, 4-已取消"
datetime order_time "下单时间"
datetime appointment_time "预约时间"
string address "服务地址"
}
OrderService {
int id PK "订单服务ID"
int order_id FK "订单ID"
string service_name "服务名称"
decimal price "价格"
int quantity "数量"
}
OrderEvaluation {
int id PK "评价ID"
int order_id FK "订单ID"
int rating "评分"
string comment "评论"
datetime created_at "创建时间"
}
%% 钱包模块
Wallet ||--o{ WalletTransaction : "交易记录"
Wallet {
int id PK "钱包ID"
int user_id FK "用户ID"
decimal balance "余额"
int status "状态: 0-冻结, 1-正常"
datetime created_at "创建时间"
}
WalletTransaction {
int id PK "交易ID"
int wallet_id FK "钱包ID"
decimal amount "金额"
int type "类型: 1-充值, 2-消费, 3-提现, 4-退款"
string description "描述"
datetime transaction_date "交易日期"
}
%% 店铺模块
Shop ||--o{ ShopService : "提供"
Shop {
int id PK "店铺ID"
string name "名称"
string logo "Logo"
string address "地址"
string phone "电话"
int status "状态: 0-关闭, 1-营业"
datetime created_at "创建时间"
}
ShopService {
int id PK "服务ID"
int shop_id FK "店铺ID"
string service_name "服务名称"
decimal price "价格"
string description "描述"
int status "状态: 0-下架, 1-上架"
}
%% 租户模块
Tenant ||--o{ TenantConfig : "配置"
Tenant {
int id PK "租户ID"
string name "名称"
string code "编码"
int status "状态: 0-禁用, 1-启用"
datetime created_at "创建时间"
}
TenantConfig {
int id PK "配置ID"
int tenant_id FK "租户ID"
string config_key "配置键"
string config_value "配置值"
}