feat(admin): complete integration of auth, delivery, and system infrastructure modules
This commit is contained in:
51
docs/sql/10_schema/delivery/ak_delivery_system_v1.sql
Normal file
51
docs/sql/10_schema/delivery/ak_delivery_system_v1.sql
Normal file
@@ -0,0 +1,51 @@
|
||||
-- =====================================================================================
|
||||
-- Schema: 物流设置 (Delivery) 核心表
|
||||
-- 位置:docs/sql/10_schema/delivery/ak_delivery_system_v1.sql
|
||||
-- 对象类型:TABLE
|
||||
-- 版本:v1
|
||||
-- 说明:包含配送员管理表、提货点/核销点管理表
|
||||
-- =====================================================================================
|
||||
|
||||
-- 1. 配送员管理表
|
||||
CREATE TABLE IF NOT EXISTS public.ml_delivery_staff (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
uid UUID REFERENCES public.ak_users(id) ON DELETE SET NULL, -- 关联用户(可选)
|
||||
|
||||
nickname TEXT NOT NULL, -- 配送员名称
|
||||
avatar TEXT, -- 头像
|
||||
phone TEXT NOT NULL, -- 手机号
|
||||
|
||||
status SMALLINT NOT NULL DEFAULT 1, -- 状态: 1-启用, 0-禁用
|
||||
is_active BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- 2. 提货点/核销点管理表
|
||||
CREATE TABLE IF NOT EXISTS public.ml_delivery_stations (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
name TEXT NOT NULL, -- 提货点名称
|
||||
phone TEXT NOT NULL, -- 联系电话
|
||||
address TEXT NOT NULL, -- 详细地址
|
||||
|
||||
image TEXT, -- 门店图片
|
||||
lng NUMERIC(10,7), -- 经度
|
||||
lat NUMERIC(10,7), -- 纬度
|
||||
|
||||
status SMALLINT NOT NULL DEFAULT 1, -- 状态: 1-显示, 0-隐藏
|
||||
sort_order INTEGER DEFAULT 0,
|
||||
|
||||
business_hours JSONB, -- 营业时间 (如: {"start": "09:00", "end": "21:00"})
|
||||
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- 索引
|
||||
CREATE INDEX IF NOT EXISTS idx_delivery_staff_phone ON public.ml_delivery_staff(phone);
|
||||
CREATE INDEX IF NOT EXISTS idx_delivery_stations_status ON public.ml_delivery_stations(status);
|
||||
|
||||
-- 注释
|
||||
COMMENT ON TABLE public.ml_delivery_staff IS '配送员信息表';
|
||||
COMMENT ON TABLE public.ml_delivery_stations IS '提货点/核销点信息表';
|
||||
Reference in New Issue
Block a user