提交
This commit is contained in:
1 parent
575e63e7e8
commit
771f010a39
165 files changed
+67359
-21698
No files matched your search
@@ -731,11 +731,20 @@ class ExhibitionAppointmentUpdateBody(BaseModel):
|
||||
remark: Optional[str] = None
|
||||
|
||||
|
||||
def _normalize_visit_date_bound(value: str, *, end_of_day: bool = False) -> str:
|
||||
val = (value or "").strip()
|
||||
if len(val) == 10:
|
||||
return f"{val} 23:59:59" if end_of_day else f"{val} 00:00:00"
|
||||
return val
|
||||
|
||||
|
||||
@router.get("/exhibition-appointments")
|
||||
async def list_exhibition_appointments(
|
||||
page: int = Query(1, ge=1),
|
||||
pageSize: int = Query(10, ge=1, le=100, alias="pageSize"),
|
||||
keyword: Optional[str] = None,
|
||||
visitDateStart: Optional[str] = Query(None, alias="visitDateStart"),
|
||||
visitDateEnd: Optional[str] = Query(None, alias="visitDateEnd"),
|
||||
user: dict = Depends(require_admin_or_super_admin),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
@@ -754,6 +763,14 @@ async def list_exhibition_appointments(
|
||||
BizExhibitionAppointment.visit_org.like(like),
|
||||
)
|
||||
)
|
||||
if visitDateStart:
|
||||
query = query.filter(
|
||||
BizExhibitionAppointment.visit_date >= _normalize_visit_date_bound(visitDateStart)
|
||||
)
|
||||
if visitDateEnd:
|
||||
query = query.filter(
|
||||
BizExhibitionAppointment.visit_date <= _normalize_visit_date_bound(visitDateEnd, end_of_day=True)
|
||||
)
|
||||
query = apply_data_scope(query, BizExhibitionAppointment, user, db, tenant_no)
|
||||
total = query.count()
|
||||
items = query.order_by(BizExhibitionAppointment.create_time.desc()).offset((page - 1) * pageSize).limit(pageSize).all()
|
||||
|
||||
Reference in new issue
Block a user