init: 初始化 dpb 桃育种系统代码库

前后端 + 后端 FastAPI 全量源码、部署脚本与文档。
This commit is contained in:
34047007@qq.com
2026-08-06 00:17:49 +08:00
commit b95053c52c
1469 changed files with 322298 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
/**
* 清理查询参数中的空数组字段,避免将 [] 传给后端
*
* @example
* ```ts
* const query = cleanEmptyArrayParams(searchParams, ["created_time", "updated_time"]);
* // { created_time: [], ... } → { created_time: undefined, ... }
* ```
*/
export function cleanEmptyArrayParams<T extends Record<string, unknown>>(
params: T,
arrayKeys: string[] = ["created_time", "updated_time"]
): T {
const p = { ...params } as Record<string, unknown>;
for (const key of arrayKeys) {
if (Array.isArray(p[key]) && (p[key] as unknown[]).length === 0) {
p[key] = undefined;
}
}
return p as T;
}
/**
* 从搜索参数中移除分页字段,生成导出查询参数
*/
export function stripPaginationParams<T extends Record<string, unknown>>(
params: T,
pagKeys: string[] = ["current", "size", "page_no", "page_size"]
): Record<string, unknown> {
const p = { ...(params as object) } as Record<string, unknown>;
for (const key of pagKeys) {
delete p[key];
}
return p;
}