1
This commit is contained in:
parent
ab5d42fb65
commit
2a58fcc52d
@ -106,17 +106,19 @@ async def update_address(
|
|||||||
for key, value in update_data.items():
|
for key, value in update_data.items():
|
||||||
setattr(db_address, key, value)
|
setattr(db_address, key, value)
|
||||||
|
|
||||||
# 查询社区名字和楼栋名字
|
# 更新社区名字和楼栋名字
|
||||||
community = db.query(CommunityDB).filter(
|
if address.community_id:
|
||||||
CommunityDB.id == address.community_id
|
community = db.query(CommunityDB).filter(
|
||||||
).first()
|
CommunityDB.id == address.community_id
|
||||||
|
).first()
|
||||||
|
db_address.community_name = community.name
|
||||||
|
|
||||||
community_building = db.query(CommunityBuildingDB).filter(
|
if address.community_building_id:
|
||||||
CommunityBuildingDB.id == address.community_building_id
|
community_building = db.query(CommunityBuildingDB).filter(
|
||||||
).first()
|
CommunityBuildingDB.id == address.community_building_id
|
||||||
|
).first()
|
||||||
|
db_address.community_building_name = community_building.building_name
|
||||||
|
|
||||||
db_address.community_name = community.name
|
|
||||||
db_address.community_building_name = community_building.building_name
|
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
db.refresh(db_address)
|
db.refresh(db_address)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user