初始化

This commit is contained in:
zk
2026-06-02 17:44:03 +08:00
commit 30e6a6e2a5
34 changed files with 1692 additions and 0 deletions
View File
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)
name: Mapped[Optional[str]] = mapped_column(String(255))
short_name: Mapped[str] = mapped_column(String(128), nullable=False)
logo_url: Mapped[Optional[str]] = mapped_column(String(512))
region_code: Mapped[Optional[str]] = mapped_column(String(20))
company_type: Mapped[Optional[str]] = mapped_column(String(32))
industry_id: Mapped[Optional[int]] = mapped_column(BigInteger)
tags: Mapped[Optional[list]] = mapped_column(JSON)
summary: Mapped[Optional[str]] = mapped_column(String(512))
description: Mapped[Optional[str]] = mapped_column(Text)
founded_year: Mapped[Optional[str]] = mapped_column(String(10))
address: Mapped[Optional[str]] = mapped_column(String(255))
scale: Mapped[Optional[str]] = mapped_column(String(32))
website: Mapped[Optional[str]] = mapped_column(String(255))
financing_stage: Mapped[Optional[str]] = mapped_column(String(32))
latest_valuation: Mapped[Optional[str]] = mapped_column(String(64))
news: Mapped[Optional[list]] = mapped_column(JSON)
status: Mapped[int] = mapped_column(Integer, default=0, comment="0=待完善 1=已完善 2=禁用 3=补充中 4=补充失败")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False)
update_time: Mapped[datetime] = mapped_column(DateTime, nullable=False)
+39
View File
@@ -0,0 +1,39 @@
"""MySQL: bg_job 表模型"""
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 Job(MysqlBase):
"""岗位表"""
__tablename__ = "bg_job"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
title: Mapped[str] = mapped_column(String(255), nullable=False)
company_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
category_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
employment_type: Mapped[int] = mapped_column(Integer, default=0)
description: Mapped[Optional[str]] = mapped_column(Text)
requirement: Mapped[Optional[str]] = mapped_column(Text)
bonus: Mapped[Optional[str]] = mapped_column(Text)
tags: Mapped[Optional[list]] = mapped_column(JSON)
skill_tags: Mapped[Optional[list]] = mapped_column(JSON)
salary: Mapped[Optional[str]] = mapped_column(String(64))
education: Mapped[int] = mapped_column(Integer, default=0)
min_experience: Mapped[int] = mapped_column(Integer, default=0)
required_industry_id: Mapped[Optional[int]] = mapped_column(BigInteger)
required_major_ids: Mapped[Optional[list]] = mapped_column(JSON)
major_sensitivity: Mapped[Optional[int]] = mapped_column(Integer)
source_url: Mapped[Optional[str]] = mapped_column(String(1024))
source_id: Mapped[Optional[str]] = mapped_column(String(64))
recruit_category: Mapped[Optional[int]] = mapped_column(Integer, comment="招聘分类: 0=校招, 1=实习, 2=社招, 3=其他")
expire_at: Mapped[Optional[datetime]] = mapped_column(DateTime, comment="发布日期")
status: Mapped[int] = mapped_column(Integer, default=0, comment="0=上架 1=下架 2=已失效")
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False)
update_time: Mapped[datetime] = mapped_column(DateTime, nullable=False)
+30
View File
@@ -0,0 +1,30 @@
"""MySQL: 关联表模型"""
from datetime import datetime
from sqlalchemy import BigInteger, DateTime, String
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class JobRegionRelation(MysqlBase):
"""岗位-地区关联表"""
__tablename__ = "bg_job_region_relation"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
job_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
region_code: Mapped[str] = mapped_column(String(20), nullable=False)
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False)
class JobSkillTagRelation(MysqlBase):
"""岗位-技能标签关联表"""
__tablename__ = "bg_job_skill_tag_relation"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
job_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
skill_tag_id: Mapped[int] = mapped_column(BigInteger, nullable=False)
create_time: Mapped[datetime] = mapped_column(DateTime, nullable=False)
+15
View File
@@ -0,0 +1,15 @@
"""MySQL: bg_skill_tag 表模型"""
from sqlalchemy import BigInteger, String
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import MysqlBase
class SkillTag(MysqlBase):
"""技能标签表"""
__tablename__ = "bg_skill_tag"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
name: Mapped[str] = mapped_column(String(100), unique=True, nullable=False)
View File
+35
View File
@@ -0,0 +1,35 @@
"""PostgreSQL: app_job_data 表模型"""
from datetime import datetime
from typing import Optional
from sqlalchemy import BigInteger, DateTime, Integer, SmallInteger, String, Text
from sqlalchemy.orm import Mapped, mapped_column
from app.core.database import PgBase
class AppJobData(PgBase):
"""爬虫岗位原始数据"""
__tablename__ = "app_job_data"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
urllistid: Mapped[int] = mapped_column(BigInteger, nullable=False, comment="关联urllistid")
job_title: Mapped[Optional[str]] = mapped_column(String(255))
salary: Mapped[Optional[str]] = mapped_column(String(128))
location: Mapped[Optional[str]] = mapped_column(String(2048))
company: Mapped[Optional[str]] = mapped_column(String(255), comment="公司名字")
experience: Mapped[Optional[str]] = mapped_column(String(64))
education: Mapped[Optional[str]] = mapped_column(String(64))
description: Mapped[str] = mapped_column(Text, nullable=False)
detail_url: Mapped[str] = mapped_column(String(1024), nullable=False)
recruit_category: Mapped[int] = mapped_column(SmallInteger, default=3, nullable=False, comment="招聘分类: 0=校招, 1=实习, 2=社招, 3=其他")
content_hash: Mapped[str] = mapped_column(String(64), nullable=False)
sources: Mapped[int] = mapped_column(SmallInteger, default=0, nullable=False)
expire_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, comment="发布日期")
created_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False)
clean_status: Mapped[str] = mapped_column(String(20), default="pending", nullable=False, comment="pending/cleaning/cleaned/discarded")
clean_started_at: Mapped[Optional[datetime]] = mapped_column(DateTime)
cleaned_at: Mapped[Optional[datetime]] = mapped_column(DateTime)