feat(xinhan): scaffold xinhan folder; add schema.md with SQL docs; plan for xinhan UI

This commit is contained in:
root
2026-04-04 06:04:47 +00:00
Unverified
parent c08afe33d9
commit 4e467f5e66
2 changed files with 53 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
已创建分支 feature/xinhan-branch。将在该分支中新增 xinhan 文件夹及对应数据库查询页面。
计划实现:
- 新建 xinhan 文件夹在仓库 root 下(/opt/Letters/xinhan
- 在 xinhan 下实现一个简易的查询页,结构仿照 ticket/certs 的查询页,字段:收件人、内容物、寄出日期、寄达地、寄达日期
- 新增一个查询前端页面 index.html/或者与现有页面整合的查询入口
- 写一个简单的前端,使用 Supabase 表 `xinhan` 进行查询
- 提交到分支,等待你的合并指示
请确认:需要我直接在 xinhan 下建立一个初始数据表模板和查询页面吗?如果需要,请选择数据字段类型偏好(例如文本、日期、文本长内容等),以及是否要创建初始 SQL 建表语句。
+43
View File
@@ -0,0 +1,43 @@
# Xinhan 数据表结构说明
本文档提供针对 xinhan 表的 SQL 创建语句与示例查询。注意:以下 SQL 仅用于创建结构;本任务仅生成 MD 文档,不执行 SQL。
## 数据字段与含义
- recipient: 收件人,为文本类型,必填
- content: 内容物,文本型,可包含多行描述
- sent_date: 寄出日期,时间戳(timestamptz/ TIMESTAMP),必填
- destination: 寄达地,文本
- arrival_date: 寄达日期,时间戳
## 建表 SQLPostgreSQLSupabase/ Postgres 兼容)
```sql
CREATE TABLE xinhan (
id SERIAL PRIMARY KEY,
recipient TEXT NOT NULL,
content TEXT,
sent_date TIMESTAMP WITHOUT TIME ZONE NOT NULL,
destination TEXT,
arrival_date TIMESTAMP WITHOUT TIME ZONE
);
-- 索引,提升按收件人、寄出日期/寄达日期的查询性能
CREATE INDEX IF NOT EXISTS idx_xinhan_recipient ON xinhan (recipient);
CREATE INDEX IF NOT EXISTS idx_xinhan_sent_date ON xinhan (sent_date);
CREATE INDEX IF NOT EXISTS idx_xinhan_arrival_date ON xinhan (arrival_date);
```
## 示例查询
```sql
-- 查询某个收件人相关信函的简单示例
SELECT * FROM xinhan
WHERE recipient ILIKE '%张三%'
ORDER BY sent_date DESC
LIMIT 100;
-- 根据日期范围查询示例
SELECT * FROM xinhan
WHERE sent_date BETWEEN '2024-01-01' AND '2026-12-31'
ORDER BY sent_date DESC;
```
> 说明:此文件仅用于记录数据库结构与查询示例,实际部署请在你的数据库实例中执行上述 SQL。