增强工单游戏资料搜索
This commit is contained in:
@@ -65,6 +65,23 @@ type WorkOrderStatisticsRow = {
|
||||
refund_amount: number | string
|
||||
}
|
||||
|
||||
/** 工单统一搜索字段,兼容当前资料结构和历史资料字段。 */
|
||||
function workOrderSearchExpression(alias = 'wo') {
|
||||
return `LOWER(
|
||||
COALESCE(${alias}.work_order_no, '') || ' ' ||
|
||||
COALESCE(${alias}.platform_order_id, '') || ' ' ||
|
||||
COALESCE(${alias}.product_name, '') || ' ' ||
|
||||
COALESCE(${alias}.material_json->'collect'->'fields'->>'gameId', '') || ' ' ||
|
||||
COALESCE(${alias}.material_json->'collect'->'fields'->>'gameNickname', '') || ' ' ||
|
||||
COALESCE(${alias}.material_json->'collect'->'fields'->>'gameAccount', '') || ' ' ||
|
||||
COALESCE(${alias}.material_json->'collect'->'fields'->>'roleName', '') || ' ' ||
|
||||
COALESCE(${alias}.material_json->'fields'->>'gameId', '') || ' ' ||
|
||||
COALESCE(${alias}.material_json->'fields'->>'gameNickname', '') || ' ' ||
|
||||
COALESCE(${alias}.material_json->>'gameId', '') || ' ' ||
|
||||
COALESCE(${alias}.material_json->>'gameNickname', '')
|
||||
)`
|
||||
}
|
||||
|
||||
export async function listWorkOrderShares(
|
||||
workOrderId: number | string,
|
||||
): Promise<WorkOrderShareRow[]> {
|
||||
@@ -2821,9 +2838,7 @@ function buildWorkOrderWhere({
|
||||
}
|
||||
if (keyword) {
|
||||
params.push(`%${keyword}%`)
|
||||
filters.push(
|
||||
`(wo.work_order_no ILIKE $${params.length} OR wo.platform_order_id ILIKE $${params.length} OR wo.product_name ILIKE $${params.length})`,
|
||||
)
|
||||
filters.push(`${workOrderSearchExpression()} LIKE LOWER($${params.length})`)
|
||||
}
|
||||
if (workerId) {
|
||||
params.push(workerId)
|
||||
|
||||
Reference in New Issue
Block a user