from fastapi import Depends, APIRouter, status, Query, Path, HTTPException from internal.models import * from internal.database import fetch_one, fetch_all, execute_query, response_success, raise_if_exists,raise_if_not_found from dependencies import get_current_active_user router = APIRouter( prefix="/labels", tags=['标签管理'] ) # 获取列表 @router.get("/list") async def label_list(): select_query = "SELECT blogs.`blogtitle`,labels.`labelname` FROM blogs LEFT JOIN blog_label ON blog_label.`blogid`=blogs.`id` LEFT JOIN labels ON blog_label.`labelid`=labels.id;" label_list = fetch_all(select_query) return response_success(label_list, "label get list success")