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 91986133
authored
May 16, 2026
by
林冲
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
DATA_MIGRATION2
1 parent
64390e20
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
scene_refactor_data/main_merchant_goods_code.py
scene_refactor_data/merchant_goods_code_processor.py
scene_refactor_data/scene_type_mapping.py
scene_refactor_data/main_merchant_goods_code.py
View file @
9198613
...
@@ -155,7 +155,7 @@ merchant_goods_code 补齐程序使用说明
...
@@ -155,7 +155,7 @@ merchant_goods_code 补齐程序使用说明
- 匹配到1个 merchant_goods_code:更新原记录
- 匹配到1个 merchant_goods_code:更新原记录
- 匹配到多个 merchant_goods_code:原记录更新第一个,其余复制插入新记录
- 匹配到多个 merchant_goods_code:原记录更新第一个,其余复制插入新记录
- 复制插入前检查是否已存在相同记录,避免重复
- 复制插入前检查是否已存在相同记录,避免重复
- 所有新记录标记 created_by='DATA_MIGRATION'
- 所有新记录标记 created_by='DATA_MIGRATION
2', updated_by='DATA_MIGRATION2
'
临时表说明:
临时表说明:
- tmp_goods_relation_context: 规则上下文表,记录每条关系的规则链路信息
- tmp_goods_relation_context: 规则上下文表,记录每条关系的规则链路信息
...
...
scene_refactor_data/merchant_goods_code_processor.py
View file @
9198613
...
@@ -7,7 +7,7 @@ merchant_goods_code 补齐处理器
...
@@ -7,7 +7,7 @@ merchant_goods_code 补齐处理器
import
logging
import
logging
from
datetime
import
datetime
from
datetime
import
datetime
from
scene_type_mapping
import
DATA_MIGRATION_USER
from
scene_type_mapping
import
DATA_MIGRATION_USER
,
DATA_MIGRATION_USER2
class
MerchantGoodsCodeProcessor
:
class
MerchantGoodsCodeProcessor
:
...
@@ -582,7 +582,7 @@ class MerchantGoodsCodeProcessor:
...
@@ -582,7 +582,7 @@ class MerchantGoodsCodeProcessor:
update_sql
=
f
"""
update_sql
=
f
"""
UPDATE dj_car_life_goods_type_group_relation
UPDATE dj_car_life_goods_type_group_relation
SET merchant_goods_code = '{merchant_goods_code}',
SET merchant_goods_code = '{merchant_goods_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER
2
}',
updated_date = NOW()
updated_date = NOW()
WHERE id = {relation_id};
WHERE id = {relation_id};
"""
"""
...
@@ -618,7 +618,7 @@ class MerchantGoodsCodeProcessor:
...
@@ -618,7 +618,7 @@ class MerchantGoodsCodeProcessor:
rule_type, goods_type_group_rule_id, category_type, upgrade_goods_id,
rule_type, goods_type_group_rule_id, category_type, upgrade_goods_id,
'{merchant_goods_code}' AS merchant_goods_code,
'{merchant_goods_code}' AS merchant_goods_code,
goods_type, goods_type_name, package_code, package_name,
goods_type, goods_type_name, package_code, package_name,
deleted_flag, '{DATA_MIGRATION_USER
}', NOW(), '{DATA_MIGRATION_USER
}', NOW()
deleted_flag, '{DATA_MIGRATION_USER
2}', NOW(), '{DATA_MIGRATION_USER2
}', NOW()
FROM dj_car_life_goods_type_group_relation
FROM dj_car_life_goods_type_group_relation
WHERE id = {relation_id};
WHERE id = {relation_id};
"""
"""
...
@@ -684,7 +684,7 @@ class MerchantGoodsCodeProcessor:
...
@@ -684,7 +684,7 @@ class MerchantGoodsCodeProcessor:
update_sql
=
f
"""
update_sql
=
f
"""
UPDATE dj_car_life_goods_type_group_relation
UPDATE dj_car_life_goods_type_group_relation
SET merchant_goods_code = CASE id {case_when_clause} END,
SET merchant_goods_code = CASE id {case_when_clause} END,
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER
2
}',
updated_date = NOW()
updated_date = NOW()
WHERE id IN ({ids_clause});
WHERE id IN ({ids_clause});
"""
"""
...
@@ -774,7 +774,7 @@ class MerchantGoodsCodeProcessor:
...
@@ -774,7 +774,7 @@ class MerchantGoodsCodeProcessor:
{f"'{goods_type_name}'" if goods_type_name else 'NULL'},
{f"'{goods_type_name}'" if goods_type_name else 'NULL'},
{f"'{package_code}'" if package_code else 'NULL'},
{f"'{package_code}'" if package_code else 'NULL'},
{f"'{package_name}'" if package_name else 'NULL'},
{f"'{package_name}'" if package_name else 'NULL'},
'{deleted_flag}', '{DATA_MIGRATION_USER
}', NOW(), '{DATA_MIGRATION_USER
}', NOW()
'{deleted_flag}', '{DATA_MIGRATION_USER
2}', NOW(), '{DATA_MIGRATION_USER2
}', NOW()
)"""
)
)"""
)
if
values_parts
:
if
values_parts
:
...
...
scene_refactor_data/scene_type_mapping.py
View file @
9198613
...
@@ -25,6 +25,7 @@ SCENE_TYPE_0_SPLIT = [
...
@@ -25,6 +25,7 @@ SCENE_TYPE_0_SPLIT = [
# 数据迁移标识
# 数据迁移标识
DATA_MIGRATION_USER
=
'DATA_MIGRATION'
DATA_MIGRATION_USER
=
'DATA_MIGRATION'
DATA_MIGRATION_USER2
=
'DATA_MIGRATION2'
def
get_base_scene_code
(
scene_type
):
def
get_base_scene_code
(
scene_type
):
"""
"""
...
...
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