Refactor foreign keys and relationships to pure logic (#901)

* Refactor foreign keys and relationships to pure logic

* Revert of some changes

* More revert

* Update the user paginate

* Update user create and update

* Update dept select and delete

* Rename the join query functions

* Update select_join_serialize doc and README

* Fix typo in README

* Update the user delete

* Update the user social

* Update the dict plugin crud

* Update the dict plugin version

* Bump dependencies and pre-commits

* Update the code generator plugin crud

* Update the menu crud

* Update the role crud

* Update the data scope and rule crud

* Restore get_paginated to get_select

* Update the code generator plugin version

* Add the py version in pre-commit

* Remove the plugin include parameter config

* Add more cache cleaning TODO

* Rename get_with_relation to get_join

* Add the user cache clear

* Fix known compatibility issues

* Update the version number to 1.11.0

* Fix lint

* Optimize select_join_serialize logic

* Delete cache cleanup comments

* Update the oauth2 plugin version

* Fix user-role table cleanup when user update
This commit is contained in:
Wu Clan
2025-11-12 13:06:26 +08:00
committed by GitHub
parent b9255815e1
commit 2b56168ad0
47 changed files with 1048 additions and 764 deletions
+3 -13
View File
@@ -1,16 +1,9 @@
from __future__ import annotations
from typing import TYPE_CHECKING
import sqlalchemy as sa
from sqlalchemy.orm import Mapped, mapped_column, relationship
from sqlalchemy.orm import Mapped, mapped_column
from backend.common.model import DataClassBase, UniversalText, id_key
if TYPE_CHECKING:
from backend.plugin.code_generator.model import GenBusiness
class GenColumn(DataClassBase):
"""代码生成模型列表"""
@@ -28,8 +21,5 @@ class GenColumn(DataClassBase):
is_pk: Mapped[bool] = mapped_column(default=False, comment='是否主键')
is_nullable: Mapped[bool] = mapped_column(default=False, comment='是否可为空')
# 代码生成业务模型列一对多
gen_business_id: Mapped[int] = mapped_column(
sa.BigInteger, sa.ForeignKey('gen_business.id', ondelete='CASCADE'), default=0, comment='代码生成业务ID'
)
gen_business: Mapped[GenBusiness | None] = relationship(init=False, back_populates='gen_column')
# 逻辑外键
gen_business_id: Mapped[int] = mapped_column(sa.BigInteger, default=0, comment='代码生成业务ID')