feat(fulfillment): 增加统一渠道配置搜索与筛选
This commit is contained in:
@@ -1098,6 +1098,8 @@ export async function assignChannelBySku(input: {
|
||||
|
||||
type ChannelRuleFilterInput = {
|
||||
channel?: string
|
||||
source?: string
|
||||
keyword?: string
|
||||
enabled?: boolean
|
||||
}
|
||||
|
||||
@@ -1108,6 +1110,20 @@ function buildChannelRuleFilter(input: ChannelRuleFilterInput) {
|
||||
params.push(input.channel)
|
||||
clauses.push(`channel = $${params.length}`)
|
||||
}
|
||||
const source = String(input.source || '').trim()
|
||||
if (source === 'rule') {
|
||||
clauses.push(`source LIKE 'rule:%'`)
|
||||
} else if (source) {
|
||||
params.push(source)
|
||||
clauses.push(`source = $${params.length}`)
|
||||
}
|
||||
const keyword = String(input.keyword || '').trim()
|
||||
if (keyword) {
|
||||
params.push(`%${keyword}%`)
|
||||
clauses.push(
|
||||
`(match_key ILIKE $${params.length} OR config_json::text ILIKE $${params.length} OR COALESCE(note, '') ILIKE $${params.length})`,
|
||||
)
|
||||
}
|
||||
if (typeof input.enabled === 'boolean') {
|
||||
params.push(input.enabled)
|
||||
clauses.push(`enabled = $${params.length}`)
|
||||
|
||||
Reference in New Issue
Block a user