使用 fastapi 重构

This commit is contained in:
shikong 2023-05-31 13:32:30 +08:00
parent aab79ea2d2
commit 9544b7773a

View File

@ -22,8 +22,8 @@ def get_list(db: Session = Depends(database),
query = db.query(JiaKaoBaoDian) query = db.query(JiaKaoBaoDian)
if len(keyword) > 0: if len(keyword) > 0:
query = query.filter( query = query.filter(
JiaKaoBaoDian.question.like("%%%s%%" % keyword), JiaKaoBaoDian.question.like("%%%s%%" % keyword) |
JiaKaoBaoDian.illiteracy_explain.like("%%%s%%" % keyword),) JiaKaoBaoDian.illiteracy_explain.like("%%%s%%" % keyword))
if order_by_wrong_rate: if order_by_wrong_rate:
query = query.order_by(JiaKaoBaoDian.wrong_rate.desc()) query = query.order_by(JiaKaoBaoDian.wrong_rate.desc())