"""统一编号序列(bre_sequence)—— 仅被 NumberGenService 直接写入,无业务 CRUD 端点。""" from sqlalchemy import BigInteger, String from sqlalchemy.orm import Mapped, mapped_column from app.core.base_model import ModelMixin, MappedBase class SequenceModel(ModelMixin, MappedBase): """原子取号计数器:name 唯一,current_seq 记录最近一次已发序号。""" __tablename__ = "bre_sequence" __table_args__ = () # 计数器表无 status 列,禁用 ModelMixin 默认的 status 索引 name: Mapped[str] = mapped_column(String(128), unique=True, nullable=False, comment="序列名") current_seq: Mapped[int] = mapped_column(BigInteger, nullable=False, default=0, comment="最近已发序号")