feat: 初始化考培练系统项目
- 从服务器拉取完整代码 - 按框架规范整理项目结构 - 配置 Drone CI 测试环境部署 - 包含后端(FastAPI)、前端(Vue3)、管理端 技术栈: Vue3 + TypeScript + FastAPI + MySQL
This commit is contained in:
28
backend/app/models/position_course.py
Normal file
28
backend/app/models/position_course.py
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
岗位课程关联模型
|
||||
"""
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Boolean, Enum, UniqueConstraint
|
||||
from sqlalchemy.orm import relationship
|
||||
from app.models.base import BaseModel, SoftDeleteMixin
|
||||
|
||||
|
||||
class PositionCourse(BaseModel, SoftDeleteMixin):
|
||||
"""岗位课程关联表"""
|
||||
__tablename__ = "position_courses"
|
||||
|
||||
# 添加唯一约束:同一岗位下同一课程只能有一条有效记录
|
||||
__table_args__ = (
|
||||
UniqueConstraint('position_id', 'course_id', 'is_deleted', name='uix_position_course'),
|
||||
)
|
||||
|
||||
position_id = Column(Integer, ForeignKey("positions.id"), nullable=False, comment="岗位ID")
|
||||
course_id = Column(Integer, ForeignKey("courses.id"), nullable=False, comment="课程ID")
|
||||
|
||||
# 课程类型:required(必修)、optional(选修)
|
||||
course_type = Column(String(20), default="required", nullable=False, comment="课程类型")
|
||||
priority = Column(Integer, default=0, comment="优先级/排序")
|
||||
|
||||
# 关系
|
||||
position = relationship("Position", back_populates="courses")
|
||||
course = relationship("Course", back_populates="position_assignments")
|
||||
Reference in New Issue
Block a user