|
@@ -1702,9 +1702,9 @@ def search_member():
|
|
|
LIMIT 1) AS father_simplified_name,
|
|
LIMIT 1) AS father_simplified_name,
|
|
|
-- 出继标注:同时有 sub_type=2(亲生方)和 sub_type=3(养家方)时生成
|
|
-- 出继标注:同时有 sub_type=2(亲生方)和 sub_type=3(养家方)时生成
|
|
|
(SELECT CONCAT(
|
|
(SELECT CONCAT(
|
|
|
- '由',
|
|
|
|
|
|
|
+ '出继自',
|
|
|
COALESCE(pbio.simplified_name, pbio.name, '?'),
|
|
COALESCE(pbio.simplified_name, pbio.name, '?'),
|
|
|
- '出继给',
|
|
|
|
|
|
|
+ ',入继至',
|
|
|
COALESCE(padopt.simplified_name, padopt.name, '?'))
|
|
COALESCE(padopt.simplified_name, padopt.name, '?'))
|
|
|
FROM family_relation_info rbio
|
|
FROM family_relation_info rbio
|
|
|
JOIN family_member_info pbio ON rbio.parent_mid = pbio.id
|
|
JOIN family_member_info pbio ON rbio.parent_mid = pbio.id
|
|
@@ -1824,10 +1824,10 @@ def get_lineage(member_id):
|
|
|
else:
|
|
else:
|
|
|
# 香火传承(默认):入继养父优先
|
|
# 香火传承(默认):入继养父优先
|
|
|
parent = adoptive_parent or normal_parent or bio_parent
|
|
parent = adoptive_parent or normal_parent or bio_parent
|
|
|
- # 若走入继路径,在当事人卡片标注"从xx出继"
|
|
|
|
|
|
|
+ # 若走入继路径,在当事人卡片标注"出继自xx"
|
|
|
if parent is adoptive_parent and adoptive_parent is not None:
|
|
if parent is adoptive_parent and adoptive_parent is not None:
|
|
|
bio_name = (bio_parent.get('simplified_name') or bio_parent.get('name')) if bio_parent else None
|
|
bio_name = (bio_parent.get('simplified_name') or bio_parent.get('name')) if bio_parent else None
|
|
|
- adopt_label = f"从{bio_name}出继" if bio_name else "出继"
|
|
|
|
|
|
|
+ adopt_label = f"出继自{bio_name}" if bio_name else "出继"
|
|
|
if depth == 0:
|
|
if depth == 0:
|
|
|
center['adoption_label'] = adopt_label
|
|
center['adoption_label'] = adopt_label
|
|
|
elif generations:
|
|
elif generations:
|
|
@@ -1881,7 +1881,7 @@ def get_lineage(member_id):
|
|
|
LIMIT 30
|
|
LIMIT 30
|
|
|
""", (grandparent['id'], parent['id']))
|
|
""", (grandparent['id'], parent['id']))
|
|
|
parent_siblings = cursor.fetchall()
|
|
parent_siblings = cursor.fetchall()
|
|
|
- # 为入继兄弟补充"从xx出继"标注
|
|
|
|
|
|
|
+ # 为入继兄弟补充"出继自xx"标注
|
|
|
for sib in parent_siblings:
|
|
for sib in parent_siblings:
|
|
|
if sib.get('sub_relation_type') == 3:
|
|
if sib.get('sub_relation_type') == 3:
|
|
|
cursor.execute("""
|
|
cursor.execute("""
|
|
@@ -1892,7 +1892,7 @@ def get_lineage(member_id):
|
|
|
""", (sib['id'],))
|
|
""", (sib['id'],))
|
|
|
sbp = cursor.fetchone()
|
|
sbp = cursor.fetchone()
|
|
|
sib['adoption_label'] = (
|
|
sib['adoption_label'] = (
|
|
|
- f"从{sbp['simplified_name'] or sbp['name']}出继" if sbp else "出继"
|
|
|
|
|
|
|
+ f"出继自{sbp['simplified_name'] or sbp['name']}" if sbp else "出继"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
# Mark sibling IDs as displayed
|
|
# Mark sibling IDs as displayed
|
|
@@ -1958,7 +1958,7 @@ def get_lineage(member_id):
|
|
|
""", (member_id,))
|
|
""", (member_id,))
|
|
|
children = cursor.fetchall()
|
|
children = cursor.fetchall()
|
|
|
|
|
|
|
|
- # 香火模式:对入继子女标注"从xx出继";血脉模式:对出继子女标注"出继至xx"
|
|
|
|
|
|
|
+ # 香火模式:对入继子女标注"出继自xx";血脉模式:对出继子女标注"入继至xx"
|
|
|
for child in children:
|
|
for child in children:
|
|
|
if mode == 'incense' and child['sub_relation_type'] == 3:
|
|
if mode == 'incense' and child['sub_relation_type'] == 3:
|
|
|
cursor.execute("""
|
|
cursor.execute("""
|
|
@@ -1969,7 +1969,7 @@ def get_lineage(member_id):
|
|
|
""", (child['id'],))
|
|
""", (child['id'],))
|
|
|
bio_p = cursor.fetchone()
|
|
bio_p = cursor.fetchone()
|
|
|
child['adoption_label'] = (
|
|
child['adoption_label'] = (
|
|
|
- f"从{bio_p['simplified_name'] or bio_p['name']}出继" if bio_p else "出继"
|
|
|
|
|
|
|
+ f"出继自{bio_p['simplified_name'] or bio_p['name']}" if bio_p else "出继"
|
|
|
)
|
|
)
|
|
|
elif mode == 'blood' and child['sub_relation_type'] == 2:
|
|
elif mode == 'blood' and child['sub_relation_type'] == 2:
|
|
|
# 血脉模式下标注出继子女的去向(养父)
|
|
# 血脉模式下标注出继子女的去向(养父)
|
|
@@ -1981,7 +1981,7 @@ def get_lineage(member_id):
|
|
|
""", (child['id'],))
|
|
""", (child['id'],))
|
|
|
adop_p = cursor.fetchone()
|
|
adop_p = cursor.fetchone()
|
|
|
if adop_p:
|
|
if adop_p:
|
|
|
- child['adoption_label'] = f"出继至{adop_p['simplified_name'] or adop_p['name']}"
|
|
|
|
|
|
|
+ child['adoption_label'] = f"入继至{adop_p['simplified_name'] or adop_p['name']}"
|
|
|
child['sub_relation_type'] = 2 # 保持供前端显示 adopted-out 样式
|
|
child['sub_relation_type'] = 2 # 保持供前端显示 adopted-out 样式
|
|
|
|
|
|
|
|
# Initialize children array
|
|
# Initialize children array
|
|
@@ -2017,7 +2017,7 @@ def get_lineage(member_id):
|
|
|
LIMIT 30
|
|
LIMIT 30
|
|
|
""", (parent_id, member_id))
|
|
""", (parent_id, member_id))
|
|
|
siblings = cursor.fetchall()
|
|
siblings = cursor.fetchall()
|
|
|
- # 为入继兄弟补充"从xx出继"标注
|
|
|
|
|
|
|
+ # 为入继兄弟补充"出继自xx"标注
|
|
|
for sib in siblings:
|
|
for sib in siblings:
|
|
|
if sib.get('sub_relation_type') == 3:
|
|
if sib.get('sub_relation_type') == 3:
|
|
|
cursor.execute("""
|
|
cursor.execute("""
|
|
@@ -2028,7 +2028,7 @@ def get_lineage(member_id):
|
|
|
""", (sib['id'],))
|
|
""", (sib['id'],))
|
|
|
sbp = cursor.fetchone()
|
|
sbp = cursor.fetchone()
|
|
|
if sbp:
|
|
if sbp:
|
|
|
- sib['adoption_label'] = f"从{sbp['simplified_name'] or sbp['name']}出继"
|
|
|
|
|
|
|
+ sib['adoption_label'] = f"出继自{sbp['simplified_name'] or sbp['name']}"
|
|
|
else:
|
|
else:
|
|
|
sib['adoption_label'] = "出继"
|
|
sib['adoption_label'] = "出继"
|
|
|
print(f"[Lineage Query] Step 4 - Get siblings ({len(siblings)}): {time.time() - step_start:.3f}s")
|
|
print(f"[Lineage Query] Step 4 - Get siblings ({len(siblings)}): {time.time() - step_start:.3f}s")
|
|
@@ -2099,7 +2099,7 @@ def get_ancestors_above(ancestor_id):
|
|
|
anchor_bio = ap
|
|
anchor_bio = ap
|
|
|
if has_adoptive and anchor_bio:
|
|
if has_adoptive and anchor_bio:
|
|
|
bio_name = anchor_bio.get('simplified_name') or anchor_bio.get('name')
|
|
bio_name = anchor_bio.get('simplified_name') or anchor_bio.get('name')
|
|
|
- anchor_adoption_label = f"从{bio_name}出继" if bio_name else "出继"
|
|
|
|
|
|
|
+ anchor_adoption_label = f"出继自{bio_name}" if bio_name else "出继"
|
|
|
|
|
|
|
|
for depth in range(max_depth):
|
|
for depth in range(max_depth):
|
|
|
cursor.execute("""
|
|
cursor.execute("""
|
|
@@ -2131,10 +2131,10 @@ def get_ancestors_above(ancestor_id):
|
|
|
parent = normal_parent or bio_parent or adoptive_parent
|
|
parent = normal_parent or bio_parent or adoptive_parent
|
|
|
else:
|
|
else:
|
|
|
parent = adoptive_parent or normal_parent or bio_parent
|
|
parent = adoptive_parent or normal_parent or bio_parent
|
|
|
- # 若走入继路径,在 current_id 对应的人物上标注"从xx出继"
|
|
|
|
|
|
|
+ # 若走入继路径,在 current_id 对应的人物上标注"出继自xx"
|
|
|
if parent is adoptive_parent and adoptive_parent is not None:
|
|
if parent is adoptive_parent and adoptive_parent is not None:
|
|
|
bio_name = (bio_parent.get('simplified_name') or bio_parent.get('name')) if bio_parent else None
|
|
bio_name = (bio_parent.get('simplified_name') or bio_parent.get('name')) if bio_parent else None
|
|
|
- adopt_label = f"从{bio_name}出继" if bio_name else "出继"
|
|
|
|
|
|
|
+ adopt_label = f"出继自{bio_name}" if bio_name else "出继"
|
|
|
if depth == 0:
|
|
if depth == 0:
|
|
|
anchor_adoption_label = adopt_label
|
|
anchor_adoption_label = adopt_label
|
|
|
elif generations:
|
|
elif generations:
|
|
@@ -6073,7 +6073,7 @@ def api_get_lineage(member_id):
|
|
|
parent = adoptive_parent or normal_parent or bio_parent
|
|
parent = adoptive_parent or normal_parent or bio_parent
|
|
|
if parent is adoptive_parent and adoptive_parent is not None:
|
|
if parent is adoptive_parent and adoptive_parent is not None:
|
|
|
bio_name = (bio_parent.get('simplified_name') or bio_parent.get('name')) if bio_parent else None
|
|
bio_name = (bio_parent.get('simplified_name') or bio_parent.get('name')) if bio_parent else None
|
|
|
- adopt_label = f"从{bio_name}出继" if bio_name else "出继"
|
|
|
|
|
|
|
+ adopt_label = f"出继自{bio_name}" if bio_name else "出继"
|
|
|
if depth == 0:
|
|
if depth == 0:
|
|
|
center['adoption_label'] = adopt_label
|
|
center['adoption_label'] = adopt_label
|
|
|
elif generations:
|
|
elif generations:
|
|
@@ -6156,7 +6156,7 @@ def api_get_lineage(member_id):
|
|
|
children = cursor.fetchall()
|
|
children = cursor.fetchall()
|
|
|
for c in children:
|
|
for c in children:
|
|
|
c['has_children'] = bool(c['has_children'])
|
|
c['has_children'] = bool(c['has_children'])
|
|
|
- # 入继子女:附加生父母信息,生成"从xx出继"标注
|
|
|
|
|
|
|
+ # 入继子女:附加生父母信息,生成"出继自xx"标注
|
|
|
if c['sub_relation_type'] == 3:
|
|
if c['sub_relation_type'] == 3:
|
|
|
cursor.execute("""
|
|
cursor.execute("""
|
|
|
SELECT p.name, p.simplified_name
|
|
SELECT p.name, p.simplified_name
|
|
@@ -6167,7 +6167,7 @@ def api_get_lineage(member_id):
|
|
|
bp = cursor.fetchone()
|
|
bp = cursor.fetchone()
|
|
|
if bp:
|
|
if bp:
|
|
|
bio_name = bp['simplified_name'] or bp['name']
|
|
bio_name = bp['simplified_name'] or bp['name']
|
|
|
- c['adoption_label'] = f"从{bio_name}出继"
|
|
|
|
|
|
|
+ c['adoption_label'] = f"出继自{bio_name}"
|
|
|
else:
|
|
else:
|
|
|
c['adoption_label'] = "出继"
|
|
c['adoption_label'] = "出继"
|
|
|
|
|
|
|
@@ -6262,7 +6262,7 @@ def api_get_ancestors_above(ancestor_id):
|
|
|
anchor_bio_wx = ap
|
|
anchor_bio_wx = ap
|
|
|
if has_adoptive_wx and anchor_bio_wx:
|
|
if has_adoptive_wx and anchor_bio_wx:
|
|
|
bio_name_wx = anchor_bio_wx.get('simplified_name') or anchor_bio_wx.get('name')
|
|
bio_name_wx = anchor_bio_wx.get('simplified_name') or anchor_bio_wx.get('name')
|
|
|
- anchor_adoption_label_wx = f"从{bio_name_wx}出继" if bio_name_wx else "出继"
|
|
|
|
|
|
|
+ anchor_adoption_label_wx = f"出继自{bio_name_wx}" if bio_name_wx else "出继"
|
|
|
|
|
|
|
|
for depth in range(max_depth):
|
|
for depth in range(max_depth):
|
|
|
cursor.execute("""
|
|
cursor.execute("""
|
|
@@ -6291,10 +6291,10 @@ def api_get_ancestors_above(ancestor_id):
|
|
|
normal_parent = p
|
|
normal_parent = p
|
|
|
parent = adoptive_parent or normal_parent or bio_parent
|
|
parent = adoptive_parent or normal_parent or bio_parent
|
|
|
|
|
|
|
|
- # 若走入继路径,在 current_id 对应的人物上标注"从xx出继"
|
|
|
|
|
|
|
+ # 若走入继路径,在 current_id 对应的人物上标注"出继自xx"
|
|
|
if parent is adoptive_parent and adoptive_parent is not None:
|
|
if parent is adoptive_parent and adoptive_parent is not None:
|
|
|
bio_name = (bio_parent.get('simplified_name') or bio_parent.get('name')) if bio_parent else None
|
|
bio_name = (bio_parent.get('simplified_name') or bio_parent.get('name')) if bio_parent else None
|
|
|
- adopt_label = f"从{bio_name}出继" if bio_name else "出继"
|
|
|
|
|
|
|
+ adopt_label = f"出继自{bio_name}" if bio_name else "出继"
|
|
|
if depth == 0:
|
|
if depth == 0:
|
|
|
anchor_adoption_label_wx = adopt_label
|
|
anchor_adoption_label_wx = adopt_label
|
|
|
elif generations:
|
|
elif generations:
|