修复日期过滤使用正确的date类型
This commit is contained in:
parent
810a36d757
commit
9faa2d8069
|
|
@ -127,10 +127,11 @@ def get_information_list(
|
||||||
if user_id:
|
if user_id:
|
||||||
query = query.filter(Information.user_id == user_id)
|
query = query.filter(Information.user_id == user_id)
|
||||||
|
|
||||||
# 成交日期过滤 - 使用cast确保字符串与date字段正确比较
|
# 成交日期过滤
|
||||||
if deal_date:
|
if deal_date:
|
||||||
from sqlalchemy import cast, String
|
from datetime import date
|
||||||
query = query.filter(cast(Information.deal_date, String) == deal_date)
|
deal_date_obj = date.fromisoformat(deal_date)
|
||||||
|
query = query.filter(Information.deal_date == deal_date_obj)
|
||||||
|
|
||||||
# 按创建时间倒序
|
# 按创建时间倒序
|
||||||
query = query.order_by(Information.created_at.desc())
|
query = query.order_by(Information.created_at.desc())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue