|
|
@ -47,7 +47,7 @@ async def blog_put(blog: Blog, id: str = Path(description="博客id")): |
|
|
|
execute_query(update_query, update_data) |
|
|
|
return response_success("blog update sucess") |
|
|
|
|
|
|
|
# 博客查询 |
|
|
|
# 博客模糊查询 |
|
|
|
@router.get("/list/search") |
|
|
|
async def blog_list_search( |
|
|
|
blogtitle: str = Query(None, description="博客标题"), |
|
|
@ -72,3 +72,10 @@ async def blog_list_search( |
|
|
|
select_query += " ORDER BY create_at DESC" |
|
|
|
blog_list = fetch_all(select_query, params=params, fetchall=True) |
|
|
|
return response_success(data=blog_list,message="blog serach succuessfully!") |
|
|
|
|
|
|
|
# 根据id查询博客 |
|
|
|
@router.get("/list/search/{id}") |
|
|
|
async def get_id_blog(id:str=Path(description="博客id")): |
|
|
|
select_query="SELECT * FROM blogs WHERE id=%s" |
|
|
|
blog_list=execute_query(select_query,(id,)) |
|
|
|
return response_success(data=blog_list,message="blog search success") |