添加ORM表

This commit is contained in:
zk
2026-07-24 18:27:20 +08:00
parent 75d2bf93e9
commit 8d67bc76ec
9 changed files with 186 additions and 0 deletions
View File
+36
View File
@@ -0,0 +1,36 @@
"""MySQL: bg_company 表模型"""
from datetime import datetime
from typing import Optional
from sqlalchemy import BigInteger, DateTime, Integer, JSON, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class Company(MysqlBase):
"""公司表"""
__tablename__ = "bg_company"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, comment="主键ID(雪花)")
name: Mapped[Optional[str]] = mapped_column(String(255), comment="公司全称")
short_name: Mapped[str] = mapped_column(String(128), nullable=False, comment="公司简称")
logo_url: Mapped[Optional[str]] = mapped_column(String(512), comment="Logo地址")
region_code: Mapped[Optional[str]] = mapped_column(String(20), comment="地区编码")
company_type: Mapped[Optional[str]] = mapped_column(String(32), comment="企业类型:上市企业/独角兽/国企等")
industry_id: Mapped[Optional[int]] = mapped_column(BigInteger, comment="行业ID")
tags: Mapped[Optional[list]] = mapped_column(JSON, comment="公司标签JSON数组")
summary: Mapped[Optional[str]] = mapped_column(String(512), comment="一句话简介")
description: Mapped[Optional[str]] = mapped_column(Text, comment="公司详细描述")
founded_year: Mapped[Optional[str]] = mapped_column(String(10), comment="成立年份")
address: Mapped[Optional[str]] = mapped_column(String(255), comment="总部地址")
scale: Mapped[Optional[str]] = mapped_column(String(32), comment="企业规模")
website: Mapped[Optional[str]] = mapped_column(String(255), comment="官网地址")
financing_stage: Mapped[Optional[str]] = mapped_column(String(32), comment="融资状态")
latest_valuation: Mapped[Optional[str]] = mapped_column(String(64), comment="最新估值")
news: Mapped[Optional[list]] = mapped_column(JSON, comment="相关新闻JSON数组")
status: Mapped[int] = mapped_column(Integer, default=0, comment="0=待完善 1=已完善 2=禁用 3=补充中 4=补充失败")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="创建时间")
update_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="更新时间")
+36
View File
@@ -0,0 +1,36 @@
"""MySQL: bg_recruit_announcement 招聘公告主表模型"""
from datetime import datetime
from typing import Optional
from sqlalchemy import BigInteger, DateTime, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class RecruitAnnouncement(MysqlBase):
"""招聘公告主表"""
__tablename__ = "bg_recruit_announcement"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, comment="主键ID(雪花)")
company_id: Mapped[Optional[int]] = mapped_column(BigInteger, comment="关联企业主表id")
company_name: Mapped[str] = mapped_column(String(128), nullable=False, default="", comment="公司名称")
title: Mapped[str] = mapped_column(String(255), nullable=False, default="", comment="公告标题")
company_intro: Mapped[Optional[str]] = mapped_column(Text, comment="公司简介")
target_audience: Mapped[Optional[str]] = mapped_column(String(500), comment="面向对象,如2027届本硕博")
major_require: Mapped[Optional[str]] = mapped_column(String(500), comment="专业要求")
remark: Mapped[Optional[str]] = mapped_column(String(1000), comment="备注")
written_exam: Mapped[Optional[str]] = mapped_column(String(16), comment="是否笔试:有 / 无 / 未明确")
apply_start_time: Mapped[Optional[datetime]] = mapped_column(DateTime, comment="投递开始时间")
apply_end_time: Mapped[Optional[datetime]] = mapped_column(DateTime, comment="投递结束时间")
apply_end_desc: Mapped[Optional[str]] = mapped_column(String(64), comment='投递截止描述,如"尽快投递"')
invite_code: Mapped[Optional[str]] = mapped_column(String(64), comment="专属内推码")
announcement_url: Mapped[Optional[str]] = mapped_column(String(512), comment="公告地址")
apply_url: Mapped[Optional[str]] = mapped_column(String(512), comment="投递地址")
apply_email: Mapped[Optional[str]] = mapped_column(String(128), comment="投递邮箱")
source: Mapped[Optional[str]] = mapped_column(String(255), comment="信息来源说明")
publish_time: Mapped[Optional[datetime]] = mapped_column(DateTime, comment="公告发布/更新时间")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="创建时间")
update_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="更新时间")
+19
View File
@@ -0,0 +1,19 @@
"""MySQL: bg_recruit_announcement_batch 招聘公告-批次关联表模型"""
from datetime import datetime
from sqlalchemy import BigInteger, DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class RecruitAnnouncementBatch(MysqlBase):
"""招聘公告-批次关联表"""
__tablename__ = "bg_recruit_announcement_batch"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, comment="主键ID(雪花)")
announcement_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="公告id")
batch_name: Mapped[str] = mapped_column(String(64), nullable=False, comment="批次值,如实习/暑期实习/寒假实习/秋招专场/春招提前批/春招补招")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="创建时间")
@@ -0,0 +1,19 @@
"""MySQL: bg_recruit_announcement_category 招聘公告-岗位大类关联表模型"""
from datetime import datetime
from sqlalchemy import BigInteger, DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class RecruitAnnouncementCategory(MysqlBase):
"""招聘公告-岗位大类关联表"""
__tablename__ = "bg_recruit_announcement_category"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, comment="主键ID(雪花)")
announcement_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="公告id")
category_name: Mapped[str] = mapped_column(String(64), nullable=False, comment="岗位大类值,如IT技术/人工智能/通信")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="创建时间")
+19
View File
@@ -0,0 +1,19 @@
"""MySQL: bg_recruit_announcement_city 招聘公告-热招城市关联表模型"""
from datetime import datetime
from sqlalchemy import BigInteger, DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class RecruitAnnouncementCity(MysqlBase):
"""招聘公告-热招城市关联表"""
__tablename__ = "bg_recruit_announcement_city"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, comment="主键ID(雪花)")
announcement_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="公告id")
city_name: Mapped[str] = mapped_column(String(64), nullable=False, comment="城市值,如北京市/天津市")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="创建时间")
@@ -0,0 +1,19 @@
"""MySQL: bg_recruit_announcement_education 招聘公告-学历要求关联表模型"""
from datetime import datetime
from sqlalchemy import BigInteger, DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class RecruitAnnouncementEducation(MysqlBase):
"""招聘公告-学历要求关联表"""
__tablename__ = "bg_recruit_announcement_education"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, comment="主键ID(雪花)")
announcement_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="公告id")
education_name: Mapped[str] = mapped_column(String(32), nullable=False, comment="学历值,如本科/硕士/博士")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="创建时间")
+19
View File
@@ -0,0 +1,19 @@
"""MySQL: bg_recruit_announcement_tag 招聘公告-标签组关联表模型"""
from datetime import datetime
from sqlalchemy import BigInteger, DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class RecruitAnnouncementTag(MysqlBase):
"""招聘公告-标签组关联表"""
__tablename__ = "bg_recruit_announcement_tag"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, comment="主键ID(雪花)")
announcement_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="公告id")
tag_name: Mapped[str] = mapped_column(String(64), nullable=False, comment="标签值,如秋招提前批/竞争力薪酬/校招")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="创建时间")
+19
View File
@@ -0,0 +1,19 @@
"""MySQL: bg_recruit_announcement_year 招聘公告-招聘届数关联表模型"""
from datetime import datetime
from sqlalchemy import BigInteger, DateTime, SmallInteger
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class RecruitAnnouncementYear(MysqlBase):
"""招聘公告-招聘届数关联表"""
__tablename__ = "bg_recruit_announcement_year"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, comment="主键ID(雪花)")
announcement_id: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="公告id")
recruit_year: Mapped[int] = mapped_column(SmallInteger, nullable=False, comment="招聘届数,如2027")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="创建时间")