update
This commit is contained in:
parent
b4791a563c
commit
a8dbdd1bc4
@ -2,11 +2,11 @@ from fastapi import APIRouter, Depends
|
|||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
from app.models.station import StationDB, StationCreate, StationUpdate, StationInfo
|
from app.models.station import StationDB, StationCreate, StationUpdate, StationInfo
|
||||||
|
from app.models.community import CommunityDB
|
||||||
from app.models.database import get_db
|
from app.models.database import get_db
|
||||||
from app.api.deps import get_admin_user
|
from app.api.deps import get_admin_user
|
||||||
from app.models.user import UserDB
|
from app.models.user import UserDB
|
||||||
from app.core.response import success_response, error_response, ResponseModel
|
from app.core.response import success_response, error_response, ResponseModel
|
||||||
from app.models.community import CommunityDB
|
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ async def get_stations(
|
|||||||
"""获取驿站列表"""
|
"""获取驿站列表"""
|
||||||
# 联表查询,获取社区名称
|
# 联表查询,获取社区名称
|
||||||
query = db.query(
|
query = db.query(
|
||||||
StationDB,
|
StationDB,
|
||||||
CommunityDB.name.label('community_name')
|
CommunityDB.name.label('community_name')
|
||||||
).join(
|
).join(
|
||||||
CommunityDB,
|
CommunityDB,
|
||||||
|
|||||||
@ -26,7 +26,6 @@ class StationUpdate(BaseModel):
|
|||||||
class StationInfo(BaseModel):
|
class StationInfo(BaseModel):
|
||||||
id: int
|
id: int
|
||||||
name: str
|
name: str
|
||||||
address: str
|
|
||||||
community_id: int
|
community_id: int
|
||||||
community_name: Optional[str] = None
|
community_name: Optional[str] = None
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user