From 4e467f5e66751ff8546e09a8bbd0e055f3bf71e8 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 4 Apr 2026 06:04:47 +0000 Subject: [PATCH 1/5] feat(xinhan): scaffold xinhan folder; add schema.md with SQL docs; plan for xinhan UI --- README_XINHAN_PLAN.txt | 10 ++++++++++ xinhan/schema.md | 43 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 README_XINHAN_PLAN.txt create mode 100644 xinhan/schema.md diff --git a/README_XINHAN_PLAN.txt b/README_XINHAN_PLAN.txt new file mode 100644 index 0000000..812d75a --- /dev/null +++ b/README_XINHAN_PLAN.txt @@ -0,0 +1,10 @@ +已创建分支 feature/xinhan-branch。将在该分支中新增 xinhan 文件夹及对应数据库查询页面。 + +计划实现: +- 新建 xinhan 文件夹在仓库 root 下(/opt/Letters/xinhan) +- 在 xinhan 下实现一个简易的查询页,结构仿照 ticket/certs 的查询页,字段:收件人、内容物、寄出日期、寄达地、寄达日期 +- 新增一个查询前端页面 index.html/或者与现有页面整合的查询入口 +- 写一个简单的前端,使用 Supabase 表 `xinhan` 进行查询 +- 提交到分支,等待你的合并指示 + +请确认:需要我直接在 xinhan 下建立一个初始数据表模板和查询页面吗?如果需要,请选择数据字段类型偏好(例如文本、日期、文本长内容等),以及是否要创建初始 SQL 建表语句。 \ No newline at end of file diff --git a/xinhan/schema.md b/xinhan/schema.md new file mode 100644 index 0000000..35871e5 --- /dev/null +++ b/xinhan/schema.md @@ -0,0 +1,43 @@ +# Xinhan 数据表结构说明 + +本文档提供针对 xinhan 表的 SQL 创建语句与示例查询。注意:以下 SQL 仅用于创建结构;本任务仅生成 MD 文档,不执行 SQL。 + +## 数据字段与含义 +- recipient: 收件人,为文本类型,必填 +- content: 内容物,文本型,可包含多行描述 +- sent_date: 寄出日期,时间戳(timestamptz/ TIMESTAMP),必填 +- destination: 寄达地,文本 +- arrival_date: 寄达日期,时间戳 + +## 建表 SQL(PostgreSQL,Supabase/ 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。 -- 2.47.3 From dc2449ad93c61d2f29c0d7c63bd6656b0b95e54f Mon Sep 17 00:00:00 2001 From: root Date: Sat, 4 Apr 2026 06:17:45 +0000 Subject: [PATCH 2/5] feat(xinhan): add frontend Xinhan query page at xinhan/index.html --- xinhan/index.html | 83 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 xinhan/index.html diff --git a/xinhan/index.html b/xinhan/index.html new file mode 100644 index 0000000..e31215b --- /dev/null +++ b/xinhan/index.html @@ -0,0 +1,83 @@ + + + + + + Xinhan 查询 + + + + +
+
+

Xinhan 查询

+
+
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+ + + + -- 2.47.3 From 8a8bc6b04dfd5639425febf8120f2050db9cabba Mon Sep 17 00:00:00 2001 From: root Date: Sat, 4 Apr 2026 06:50:32 +0000 Subject: [PATCH 3/5] feat(xinhan): enhance search with recipient filter --- xinhan/index.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/xinhan/index.html b/xinhan/index.html index e31215b..b5a3f17 100644 --- a/xinhan/index.html +++ b/xinhan/index.html @@ -24,9 +24,13 @@

Xinhan 查询

+
+
+ +

- +

@@ -48,21 +52,20 @@ const sb = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY); async function handleSearch(){ - const term = document.getElementById('searchTerm').value.trim(); + const recipientTerm = document.getElementById('recipientTerm').value.trim(); + const contentTerm = document.getElementById('searchTerm').value.trim(); const from = document.getElementById('dateFrom').value; const to = document.getElementById('dateTo').value; const out = document.getElementById('searchResults'); out.innerHTML = '
正在查询...
'; let q = sb.from('xinhan').select('*'); - if (term) q = q.or(`recipient.ilike.%${term}%,content.ilike.%${term}%`); + if (recipientTerm) q = q.ilike('recipient', `%${recipientTerm}%`); + if (contentTerm) q = q.ilike('content', `%${contentTerm}%`); if (from) q = q.gte('sent_date', from); if (to) q = q.lte('sent_date', to); const { data, error } = await q.order('sent_date', { ascending: false }); - if (error) { - out.innerHTML = `
查询失败:${error.message}
`; - return; - } + if (error){ out.innerHTML = `
查询失败:${error.message}
`; return; } renderResults(data || []); } -- 2.47.3 From 750d481be6a678c29b3f8c80e6bd1d1fa0c512b7 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 4 Apr 2026 06:55:41 +0000 Subject: [PATCH 4/5] feat(xinhan): refine responsive layout for mobile; adjust search terms to include recipient --- xinhan/index.html | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/xinhan/index.html b/xinhan/index.html index b5a3f17..012a171 100644 --- a/xinhan/index.html +++ b/xinhan/index.html @@ -6,17 +6,30 @@ Xinhan 查询 -- 2.47.3 From 687691cf85e23c7887cc31a3ad685acbe14d8019 Mon Sep 17 00:00:00 2001 From: biss Date: Sat, 4 Apr 2026 15:01:54 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README_XINHAN_PLAN.txt | 10 ---------- xinhan/index.html | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) delete mode 100644 README_XINHAN_PLAN.txt diff --git a/README_XINHAN_PLAN.txt b/README_XINHAN_PLAN.txt deleted file mode 100644 index 812d75a..0000000 --- a/README_XINHAN_PLAN.txt +++ /dev/null @@ -1,10 +0,0 @@ -已创建分支 feature/xinhan-branch。将在该分支中新增 xinhan 文件夹及对应数据库查询页面。 - -计划实现: -- 新建 xinhan 文件夹在仓库 root 下(/opt/Letters/xinhan) -- 在 xinhan 下实现一个简易的查询页,结构仿照 ticket/certs 的查询页,字段:收件人、内容物、寄出日期、寄达地、寄达日期 -- 新增一个查询前端页面 index.html/或者与现有页面整合的查询入口 -- 写一个简单的前端,使用 Supabase 表 `xinhan` 进行查询 -- 提交到分支,等待你的合并指示 - -请确认:需要我直接在 xinhan 下建立一个初始数据表模板和查询页面吗?如果需要,请选择数据字段类型偏好(例如文本、日期、文本长内容等),以及是否要创建初始 SQL 建表语句。 \ No newline at end of file diff --git a/xinhan/index.html b/xinhan/index.html index 012a171..d537ff2 100644 --- a/xinhan/index.html +++ b/xinhan/index.html @@ -3,7 +3,7 @@ - Xinhan 查询 + 信函查询