Files
fastapi-best-architecture/backend/app/admin/model/data_rule.py
T
Wu Clan a5e9a0e805 Refactor physical deletion to logical deletion (#1191)
* Refactor physical deletion to logical deletion

* Update the usage of unique indexes

* Update scheduler update and delete

* Fix lint

* Add some missing logic

* Optimize codegen get by id
2026-05-30 15:02:00 +08:00

26 lines
965 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import sqlalchemy as sa
from sqlalchemy.orm import Mapped, mapped_column
from backend.common.model import Base, id_key
class DataRule(Base):
"""数据规则表"""
__tablename__ = 'sys_data_rule'
__table_args__ = (
sa.UniqueConstraint('name', 'deleted', name='uk_sys_data_rule_name_deleted'),
{'comment': '数据规则表'},
)
id: Mapped[id_key] = mapped_column(init=False)
name: Mapped[str] = mapped_column(sa.String(512), comment='名称')
model: Mapped[str] = mapped_column(sa.String(64), comment='模型名称')
column: Mapped[str] = mapped_column(sa.String(32), comment='模型字段名')
operator: Mapped[int] = mapped_column(comment='运算符(0:and、1:or)')
expression: Mapped[int] = mapped_column(
comment='表达式(0:==、1:!=、2:>、3:>=、4:<、5:<=、6:in、7:not_in)',
)
value: Mapped[str] = mapped_column(sa.String(256), comment='规则值')