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 5e07ad06
authored
May 16, 2026
by
林冲
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
第六步设置deleteflag
1 parent
8dee3200
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
scene_refactor_data/scene_split_processor.py
scene_refactor_data/scene_split_processor.py
View file @
5e07ad0
...
@@ -71,7 +71,7 @@ class SceneSplitProcessor:
...
@@ -71,7 +71,7 @@ class SceneSplitProcessor:
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
updated_date = NOW()
WHERE
WHERE
scene_type = {scene_type}
scene_type = {scene_type}
and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
"""
if
self
.
db
.
execute_update
(
update_sql
):
if
self
.
db
.
execute_update
(
update_sql
):
...
@@ -99,7 +99,7 @@ class SceneSplitProcessor:
...
@@ -99,7 +99,7 @@ class SceneSplitProcessor:
SELECT id, source, merchant_id, scene_type, enable_flag, submit_flag,
SELECT id, source, merchant_id, scene_type, enable_flag, submit_flag,
created_by, created_date, updated_by, updated_date, deleted_flag
created_by, created_date, updated_by, updated_date, deleted_flag
FROM {table_name}
FROM {table_name}
WHERE scene_type = 0 AND (base_scene_code IS NULL OR base_scene_code = '');
WHERE scene_type = 0 AND (base_scene_code IS NULL OR base_scene_code = '')
and merchant_id = 44210895
;
"""
"""
records
=
self
.
db
.
execute_query
(
query_sql
)
records
=
self
.
db
.
execute_query
(
query_sql
)
self
.
logger
.
info
(
f
" 找到 {len(records)} 条需要拆分的记录"
)
self
.
logger
.
info
(
f
" 找到 {len(records)} 条需要拆分的记录"
)
...
@@ -124,7 +124,7 @@ class SceneSplitProcessor:
...
@@ -124,7 +124,7 @@ class SceneSplitProcessor:
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
updated_date = NOW()
WHERE
WHERE
scene_type = 0
scene_type = 0
and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
"""
self
.
logger
.
info
(
f
" 执行更新SQL: {update_sql.strip()}"
)
self
.
logger
.
info
(
f
" 执行更新SQL: {update_sql.strip()}"
)
...
@@ -259,7 +259,7 @@ class SceneSplitProcessor:
...
@@ -259,7 +259,7 @@ class SceneSplitProcessor:
SET base_scene_code = '{base_scene_code}',
SET base_scene_code = '{base_scene_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
updated_date = NOW()
WHERE scene_type = {scene_type}
WHERE scene_type = {scene_type}
and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
"""
if
self
.
db
.
execute_update
(
update_sql
):
if
self
.
db
.
execute_update
(
update_sql
):
...
@@ -293,7 +293,7 @@ class SceneSplitProcessor:
...
@@ -293,7 +293,7 @@ class SceneSplitProcessor:
reality_shop_merchant_id, reality_shop_merchant_name, reality_shop_user_type, reality_shop_level,
reality_shop_merchant_id, reality_shop_merchant_name, reality_shop_user_type, reality_shop_level,
rule_audit_id, created_by, created_date, updated_by, updated_date, deleted_flag
rule_audit_id, created_by, created_date, updated_by, updated_date, deleted_flag
FROM {table_name}
FROM {table_name}
WHERE scene_type = 0
WHERE scene_type = 0
and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
"""
records
=
self
.
db
.
execute_query
(
query_sql
)
records
=
self
.
db
.
execute_query
(
query_sql
)
...
@@ -318,7 +318,7 @@ class SceneSplitProcessor:
...
@@ -318,7 +318,7 @@ class SceneSplitProcessor:
SET base_scene_code = '{first_code}',
SET base_scene_code = '{first_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
updated_date = NOW()
WHERE scene_type = 0
WHERE scene_type = 0
and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
"""
if
self
.
db
.
execute_update
(
update_sql
):
if
self
.
db
.
execute_update
(
update_sql
):
...
@@ -1017,7 +1017,7 @@ class SceneSplitProcessor:
...
@@ -1017,7 +1017,7 @@ class SceneSplitProcessor:
SELECT id, rule_type, goods_type_group_rule_id, expense_category_id, expense_category_name,
SELECT id, rule_type, goods_type_group_rule_id, expense_category_id, expense_category_name,
parent_expense_category_id, parent_expense_category_name, target_type, node_type,
parent_expense_category_id, parent_expense_category_name, target_type, node_type,
parent_id, category_to_sort, calculate_mode, expense_category_calculate_type,
parent_id, category_to_sort, calculate_mode, expense_category_calculate_type,
expense_category_value, target_merchant_id, target_merchant_name
expense_category_value, target_merchant_id, target_merchant_name
, deleted_flag
FROM {table_name}
FROM {table_name}
WHERE rule_type = 1
WHERE rule_type = 1
AND goods_type_group_rule_id = {old_goods_type_group_rule_id};
AND goods_type_group_rule_id = {old_goods_type_group_rule_id};
...
@@ -1040,6 +1040,7 @@ class SceneSplitProcessor:
...
@@ -1040,6 +1040,7 @@ class SceneSplitProcessor:
expense_category_value
=
record
[
13
]
if
record
[
13
]
is
not
None
else
'NULL'
expense_category_value
=
record
[
13
]
if
record
[
13
]
is
not
None
else
'NULL'
target_merchant_id
=
record
[
14
]
if
record
[
14
]
is
not
None
else
'NULL'
target_merchant_id
=
record
[
14
]
if
record
[
14
]
is
not
None
else
'NULL'
target_merchant_name
=
f
"'{record[15]}'"
if
record
[
15
]
is
not
None
else
'NULL'
target_merchant_name
=
f
"'{record[15]}'"
if
record
[
15
]
is
not
None
else
'NULL'
deleted_flag
=
record
[
16
]
if
record
[
16
]
is
not
None
else
'N'
insert_batch
.
append
({
insert_batch
.
append
({
'old_id'
:
old_id
,
'old_id'
:
old_id
,
...
@@ -1058,6 +1059,7 @@ class SceneSplitProcessor:
...
@@ -1058,6 +1059,7 @@ class SceneSplitProcessor:
'expense_category_value'
:
expense_category_value
,
'expense_category_value'
:
expense_category_value
,
'target_merchant_id'
:
target_merchant_id
,
'target_merchant_id'
:
target_merchant_id
,
'target_merchant_name'
:
target_merchant_name
,
'target_merchant_name'
:
target_merchant_name
,
'deleted_flag'
:
deleted_flag
,
'base_scene_code'
:
base_scene_code
,
'base_scene_code'
:
base_scene_code
,
'merchant_id'
:
merchant_id
'merchant_id'
:
merchant_id
})
})
...
@@ -1088,7 +1090,7 @@ class SceneSplitProcessor:
...
@@ -1088,7 +1090,7 @@ class SceneSplitProcessor:
f
"{item['category_to_sort']}, {item['calculate_mode']}, "
f
"{item['category_to_sort']}, {item['calculate_mode']}, "
f
"{item['expense_category_calculate_type']}, {item['expense_category_value']}, "
f
"{item['expense_category_calculate_type']}, {item['expense_category_value']}, "
f
"{item['target_merchant_id']}, {item['target_merchant_name']}, "
f
"{item['target_merchant_id']}, {item['target_merchant_name']}, "
f
"'{DATA_MIGRATION_USER}', NOW(), '{DATA_MIGRATION_USER}', NOW(), '
N
')"
f
"'{DATA_MIGRATION_USER}', NOW(), '{DATA_MIGRATION_USER}', NOW(), '
{item['deleted_flag']}
')"
)
)
insert_sql
=
f
"""
insert_sql
=
f
"""
...
@@ -1528,7 +1530,7 @@ class SceneSplitProcessor:
...
@@ -1528,7 +1530,7 @@ class SceneSplitProcessor:
SET base_scene_code = '{base_scene_code}',
SET base_scene_code = '{base_scene_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
updated_date = NOW()
WHERE scene_type = {scene_type}
WHERE scene_type = {scene_type}
and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
"""
if
self
.
db
.
execute_update
(
update_sql
):
if
self
.
db
.
execute_update
(
update_sql
):
...
@@ -1560,7 +1562,7 @@ class SceneSplitProcessor:
...
@@ -1560,7 +1562,7 @@ class SceneSplitProcessor:
partner_merchant_total_fee_calculate_type, partner_merchant_expense_category_value,
partner_merchant_total_fee_calculate_type, partner_merchant_expense_category_value,
enable_flag, submit_flag, created_by, created_date, updated_by, updated_date, deleted_flag
enable_flag, submit_flag, created_by, created_date, updated_by, updated_date, deleted_flag
FROM {table_name}
FROM {table_name}
WHERE scene_type = 0
WHERE scene_type = 0
and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
"""
records
=
self
.
db
.
execute_query
(
query_sql
)
records
=
self
.
db
.
execute_query
(
query_sql
)
...
@@ -1585,7 +1587,7 @@ class SceneSplitProcessor:
...
@@ -1585,7 +1587,7 @@ class SceneSplitProcessor:
SET base_scene_code = '{first_code}',
SET base_scene_code = '{first_code}',
updated_by = '{DATA_MIGRATION_USER}',
updated_by = '{DATA_MIGRATION_USER}',
updated_date = NOW()
updated_date = NOW()
WHERE scene_type = 0
WHERE scene_type = 0
and merchant_id = 44210895
AND (base_scene_code IS NULL OR base_scene_code = '');
AND (base_scene_code IS NULL OR base_scene_code = '');
"""
"""
if
self
.
db
.
execute_update
(
update_sql
):
if
self
.
db
.
execute_update
(
update_sql
):
...
...
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