from app.model.bussiness_model import ProjectType
from app.model.schemas.project_type_schemas import ProjectTypeOut

from sqlalchemy import asc
from sqlalchemy.orm import Session


def get_list(session: Session):
    """获取项目类型列表"""
    query = session.query(ProjectType).filter(ProjectType.type_status == "0").order_by(asc(ProjectType.id))
    result_list = [ProjectTypeOut.from_orm(project_type).dict() for project_type in query.all()]
    return result_list
