Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
dealaccountdata
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 64390e20
authored
May 15, 2026
by
林冲
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
脚本2 for new_code in new_codes:
1 parent
2b9f5c00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
scene_refactor_data/merchant_goods_code_processor.py
scene_refactor_data/merchant_goods_code_processor.py
View file @
64390e2
...
@@ -732,12 +732,14 @@ class MerchantGoodsCodeProcessor:
...
@@ -732,12 +732,14 @@ class MerchantGoodsCodeProcessor:
return
return
# 批量查询原记录数据(使用 id IN)
# 批量查询原记录数据(使用 id IN)
# 构建 relation_id 到 merchant_goods_code
的映射
# 构建 relation_id 到 merchant_goods_code
列表的映射(一个 relation_id 可能对应多个 merchant_goods_code)
id_to_code
=
{}
id_to_code
s
=
{}
for
relation_id
,
rule_type
,
goods_type_group_rule_id
,
merchant_goods_code
in
filtered_inserts
:
for
relation_id
,
rule_type
,
goods_type_group_rule_id
,
merchant_goods_code
in
filtered_inserts
:
id_to_code
[
relation_id
]
=
merchant_goods_code
if
relation_id
not
in
id_to_codes
:
id_to_codes
[
relation_id
]
=
[]
id_to_codes
[
relation_id
]
.
append
(
merchant_goods_code
)
relation_ids
=
list
(
id_to_code
.
keys
())
relation_ids
=
list
(
id_to_code
s
.
keys
())
# 分批查询,每次500条
# 分批查询,每次500条
batch_size
=
500
batch_size
=
500
...
@@ -761,10 +763,11 @@ class MerchantGoodsCodeProcessor:
...
@@ -761,10 +763,11 @@ class MerchantGoodsCodeProcessor:
original_id
,
rule_type
,
goods_type_group_rule_id
,
category_type
,
upgrade_goods_id
,
\
original_id
,
rule_type
,
goods_type_group_rule_id
,
category_type
,
upgrade_goods_id
,
\
goods_type
,
goods_type_name
,
package_code
,
package_name
,
deleted_flag
=
record
goods_type
,
goods_type_name
,
package_code
,
package_name
,
deleted_flag
=
record
# 获取对应的
新 merchant_goods_code
# 获取对应的
所有 merchant_goods_code(一个 relation_id 可能对应多个)
new_code
=
id_to_code
.
get
(
original_id
)
new_code
s
=
id_to_codes
.
get
(
original_id
,
[]
)
if
new_code
:
# 为每个 merchant_goods_code 生成一条插入记录
for
new_code
in
new_codes
:
values_parts
.
append
(
f
"""(
values_parts
.
append
(
f
"""(
{rule_type}, {goods_type_group_rule_id}, {category_type}, {upgrade_goods_id},
{rule_type}, {goods_type_group_rule_id}, {category_type}, {upgrade_goods_id},
'{new_code}', {goods_type if goods_type else 'NULL'},
'{new_code}', {goods_type if goods_type else 'NULL'},
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment