| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- from datetime import datetime
- from typing import TYPE_CHECKING
- from sqlalchemy import JSON, DateTime, ForeignKey, Integer, String, Text
- from sqlalchemy.orm import Mapped, mapped_column, relationship
- from app.common.enums import PermissionFilterStrategy
- from app.core.base_model import PaymentModelMixin, TenantMixin, EnterpriseMixin
- if TYPE_CHECKING:
- from app.api.v1.module_system.user.model import UserModel
- class EmployeeModel(PaymentModelMixin, TenantMixin, EnterpriseMixin):
- """员工模型"""
- __tablename__ = "pay_employee"
- __table_args__ = {"comment": "员工表"}
- __permission_strategy__ = PermissionFilterStrategy.ENTERPRISE_BASED
- employee_id: Mapped[str | None] = mapped_column(
- String(64), unique=True, comment="员工ID(业务主键)"
- )
- employee_name: Mapped[str | None] = mapped_column(String(128), comment="员工姓名")
- employee_no: Mapped[str | None] = mapped_column(
- String(64), index=True, comment="员工工号"
- )
- identity_type: Mapped[str | None] = mapped_column(
- String(32), comment="身份类型: ALIPAY_USER_ID/ALIPAY_LOGON_ID/ENTERPRISE_USER_ID"
- )
- identity: Mapped[str | None] = mapped_column(
- String(64), comment="身份标识"
- )
- identity_open_id: Mapped[str | None] = mapped_column(
- String(128), comment="员工openId"
- )
- employee_mobile: Mapped[str | None] = mapped_column(
- String(32), comment="员工手机号"
- )
- employee_email: Mapped[str | None] = mapped_column(
- String(128), comment="员工邮箱"
- )
- employee_cert_type: Mapped[str | None] = mapped_column(
- String(32), comment="证件类型: IDENTITY_CARD/PASSPORT/DRIVER_LICENSE"
- )
- employee_cert_no: Mapped[str | None] = mapped_column(
- String(64), comment="证件号码"
- )
- status: Mapped[str] = mapped_column(
- String(32),
- default="EMPLOYEE_CREATE",
- comment="状态: EMPLOYEE_CREATE/EMPLOYEE_ACTIVATED/EMPLOYEE_UNSIGN"
- )
- iot_check_type: Mapped[str | None] = mapped_column(
- String(64), comment="IoT核身方式"
- )
- department_ids: Mapped[list | None] = mapped_column(
- JSON, comment="部门ID列表"
- )
- accounting_entity_ids: Mapped[list | None] = mapped_column(
- JSON, comment="核算主体ID列表"
- )
- label_names: Mapped[list | None] = mapped_column(
- JSON, comment="标签名称列表"
- )
- sign_return_url: Mapped[str | None] = mapped_column(
- Text, comment="签约跳转URL"
- )
- create_share_code: Mapped[bool | None] = mapped_column(
- default=False, comment="是否创建分享码"
- )
- sign_url_carry_info: Mapped[bool | None] = mapped_column(
- default=False, comment="签约链接是否携带信息"
- )
-
- sign_url: Mapped[str | None] = mapped_column(
- Text, comment="邀请链接"
- )
- share_code: Mapped[str | None] = mapped_column(
- String(128), comment="分享码"
- )
- iot_unique_id: Mapped[str | None] = mapped_column(
- String(64), comment="IoT唯一标识"
- )
- profiles: Mapped[dict | None] = mapped_column(
- JSON, comment="扩展参数"
- )
- withholding_sign_str: Mapped[str | None] = mapped_column(
- Text, comment="代扣签约串"
- )
- free_sign_token: Mapped[str | None] = mapped_column(
- String(256), comment="免登签约token"
- )
- department_list: Mapped[JSON | None] = mapped_column(
- JSON, comment="部门列表"
- )
- role_list: Mapped[JSON | None] = mapped_column(
- JSON, comment="角色列表"
- )
-
- user_id: Mapped[int | None] = mapped_column(
- Integer,
- ForeignKey("sys_user.id", ondelete="SET NULL", onupdate="CASCADE"),
- nullable=True,
- comment="关联的系统用户ID"
- )
-
- user: Mapped["UserModel | None"] = relationship(
- "UserModel",
- foreign_keys="EmployeeModel.user_id",
- lazy="selectin",
- viewonly=True
- )
|