mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 21:15:13 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5621daea98 | ||
|
|
71d168dfea | ||
|
|
2d4365189d | ||
|
|
0c28a46e60 | ||
|
|
a4c7dae99c | ||
|
|
bfda0a226c | ||
|
|
c9bbb105a3 | ||
|
|
b415dc8912 | ||
|
|
05b74d71a3 | ||
|
|
10c0c691a7 | ||
|
|
0bc3786fc6 | ||
|
|
8e041ccb1b |
@@ -1,3 +1,24 @@
|
|||||||
|
<a id="v1.4.3"></a>
|
||||||
|
# [v1.4.3](https://github.com/fastapi-practices/fastapi_best_architecture/releases/tag/v1.4.3) - 2025-06-02
|
||||||
|
|
||||||
|
## What's Changed
|
||||||
|
* Update changelog for v1.4.2 by [@wu-clan](https://github.com/wu-clan) in [#639](https://github.com/fastapi-practices/fastapi_best_architecture/pull/639)
|
||||||
|
* Fix the role update business variables by [@wu-clan](https://github.com/wu-clan) in [#640](https://github.com/fastapi-practices/fastapi_best_architecture/pull/640)
|
||||||
|
* Fix the menu delete interface arg description by [@wu-clan](https://github.com/wu-clan) in [#641](https://github.com/fastapi-practices/fastapi_best_architecture/pull/641)
|
||||||
|
* Fix the filter of query all menus by [@wu-clan](https://github.com/wu-clan) in [#642](https://github.com/fastapi-practices/fastapi_best_architecture/pull/642)
|
||||||
|
* Refactor routes to better align with RESTful by [@wu-clan](https://github.com/wu-clan) in [#645](https://github.com/fastapi-practices/fastapi_best_architecture/pull/645)
|
||||||
|
* Update the server startup time to string by [@wu-clan](https://github.com/wu-clan) in [#646](https://github.com/fastapi-practices/fastapi_best_architecture/pull/646)
|
||||||
|
* Add get all data scope rules interface by [@wu-clan](https://github.com/wu-clan) in [#647](https://github.com/fastapi-practices/fastapi_best_architecture/pull/647)
|
||||||
|
* Add data permission condition for filter data by [@wu-clan](https://github.com/wu-clan) in [#648](https://github.com/fastapi-practices/fastapi_best_architecture/pull/648)
|
||||||
|
* Update default value for role filter scopes by [@wu-clan](https://github.com/wu-clan) in [#649](https://github.com/fastapi-practices/fastapi_best_architecture/pull/649)
|
||||||
|
* Fix data permission condition for filter data by [@wu-clan](https://github.com/wu-clan) in [#650](https://github.com/fastapi-practices/fastapi_best_architecture/pull/650)
|
||||||
|
|
||||||
|
|
||||||
|
**Full Changelog**: https://github.com/fastapi-practices/fastapi_best_architecture/compare/v1.4.2...v1.4.3
|
||||||
|
|
||||||
|
[Changes][v1.4.3]
|
||||||
|
|
||||||
|
|
||||||
<a id="v1.4.2"></a>
|
<a id="v1.4.2"></a>
|
||||||
# [v1.4.2](https://github.com/fastapi-practices/fastapi_best_architecture/releases/tag/v1.4.2) - 2025-05-29
|
# [v1.4.2](https://github.com/fastapi-practices/fastapi_best_architecture/releases/tag/v1.4.2) - 2025-05-29
|
||||||
|
|
||||||
@@ -570,6 +591,7 @@
|
|||||||
[Changes][v1.0.0]
|
[Changes][v1.0.0]
|
||||||
|
|
||||||
|
|
||||||
|
[v1.4.3]: https://github.com/fastapi-practices/fastapi_best_architecture/compare/v1.4.2...v1.4.3
|
||||||
[v1.4.2]: https://github.com/fastapi-practices/fastapi_best_architecture/compare/v1.4.1...v1.4.2
|
[v1.4.2]: https://github.com/fastapi-practices/fastapi_best_architecture/compare/v1.4.1...v1.4.2
|
||||||
[v1.4.1]: https://github.com/fastapi-practices/fastapi_best_architecture/compare/v1.4.0...v1.4.1
|
[v1.4.1]: https://github.com/fastapi-practices/fastapi_best_architecture/compare/v1.4.0...v1.4.1
|
||||||
[v1.4.0]: https://github.com/fastapi-practices/fastapi_best_architecture/compare/v1.3.0...v1.4.0
|
[v1.4.0]: https://github.com/fastapi-practices/fastapi_best_architecture/compare/v1.3.0...v1.4.0
|
||||||
|
|||||||
@@ -83,14 +83,7 @@ async def update_plugin_status(plugin: Annotated[str, Path(description='插件
|
|||||||
return response_base.success()
|
return response_base.success()
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
@router.get('/{plugin}', summary='打包并下载插件', dependencies=[DependsJwtAuth])
|
||||||
'/{plugin}',
|
|
||||||
summary='打包并下载插件',
|
|
||||||
dependencies=[
|
|
||||||
Depends(RequestPermission('sys:plugin:zip')),
|
|
||||||
DependsRBAC,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
async def build_plugin(plugin: Annotated[str, Path(description='插件名称')]) -> StreamingResponse:
|
async def build_plugin(plugin: Annotated[str, Path(description='插件名称')]) -> StreamingResponse:
|
||||||
bio = await plugin_service.build(plugin=plugin)
|
bio = await plugin_service.build(plugin=plugin)
|
||||||
return StreamingResponse(
|
return StreamingResponse(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ from backend.app.admin.schema.user import (
|
|||||||
AddUserParam,
|
AddUserParam,
|
||||||
GetCurrentUserInfoWithRelationDetail,
|
GetCurrentUserInfoWithRelationDetail,
|
||||||
GetUserInfoWithRelationDetail,
|
GetUserInfoWithRelationDetail,
|
||||||
RegisterUserParam,
|
|
||||||
ResetPasswordParam,
|
ResetPasswordParam,
|
||||||
UpdateUserParam,
|
UpdateUserParam,
|
||||||
)
|
)
|
||||||
@@ -24,12 +23,6 @@ from backend.database.db import CurrentSession
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
@router.post('/register', summary='注册用户')
|
|
||||||
async def register_user(obj: RegisterUserParam) -> ResponseModel:
|
|
||||||
await user_service.register(obj=obj)
|
|
||||||
return response_base.success()
|
|
||||||
|
|
||||||
|
|
||||||
@router.post('/add', summary='添加用户', dependencies=[DependsRBAC])
|
@router.post('/add', summary='添加用户', dependencies=[DependsRBAC])
|
||||||
async def add_user(request: Request, obj: AddUserParam) -> ResponseSchemaModel[GetUserInfoWithRelationDetail]:
|
async def add_user(request: Request, obj: AddUserParam) -> ResponseSchemaModel[GetUserInfoWithRelationDetail]:
|
||||||
await user_service.add(request=request, obj=obj)
|
await user_service.add(request=request, obj=obj)
|
||||||
@@ -133,8 +126,7 @@ async def multi_set(request: Request, pk: Annotated[int, Path(description='用
|
|||||||
|
|
||||||
@router.delete(
|
@router.delete(
|
||||||
path='/{username}',
|
path='/{username}',
|
||||||
summary='用户注销',
|
summary='删除用户',
|
||||||
description='用户注销 != 用户登出,注销之后用户将从数据库删除',
|
|
||||||
dependencies=[
|
dependencies=[
|
||||||
Depends(RequestPermission('sys:user:del')),
|
Depends(RequestPermission('sys:user:del')),
|
||||||
DependsRBAC,
|
DependsRBAC,
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class CRUDDataRule(CRUDPlus[DataRule]):
|
|||||||
:param name: 规则名称
|
:param name: 规则名称
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
stmt = select(self.model).options(noload(self.model.scope)).order_by(desc(self.model.created_time))
|
stmt = select(self.model).options(noload(self.model.scopes)).order_by(desc(self.model.created_time))
|
||||||
|
|
||||||
filters = []
|
filters = []
|
||||||
if name is not None:
|
if name is not None:
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ from sqlalchemy_crud_plus import CRUDPlus
|
|||||||
|
|
||||||
from backend.app.admin.model import Dept, Role, User
|
from backend.app.admin.model import Dept, Role, User
|
||||||
from backend.app.admin.schema.user import (
|
from backend.app.admin.schema.user import (
|
||||||
|
AddOAuth2UserParam,
|
||||||
AddUserParam,
|
AddUserParam,
|
||||||
RegisterUserParam,
|
|
||||||
UpdateUserParam,
|
UpdateUserParam,
|
||||||
)
|
)
|
||||||
from backend.common.security.jwt import get_hash_password
|
from backend.common.security.jwt import get_hash_password
|
||||||
@@ -61,26 +61,6 @@ class CRUDUser(CRUDPlus[User]):
|
|||||||
"""
|
"""
|
||||||
return await self.update_model_by_column(db, {'last_login_time': timezone.now()}, username=username)
|
return await self.update_model_by_column(db, {'last_login_time': timezone.now()}, username=username)
|
||||||
|
|
||||||
async def create(self, db: AsyncSession, obj: RegisterUserParam, *, social: bool = False) -> None:
|
|
||||||
"""
|
|
||||||
创建用户
|
|
||||||
|
|
||||||
:param db: 数据库会话
|
|
||||||
:param obj: 注册用户参数
|
|
||||||
:param social: 是否社交用户
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
if not social:
|
|
||||||
salt = bcrypt.gensalt()
|
|
||||||
obj.password = get_hash_password(obj.password, salt)
|
|
||||||
dict_obj = obj.model_dump()
|
|
||||||
dict_obj.update({'is_staff': True, 'salt': salt})
|
|
||||||
else:
|
|
||||||
dict_obj = obj.model_dump()
|
|
||||||
dict_obj.update({'is_staff': True, 'salt': None})
|
|
||||||
new_user = self.model(**dict_obj)
|
|
||||||
db.add(new_user)
|
|
||||||
|
|
||||||
async def add(self, db: AsyncSession, obj: AddUserParam) -> None:
|
async def add(self, db: AsyncSession, obj: AddUserParam) -> None:
|
||||||
"""
|
"""
|
||||||
添加用户
|
添加用户
|
||||||
@@ -101,6 +81,26 @@ class CRUDUser(CRUDPlus[User]):
|
|||||||
|
|
||||||
db.add(new_user)
|
db.add(new_user)
|
||||||
|
|
||||||
|
async def add_by_oauth2(self, db: AsyncSession, obj: AddOAuth2UserParam) -> None:
|
||||||
|
"""
|
||||||
|
通过 OAuth2 添加用户
|
||||||
|
|
||||||
|
:param db: 数据库会话
|
||||||
|
:param obj: 注册用户参数
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
salt = bcrypt.gensalt()
|
||||||
|
obj.password = get_hash_password(obj.password, salt)
|
||||||
|
dict_obj = obj.model_dump()
|
||||||
|
dict_obj.update({'is_staff': True, 'salt': salt})
|
||||||
|
new_user = self.model(**dict_obj)
|
||||||
|
|
||||||
|
stmt = select(Role)
|
||||||
|
role = await db.execute(stmt)
|
||||||
|
new_user.roles = [role.scalars().first()] # 默认绑定第一个角色
|
||||||
|
|
||||||
|
db.add(new_user)
|
||||||
|
|
||||||
async def update(self, db: AsyncSession, input_user: User, obj: UpdateUserParam) -> int:
|
async def update(self, db: AsyncSession, input_user: User, obj: UpdateUserParam) -> int:
|
||||||
"""
|
"""
|
||||||
更新用户信息
|
更新用户信息
|
||||||
@@ -119,6 +119,17 @@ class CRUDUser(CRUDPlus[User]):
|
|||||||
input_user.roles = roles.scalars().all()
|
input_user.roles = roles.scalars().all()
|
||||||
return count
|
return count
|
||||||
|
|
||||||
|
async def update_avatar(self, db: AsyncSession, user_id: int, avatar: str) -> int:
|
||||||
|
"""
|
||||||
|
更新用户头像
|
||||||
|
|
||||||
|
:param db: 数据库会话
|
||||||
|
:param user_id: 用户 ID
|
||||||
|
:param avatar: 头像地址
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
return await self.update_model(db, user_id, {'avatar': avatar})
|
||||||
|
|
||||||
async def delete(self, db: AsyncSession, user_id: int) -> int:
|
async def delete(self, db: AsyncSession, user_id: int) -> int:
|
||||||
"""
|
"""
|
||||||
删除用户
|
删除用户
|
||||||
@@ -131,7 +142,7 @@ class CRUDUser(CRUDPlus[User]):
|
|||||||
|
|
||||||
async def check_email(self, db: AsyncSession, email: str) -> User | None:
|
async def check_email(self, db: AsyncSession, email: str) -> User | None:
|
||||||
"""
|
"""
|
||||||
检查邮箱是否已被注册
|
检查邮箱是否已被绑定
|
||||||
|
|
||||||
:param db: 数据库会话
|
:param db: 数据库会话
|
||||||
:param email: 电子邮箱
|
:param email: 电子邮箱
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from sqlalchemy import ForeignKey, String
|
from sqlalchemy import String
|
||||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
|
|
||||||
|
from backend.app.admin.model.m2m import sys_data_scope_rule
|
||||||
from backend.common.model import Base, id_key
|
from backend.common.model import Base, id_key
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -28,8 +29,5 @@ class DataRule(Base):
|
|||||||
)
|
)
|
||||||
value: Mapped[str] = mapped_column(String(255), comment='规则值')
|
value: Mapped[str] = mapped_column(String(255), comment='规则值')
|
||||||
|
|
||||||
# 数据范围规则一对多
|
# 数据范围规则多对多
|
||||||
scope_id: Mapped[int | None] = mapped_column(
|
scopes: Mapped[list[DataScope]] = relationship(init=False, secondary=sys_data_scope_rule, back_populates='rules')
|
||||||
ForeignKey('sys_data_scope.id', ondelete='SET NULL'), default=None, comment='数据范围关联 ID'
|
|
||||||
)
|
|
||||||
scope: Mapped[DataScope] = relationship(init=False, back_populates='rules')
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING
|
|||||||
from sqlalchemy import String
|
from sqlalchemy import String
|
||||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
|
|
||||||
from backend.app.admin.model.m2m import sys_role_data_scope
|
from backend.app.admin.model.m2m import sys_data_scope_rule, sys_role_data_scope
|
||||||
from backend.common.model import Base, id_key
|
from backend.common.model import Base, id_key
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -23,8 +23,8 @@ class DataScope(Base):
|
|||||||
name: Mapped[str] = mapped_column(String(50), unique=True, comment='名称')
|
name: Mapped[str] = mapped_column(String(50), unique=True, comment='名称')
|
||||||
status: Mapped[int] = mapped_column(default=1, comment='状态(0停用 1正常)')
|
status: Mapped[int] = mapped_column(default=1, comment='状态(0停用 1正常)')
|
||||||
|
|
||||||
# 数据范围规则一对多
|
# 数据范围规则多对多
|
||||||
rules: Mapped[list[DataRule]] = relationship(init=False, back_populates='scope')
|
rules: Mapped[list[DataRule]] = relationship(init=False, secondary=sys_data_scope_rule, back_populates='scopes')
|
||||||
|
|
||||||
# 角色数据范围多对多
|
# 角色数据范围多对多
|
||||||
roles: Mapped[list[Role]] = relationship(init=False, secondary=sys_role_data_scope, back_populates='scopes')
|
roles: Mapped[list[Role]] = relationship(init=False, secondary=sys_role_data_scope, back_populates='scopes')
|
||||||
|
|||||||
@@ -33,3 +33,23 @@ sys_role_data_scope = Table(
|
|||||||
comment='数据范围 ID',
|
comment='数据范围 ID',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
sys_data_scope_rule = Table(
|
||||||
|
'sys_data_scope_rule',
|
||||||
|
MappedBase.metadata,
|
||||||
|
Column('id', INT, primary_key=True, unique=True, index=True, autoincrement=True, comment='主键ID'),
|
||||||
|
Column(
|
||||||
|
'data_scope_id',
|
||||||
|
Integer,
|
||||||
|
ForeignKey('sys_data_scope.id', ondelete='CASCADE'),
|
||||||
|
primary_key=True,
|
||||||
|
comment='数据范围 ID',
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
'data_rule_id',
|
||||||
|
Integer,
|
||||||
|
ForeignKey('sys_data_rule.id', ondelete='CASCADE'),
|
||||||
|
primary_key=True,
|
||||||
|
comment='数据规则 ID',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|||||||
@@ -26,22 +26,22 @@ class User(Base):
|
|||||||
id: Mapped[id_key] = mapped_column(init=False)
|
id: Mapped[id_key] = mapped_column(init=False)
|
||||||
uuid: Mapped[str] = mapped_column(String(50), init=False, default_factory=uuid4_str, unique=True)
|
uuid: Mapped[str] = mapped_column(String(50), init=False, default_factory=uuid4_str, unique=True)
|
||||||
username: Mapped[str] = mapped_column(String(20), unique=True, index=True, comment='用户名')
|
username: Mapped[str] = mapped_column(String(20), unique=True, index=True, comment='用户名')
|
||||||
nickname: Mapped[str] = mapped_column(String(20), unique=True, comment='昵称')
|
nickname: Mapped[str] = mapped_column(String(20), comment='昵称')
|
||||||
password: Mapped[str | None] = mapped_column(String(255), comment='密码')
|
password: Mapped[str] = mapped_column(String(255), comment='密码')
|
||||||
salt: Mapped[bytes | None] = mapped_column(VARBINARY(255).with_variant(BYTEA(255), 'postgresql'), comment='加密盐')
|
salt: Mapped[bytes] = mapped_column(VARBINARY(255).with_variant(BYTEA(255), 'postgresql'), comment='加密盐')
|
||||||
email: Mapped[str] = mapped_column(String(50), unique=True, index=True, comment='邮箱')
|
email: Mapped[str | None] = mapped_column(String(50), default=None, unique=True, index=True, comment='邮箱')
|
||||||
|
phone: Mapped[str | None] = mapped_column(String(11), default=None, comment='手机号')
|
||||||
|
avatar: Mapped[str | None] = mapped_column(String(255), default=None, comment='头像')
|
||||||
|
status: Mapped[int] = mapped_column(default=1, index=True, comment='用户账号状态(0停用 1正常)')
|
||||||
is_superuser: Mapped[bool] = mapped_column(
|
is_superuser: Mapped[bool] = mapped_column(
|
||||||
Boolean().with_variant(INTEGER, 'postgresql'), default=False, comment='超级权限(0否 1是)'
|
Boolean().with_variant(INTEGER, 'postgresql'), default=False, comment='超级权限(0否 1是)'
|
||||||
)
|
)
|
||||||
is_staff: Mapped[bool] = mapped_column(
|
is_staff: Mapped[bool] = mapped_column(
|
||||||
Boolean().with_variant(INTEGER, 'postgresql'), default=False, comment='后台管理登陆(0否 1是)'
|
Boolean().with_variant(INTEGER, 'postgresql'), default=False, comment='后台管理登陆(0否 1是)'
|
||||||
)
|
)
|
||||||
status: Mapped[int] = mapped_column(default=1, index=True, comment='用户账号状态(0停用 1正常)')
|
|
||||||
is_multi_login: Mapped[bool] = mapped_column(
|
is_multi_login: Mapped[bool] = mapped_column(
|
||||||
Boolean().with_variant(INTEGER, 'postgresql'), default=False, comment='是否重复登陆(0否 1是)'
|
Boolean().with_variant(INTEGER, 'postgresql'), default=False, comment='是否重复登陆(0否 1是)'
|
||||||
)
|
)
|
||||||
avatar: Mapped[str | None] = mapped_column(String(255), default=None, comment='头像')
|
|
||||||
phone: Mapped[str | None] = mapped_column(String(11), default=None, comment='手机号')
|
|
||||||
join_time: Mapped[datetime] = mapped_column(
|
join_time: Mapped[datetime] = mapped_column(
|
||||||
DateTime(timezone=True), init=False, default_factory=timezone.now, comment='注册时间'
|
DateTime(timezone=True), init=False, default_factory=timezone.now, comment='注册时间'
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from typing_extensions import Self
|
|||||||
from backend.app.admin.schema.dept import GetDeptDetail
|
from backend.app.admin.schema.dept import GetDeptDetail
|
||||||
from backend.app.admin.schema.role import GetRoleWithRelationDetail
|
from backend.app.admin.schema.role import GetRoleWithRelationDetail
|
||||||
from backend.common.enums import StatusType
|
from backend.common.enums import StatusType
|
||||||
from backend.common.schema import CustomPhoneNumber, SchemaBase
|
from backend.common.schema import CustomEmailStr, CustomPhoneNumber, SchemaBase
|
||||||
|
|
||||||
|
|
||||||
class AuthSchemaBase(SchemaBase):
|
class AuthSchemaBase(SchemaBase):
|
||||||
@@ -25,20 +25,20 @@ class AuthLoginParam(AuthSchemaBase):
|
|||||||
captcha: str = Field(description='验证码')
|
captcha: str = Field(description='验证码')
|
||||||
|
|
||||||
|
|
||||||
class RegisterUserParam(AuthSchemaBase):
|
|
||||||
"""用户注册参数"""
|
|
||||||
|
|
||||||
nickname: str | None = Field(None, description='昵称')
|
|
||||||
email: EmailStr = Field(examples=['user@example.com'], description='邮箱')
|
|
||||||
|
|
||||||
|
|
||||||
class AddUserParam(AuthSchemaBase):
|
class AddUserParam(AuthSchemaBase):
|
||||||
"""添加用户参数"""
|
"""添加用户参数"""
|
||||||
|
|
||||||
dept_id: int = Field(description='部门 ID')
|
dept_id: int = Field(description='部门 ID')
|
||||||
roles: list[int] = Field(description='角色 ID 列表')
|
roles: list[int] = Field(description='角色 ID 列表')
|
||||||
nickname: str | None = Field(None, description='昵称')
|
nickname: str | None = Field(None, description='昵称')
|
||||||
email: EmailStr = Field(examples=['user@example.com'], description='邮箱')
|
|
||||||
|
|
||||||
|
class AddOAuth2UserParam(AuthSchemaBase):
|
||||||
|
"""添加 OAuth2 用户参数"""
|
||||||
|
|
||||||
|
nickname: str | None = Field(None, description='昵称')
|
||||||
|
email: EmailStr = Field(description='邮箱')
|
||||||
|
avatar: HttpUrl | None = Field(None, description='头像地址')
|
||||||
|
|
||||||
|
|
||||||
class ResetPasswordParam(SchemaBase):
|
class ResetPasswordParam(SchemaBase):
|
||||||
@@ -55,9 +55,7 @@ class UserInfoSchemaBase(SchemaBase):
|
|||||||
dept_id: int | None = Field(None, description='部门 ID')
|
dept_id: int | None = Field(None, description='部门 ID')
|
||||||
username: str = Field(description='用户名')
|
username: str = Field(description='用户名')
|
||||||
nickname: str = Field(description='昵称')
|
nickname: str = Field(description='昵称')
|
||||||
avatar: HttpUrl | None = Field(None, description='头像')
|
avatar: HttpUrl | None = Field(None, description='头像地址')
|
||||||
email: EmailStr = Field(examples=['user@example.com'], description='邮箱')
|
|
||||||
phone: CustomPhoneNumber | None = Field(None, description='手机号')
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateUserParam(UserInfoSchemaBase):
|
class UpdateUserParam(UserInfoSchemaBase):
|
||||||
@@ -74,7 +72,8 @@ class GetUserInfoDetail(UserInfoSchemaBase):
|
|||||||
dept_id: int | None = Field(None, description='部门 ID')
|
dept_id: int | None = Field(None, description='部门 ID')
|
||||||
id: int = Field(description='用户 ID')
|
id: int = Field(description='用户 ID')
|
||||||
uuid: str = Field(description='用户 UUID')
|
uuid: str = Field(description='用户 UUID')
|
||||||
avatar: str | None = Field(None, description='头像')
|
email: CustomEmailStr | None = Field(None, description='邮箱')
|
||||||
|
phone: CustomPhoneNumber | None = Field(None, description='手机号')
|
||||||
status: StatusType = Field(StatusType.enable, description='状态')
|
status: StatusType = Field(StatusType.enable, description='状态')
|
||||||
is_superuser: bool = Field(description='是否超级管理员')
|
is_superuser: bool = Field(description='是否超级管理员')
|
||||||
is_staff: bool = Field(description='是否管理员')
|
is_staff: bool = Field(description='是否管理员')
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ from backend.app.admin.crud.crud_user import user_dao
|
|||||||
from backend.app.admin.model import Role, User
|
from backend.app.admin.model import Role, User
|
||||||
from backend.app.admin.schema.user import (
|
from backend.app.admin.schema.user import (
|
||||||
AddUserParam,
|
AddUserParam,
|
||||||
RegisterUserParam,
|
|
||||||
ResetPasswordParam,
|
ResetPasswordParam,
|
||||||
UpdateUserParam,
|
UpdateUserParam,
|
||||||
)
|
)
|
||||||
@@ -27,29 +26,6 @@ from backend.database.redis import redis_client
|
|||||||
class UserService:
|
class UserService:
|
||||||
"""用户服务类"""
|
"""用户服务类"""
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
async def register(*, obj: RegisterUserParam) -> None:
|
|
||||||
"""
|
|
||||||
注册新用户
|
|
||||||
|
|
||||||
:param obj: 用户注册参数
|
|
||||||
:return:
|
|
||||||
"""
|
|
||||||
async with async_db_session.begin() as db:
|
|
||||||
if not obj.password:
|
|
||||||
raise errors.ForbiddenError(msg='密码为空')
|
|
||||||
username = await user_dao.get_by_username(db, obj.username)
|
|
||||||
if username:
|
|
||||||
raise errors.ForbiddenError(msg='用户已注册')
|
|
||||||
obj.nickname = obj.nickname if obj.nickname else f'#{random.randrange(10000, 88888)}'
|
|
||||||
nickname = await user_dao.get_by_nickname(db, obj.nickname)
|
|
||||||
if nickname:
|
|
||||||
raise errors.ForbiddenError(msg='昵称已注册')
|
|
||||||
email = await user_dao.check_email(db, obj.email)
|
|
||||||
if email:
|
|
||||||
raise errors.ForbiddenError(msg='邮箱已注册')
|
|
||||||
await user_dao.create(db, obj)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
async def add(*, request: Request, obj: AddUserParam) -> None:
|
async def add(*, request: Request, obj: AddUserParam) -> None:
|
||||||
"""
|
"""
|
||||||
@@ -70,9 +46,6 @@ class UserService:
|
|||||||
raise errors.ForbiddenError(msg='昵称已注册')
|
raise errors.ForbiddenError(msg='昵称已注册')
|
||||||
if not obj.password:
|
if not obj.password:
|
||||||
raise errors.ForbiddenError(msg='密码为空')
|
raise errors.ForbiddenError(msg='密码为空')
|
||||||
email = await user_dao.check_email(db, obj.email)
|
|
||||||
if email:
|
|
||||||
raise errors.ForbiddenError(msg='邮箱已注册')
|
|
||||||
dept = await dept_dao.get(db, obj.dept_id)
|
dept = await dept_dao.get(db, obj.dept_id)
|
||||||
if not dept:
|
if not dept:
|
||||||
raise errors.NotFoundError(msg='部门不存在')
|
raise errors.NotFoundError(msg='部门不存在')
|
||||||
@@ -175,10 +148,6 @@ class UserService:
|
|||||||
nickname = await user_dao.get_by_nickname(db, obj.nickname)
|
nickname = await user_dao.get_by_nickname(db, obj.nickname)
|
||||||
if nickname:
|
if nickname:
|
||||||
raise errors.ForbiddenError(msg='昵称已注册')
|
raise errors.ForbiddenError(msg='昵称已注册')
|
||||||
if user.email != obj.email:
|
|
||||||
email = await user_dao.check_email(db, obj.email)
|
|
||||||
if email:
|
|
||||||
raise errors.ForbiddenError(msg='邮箱已注册')
|
|
||||||
for role_id in obj.roles:
|
for role_id in obj.roles:
|
||||||
role = await role_dao.get(db, role_id)
|
role = await role_dao.get(db, role_id)
|
||||||
if not role:
|
if not role:
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class GatewayError(BaseExceptionMixin):
|
|||||||
class AuthorizationError(BaseExceptionMixin):
|
class AuthorizationError(BaseExceptionMixin):
|
||||||
"""授权异常"""
|
"""授权异常"""
|
||||||
|
|
||||||
code = StandardResponseCode.HTTP_401
|
code = StandardResponseCode.HTTP_403
|
||||||
|
|
||||||
def __init__(self, *, msg: str = 'Permission Denied', data: Any = None, background: BackgroundTask | None = None):
|
def __init__(self, *, msg: str = 'Permission Denied', data: Any = None, background: BackgroundTask | None = None):
|
||||||
super().__init__(msg=msg, data=data, background=background)
|
super().__init__(msg=msg, data=data, background=background)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Settings(BaseSettings):
|
|||||||
# FastAPI
|
# FastAPI
|
||||||
FASTAPI_API_V1_PATH: str = '/api/v1'
|
FASTAPI_API_V1_PATH: str = '/api/v1'
|
||||||
FASTAPI_TITLE: str = 'FastAPI'
|
FASTAPI_TITLE: str = 'FastAPI'
|
||||||
FASTAPI_VERSION: str = '0.0.1'
|
FASTAPI_VERSION: str = '1.5.0'
|
||||||
FASTAPI_DESCRIPTION: str = 'FastAPI Best Architecture'
|
FASTAPI_DESCRIPTION: str = 'FastAPI Best Architecture'
|
||||||
FASTAPI_DOCS_URL: str = '/docs'
|
FASTAPI_DOCS_URL: str = '/docs'
|
||||||
FASTAPI_REDOC_URL: str = '/redoc'
|
FASTAPI_REDOC_URL: str = '/redoc'
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ async def generate_path(pk: Annotated[int, Path(description='业务 ID')]) -> Re
|
|||||||
summary='代码生成',
|
summary='代码生成',
|
||||||
description='文件磁盘写入,请谨慎操作',
|
description='文件磁盘写入,请谨慎操作',
|
||||||
dependencies=[
|
dependencies=[
|
||||||
Depends(RequestPermission('gen:code:generate')),
|
Depends(RequestPermission('gen:code:write')),
|
||||||
DependsRBAC,
|
DependsRBAC,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -44,4 +44,6 @@ async def github_login(
|
|||||||
user=user,
|
user=user,
|
||||||
social=UserSocialType.github,
|
social=UserSocialType.github,
|
||||||
)
|
)
|
||||||
return RedirectResponse(url=f'{settings.OAUTH2_FRONTEND_REDIRECT_URI}?access_token={data.access_token}')
|
return RedirectResponse(
|
||||||
|
url=f'{settings.OAUTH2_FRONTEND_REDIRECT_URI}?access_token={data.access_token}&session_uuid={data.session_uuid}'
|
||||||
|
)
|
||||||
|
|||||||
@@ -47,4 +47,6 @@ async def linux_do_login(
|
|||||||
user=user,
|
user=user,
|
||||||
social=UserSocialType.linux_do,
|
social=UserSocialType.linux_do,
|
||||||
)
|
)
|
||||||
return RedirectResponse(url=f'{settings.OAUTH2_FRONTEND_REDIRECT_URI}?access_token={data.access_token}')
|
return RedirectResponse(
|
||||||
|
url=f'{settings.OAUTH2_FRONTEND_REDIRECT_URI}?access_token={data.access_token}&session_uuid={data.session_uuid}'
|
||||||
|
)
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ from backend.plugin.oauth2.schema.user_social import CreateUserSocialParam
|
|||||||
class CRUDUserSocial(CRUDPlus[UserSocial]):
|
class CRUDUserSocial(CRUDPlus[UserSocial]):
|
||||||
"""用户社交账号数据库操作类"""
|
"""用户社交账号数据库操作类"""
|
||||||
|
|
||||||
async def get(self, db: AsyncSession, pk: int, source: str) -> UserSocial | None:
|
async def check_binding(self, db: AsyncSession, pk: int, source: str) -> UserSocial | None:
|
||||||
"""
|
"""
|
||||||
获取用户社交账号绑定详情
|
检查系统用户社交账号绑定
|
||||||
|
|
||||||
:param db: 数据库会话
|
:param db: 数据库会话
|
||||||
:param pk: 用户 ID
|
:param pk: 用户 ID
|
||||||
@@ -21,6 +21,17 @@ class CRUDUserSocial(CRUDPlus[UserSocial]):
|
|||||||
"""
|
"""
|
||||||
return await self.select_model_by_column(db, user_id=pk, source=source)
|
return await self.select_model_by_column(db, user_id=pk, source=source)
|
||||||
|
|
||||||
|
async def get_by_sid(self, db: AsyncSession, sid: str, source: str) -> UserSocial | None:
|
||||||
|
"""
|
||||||
|
通过 UUID 获取社交用户
|
||||||
|
|
||||||
|
:param db: 数据库会话
|
||||||
|
:param sid: 第三方 UUID
|
||||||
|
:param source: 社交账号类型
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
return await self.select_model_by_column(db, sid=sid, source=source)
|
||||||
|
|
||||||
async def create(self, db: AsyncSession, obj: CreateUserSocialParam) -> None:
|
async def create(self, db: AsyncSession, obj: CreateUserSocialParam) -> None:
|
||||||
"""
|
"""
|
||||||
创建用户社交账号绑定
|
创建用户社交账号绑定
|
||||||
|
|||||||
@@ -19,15 +19,9 @@ class UserSocial(Base):
|
|||||||
__tablename__ = 'sys_user_social'
|
__tablename__ = 'sys_user_social'
|
||||||
|
|
||||||
id: Mapped[id_key] = mapped_column(init=False)
|
id: Mapped[id_key] = mapped_column(init=False)
|
||||||
|
sid: Mapped[str] = mapped_column(String(20), comment='第三方用户 ID')
|
||||||
source: Mapped[str] = mapped_column(String(20), comment='第三方用户来源')
|
source: Mapped[str] = mapped_column(String(20), comment='第三方用户来源')
|
||||||
open_id: Mapped[str | None] = mapped_column(String(20), default=None, comment='第三方用户 open id')
|
|
||||||
sid: Mapped[str | None] = mapped_column(String(20), default=None, comment='第三方用户 ID')
|
|
||||||
union_id: Mapped[str | None] = mapped_column(String(20), default=None, comment='第三方用户 union id')
|
|
||||||
scope: Mapped[str | None] = mapped_column(String(120), default=None, comment='第三方用户授予的权限')
|
|
||||||
code: Mapped[str | None] = mapped_column(String(50), default=None, comment='用户的授权 code')
|
|
||||||
|
|
||||||
# 用户社交信息一对多
|
# 用户社交信息一对多
|
||||||
user_id: Mapped[int | None] = mapped_column(
|
user_id: Mapped[int] = mapped_column(ForeignKey('sys_user.id', ondelete='CASCADE'), comment='用户关联ID')
|
||||||
ForeignKey('sys_user.id', ondelete='SET NULL'), default=None, comment='用户关联ID'
|
|
||||||
)
|
|
||||||
user: Mapped[User | None] = relationship(init=False, backref='socials')
|
user: Mapped[User | None] = relationship(init=False, backref='socials')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[plugin]
|
[plugin]
|
||||||
summary = 'OAuth 2.0'
|
summary = 'OAuth 2.0'
|
||||||
version = '0.0.1'
|
version = '0.0.3'
|
||||||
description = '通过 OAuth 2.0 的方式登录系统'
|
description = '通过 OAuth 2.0 的方式登录系统'
|
||||||
author = 'wu-clan'
|
author = 'wu-clan'
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,8 @@ from backend.common.schema import SchemaBase
|
|||||||
class UserSocialSchemaBase(SchemaBase):
|
class UserSocialSchemaBase(SchemaBase):
|
||||||
"""用户社交基础模型"""
|
"""用户社交基础模型"""
|
||||||
|
|
||||||
|
sid: str = Field(description='第三方用户 ID')
|
||||||
source: UserSocialType = Field(description='社交平台')
|
source: UserSocialType = Field(description='社交平台')
|
||||||
open_id: str | None = Field(None, description='开放平台 ID')
|
|
||||||
sid: str | None = Field(None, description='第三方用户 ID')
|
|
||||||
union_id: str | None = Field(None, description='开放平台唯一 ID')
|
|
||||||
scope: str | None = Field(None, description='授权范围')
|
|
||||||
code: str | None = Field(None, description='授权码')
|
|
||||||
|
|
||||||
|
|
||||||
class CreateUserSocialParam(UserSocialSchemaBase):
|
class CreateUserSocialParam(UserSocialSchemaBase):
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ from fastapi import BackgroundTasks, Request, Response
|
|||||||
|
|
||||||
from backend.app.admin.crud.crud_user import user_dao
|
from backend.app.admin.crud.crud_user import user_dao
|
||||||
from backend.app.admin.schema.token import GetLoginToken
|
from backend.app.admin.schema.token import GetLoginToken
|
||||||
from backend.app.admin.schema.user import RegisterUserParam
|
from backend.app.admin.schema.user import AddOAuth2UserParam
|
||||||
from backend.app.admin.service.login_log_service import login_log_service
|
from backend.app.admin.service.login_log_service import login_log_service
|
||||||
from backend.common.enums import LoginLogStatusType, UserSocialType
|
from backend.common.enums import LoginLogStatusType, UserSocialType
|
||||||
from backend.common.exception.errors import AuthorizationError
|
|
||||||
from backend.common.security import jwt
|
from backend.common.security import jwt
|
||||||
from backend.core.conf import settings
|
from backend.core.conf import settings
|
||||||
from backend.database.db import async_db_session
|
from backend.database.db import async_db_session
|
||||||
@@ -43,55 +42,65 @@ class OAuth2Service:
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
async with async_db_session.begin() as db:
|
async with async_db_session.begin() as db:
|
||||||
# 获取 OAuth2 平台用户信息
|
sid = user.get('uuid')
|
||||||
social_id = user.get('id')
|
username = user.get('username')
|
||||||
social_nickname = user.get('name')
|
nickname = user.get('nickname')
|
||||||
|
email = user.get('email')
|
||||||
|
avatar = user.get('avatar_url')
|
||||||
|
|
||||||
social_username = user.get('username')
|
|
||||||
if social == UserSocialType.github:
|
if social == UserSocialType.github:
|
||||||
social_username = user.get('login')
|
sid = user.get('id')
|
||||||
|
username = user.get('login')
|
||||||
|
nickname = user.get('name')
|
||||||
|
|
||||||
social_email = user.get('email')
|
|
||||||
if social == UserSocialType.linux_do:
|
if social == UserSocialType.linux_do:
|
||||||
social_email = f'{social_username}@linux.do'
|
sid = user.get('id')
|
||||||
if not social_email:
|
nickname = user.get('name')
|
||||||
raise AuthorizationError(msg=f'授权失败,{social.value} 账户未绑定邮箱')
|
|
||||||
|
|
||||||
# 创建系统用户
|
sys_user = None
|
||||||
sys_user = await user_dao.check_email(db, social_email)
|
user_social = await user_social_dao.get_by_sid(db, str(sid), str(social.value))
|
||||||
if not sys_user:
|
|
||||||
sys_user = await user_dao.get_by_username(db, social_username)
|
|
||||||
if sys_user:
|
|
||||||
social_username = f'{social_username}#{text_captcha(5)}'
|
|
||||||
sys_user = await user_dao.get_by_nickname(db, social_nickname)
|
|
||||||
if sys_user:
|
|
||||||
social_username = f'{social_nickname}#{text_captcha(5)}'
|
|
||||||
new_sys_user = RegisterUserParam(
|
|
||||||
username=social_username, password=None, nickname=social_username, email=social_email
|
|
||||||
)
|
|
||||||
await user_dao.create(db, new_sys_user, social=True)
|
|
||||||
await db.flush()
|
|
||||||
sys_user = await user_dao.check_email(db, social_email)
|
|
||||||
# 绑定社交用户
|
|
||||||
sys_user_id = sys_user.id
|
|
||||||
user_social = await user_social_dao.get(db, sys_user_id, social.value)
|
|
||||||
if not user_social:
|
if not user_social:
|
||||||
new_user_social = CreateUserSocialParam(source=social.value, sid=str(social_id), user_id=sys_user_id)
|
if email:
|
||||||
await user_social_dao.create(db, new_user_social)
|
sys_user = await user_dao.check_email(db, email)
|
||||||
|
|
||||||
|
# 创建系统用户
|
||||||
|
if not sys_user:
|
||||||
|
while await user_dao.get_by_username(db, username):
|
||||||
|
username = f'{username}_{text_captcha(5)}'
|
||||||
|
new_sys_user = AddOAuth2UserParam(
|
||||||
|
username=username,
|
||||||
|
password='123456', # 默认密码,可修改系统用户表进行默认密码检测并配合前端进行修改密码提示
|
||||||
|
nickname=nickname,
|
||||||
|
email=email,
|
||||||
|
avatar=avatar,
|
||||||
|
)
|
||||||
|
await user_dao.add_by_oauth2(db, new_sys_user)
|
||||||
|
await db.flush()
|
||||||
|
sys_user = await user_dao.get_by_username(db, username)
|
||||||
|
|
||||||
|
# 绑定社交用户
|
||||||
|
new_user_social = CreateUserSocialParam(sid=str(sid), source=social.value, user_id=sys_user.id)
|
||||||
|
await user_social_dao.create(db, new_user_social)
|
||||||
|
|
||||||
|
if not sys_user:
|
||||||
|
sys_user = await user_dao.get(db, user_social.user_id)
|
||||||
|
if avatar:
|
||||||
|
await user_dao.update_avatar(db, sys_user.id, avatar)
|
||||||
|
|
||||||
# 创建 token
|
# 创建 token
|
||||||
access_token = await jwt.create_access_token(
|
access_token = await jwt.create_access_token(
|
||||||
str(sys_user_id),
|
str(sys_user.id),
|
||||||
sys_user.is_multi_login,
|
sys_user.is_multi_login,
|
||||||
# extra info
|
# extra info
|
||||||
username=sys_user.username,
|
username=sys_user.username,
|
||||||
nickname=sys_user.nickname,
|
nickname=sys_user.nickname or f'#{text_captcha(5)}',
|
||||||
last_login_time=timezone.t_str(timezone.now()),
|
last_login_time=timezone.t_str(timezone.now()),
|
||||||
ip=request.state.ip,
|
ip=request.state.ip,
|
||||||
os=request.state.os,
|
os=request.state.os,
|
||||||
browser=request.state.browser,
|
browser=request.state.browser,
|
||||||
device=request.state.device,
|
device=request.state.device,
|
||||||
)
|
)
|
||||||
refresh_token = await jwt.create_refresh_token(str(sys_user_id), multi_login=sys_user.is_multi_login)
|
refresh_token = await jwt.create_refresh_token(str(sys_user.id), multi_login=sys_user.is_multi_login)
|
||||||
await user_dao.update_login_time(db, sys_user.username)
|
await user_dao.update_login_time(db, sys_user.username)
|
||||||
await db.refresh(sys_user)
|
await db.refresh(sys_user)
|
||||||
login_log = dict(
|
login_log = dict(
|
||||||
@@ -115,8 +124,8 @@ class OAuth2Service:
|
|||||||
data = GetLoginToken(
|
data = GetLoginToken(
|
||||||
access_token=access_token.access_token,
|
access_token=access_token.access_token,
|
||||||
access_token_expire_time=access_token.access_token_expire_time,
|
access_token_expire_time=access_token.access_token_expire_time,
|
||||||
user=sys_user, # type: ignore
|
|
||||||
session_uuid=access_token.session_uuid,
|
session_uuid=access_token.session_uuid,
|
||||||
|
user=sys_user, # type: ignore
|
||||||
)
|
)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
@@ -1,38 +1,112 @@
|
|||||||
insert into sys_dept (id, name, sort, leader, phone, email, status, del_flag, parent_id, created_time, updated_time)
|
insert into sys_dept (id, name, sort, leader, phone, email, status, del_flag, parent_id, created_time, updated_time)
|
||||||
values (1, 'test', 0, null, null, null, 1, 0, null, '2023-06-26 17:13:45', null);
|
values (1, '测试', 0, null, null, null, 1, 0, null, '2025-05-26 17:13:45', null);
|
||||||
|
|
||||||
insert into fba.sys_menu (id, title, name, path, sort, icon, type, component, perms, status, display, cache, link, remark, parent_id, created_time, updated_time)
|
insert into sys_menu (id, title, name, path, sort, icon, type, component, perms, status, display, cache, link, remark, parent_id, created_time, updated_time)
|
||||||
values (1, '测试', 'Test', 'test', 0, null, 0, null, null, 0, 0, 0, null, null, null, '2023-07-27 19:14:10', null),
|
values (1, '概览', 'Dashboard', 'dashboard', 0, 'ant-design:dashboard-outlined', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:26:18', null),
|
||||||
(2, '仪表盘', 'Dashboard', 'dashboard', 0, 'material-symbols:dashboard', 0, null, null, 1, 1, 0, null, null, null, '2023-07-27 19:15:45', null),
|
(2, '系统管理', 'System', 'system', 1, 'eos-icons:admin', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:30:01', null),
|
||||||
(3, '工作台', 'Workspace', 'workspace', 0, null, 1, '/dashboard/workspace/index.vue', null, 1, 1, 1, null, null, 2, '2023-07-27 19:17:59', null),
|
(3, '系统自动化', 'Automation', 'automation', 2, 'material-symbols:automation', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:31:41', null),
|
||||||
(4, '数据分析', 'Analytics', 'analytics', 0, null, 1, '/dashboard/analytics/index.vue', null, 1, 1, 1, null, null, 2, '2023-07-27 19:17:59', null),
|
(4, '日志管理', 'Log', 'log', 3, 'carbon:cloud-logging', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:32:34', null),
|
||||||
(5, '系统管理', 'System', 'system', 0, 'eos-icons:admin', 0, null, null, 1, 1, 0, null, null, null, '2023-07-27 19:23:00', null),
|
(5, '系统监控', 'Monitor', 'monitor', 4, 'mdi:monitor-eye', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:33:29', null),
|
||||||
(6, '部门管理', 'SysDept', 'sys-dept', 0, null, 1, '/system/dept/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:23:42', null),
|
(6, '项目', 'Project', 'fba', 5, 'https://wu-clan.github.io/picx-images-hosting/logo/fba.png', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:35:41', null),
|
||||||
(7, '用户管理', 'SysUser', 'sys-user', 0, null, 1, '/system/user/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:25:13', null),
|
(7, '分析页', 'Analytics', 'analytics', 0, 'lucide:area-chart', 1, '/dashboard/analytics/index', null, 1, 1, 1, '', null, 1, '2025-06-09 17:54:29', null),
|
||||||
(8, '角色管理', 'SysRole', 'sys-role', 0, null, 1, '/system/role/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:25:45', null),
|
(8, '工作台', 'Workspace', 'workspace', 1, 'carbon:workspace', 1, '/dashboard/workspace/index', null, 1, 1, 1, '', null, 1, '2025-06-09 17:57:09', null),
|
||||||
(9, '菜单管理', 'SysMenu', 'sys-menu', 0, null, 1, '/system/menu/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:45:29', null),
|
(9, '文档', 'Document', null, 1, 'lucide:book-open-text', 4, null, null, 1, 1, 1, 'https://fastapi-practices.github.io/fastapi_best_architecture_docs', null, 6, '2025-06-09 17:59:44', null),
|
||||||
(10, '插件管理', 'SysPlugin', 'sys-plugin', 0, null, 1, '/system/plugin/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:24:12', null),
|
(10, 'Github', 'Github', null, 2, 'ant-design:github-filled', 4, null, null, 1, 1, 1, 'https://github.com/fastapi-practices/fastapi_best_architecture', null, 6, '2025-06-09 18:00:50', null),
|
||||||
(11, '数据权限', 'SysDataPermission', 'sys-data-permission', 0, null, 1, '/system/data-permission/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:24:12', null),
|
(11, 'Apifox', 'Apifox', 'apifox', 3, 'simple-icons:apifox', 3, null, null, 1, 1, 1, 'https://apifox.com/apidoc/shared-28a93f02-730b-4f33-bb5e-4dad92058cc0', null, 6, '2025-06-09 18:01:39', null),
|
||||||
(12, '系统自动化', 'Automation', 'automation', 0, 'material-symbols:automation', 0, null, null, 1, 1, 0, null, null, null, '2024-07-27 02:06:20', null),
|
(12, '部门管理', 'SysDept', 'sys-dept', 1, 'mingcute:department-line', 1, '/system/dept/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:03:17', null),
|
||||||
(13, '代码生成', 'CodeGenerator', 'code-generator', 0, null, 1, '/automation/code-generator/index.vue', null, 1, 1, 1, null, null, 12, '2024-07-27 12:24:54', null),
|
(13, '用户管理', 'SysUser', 'sys-user', 2, 'ant-design:user-outlined', 1, '/system/user/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:03:54', null),
|
||||||
(14, '系统监控', 'Monitor', 'monitor', 0, 'mdi:monitor-eye', 0, null, null, 1, 1, 0, null, null, null, '2023-07-27 19:27:08', null),
|
(14, '角色管理', 'SysRole', 'sys-role', 3, 'carbon:user-role', 1, '/system/role/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:04:47', null),
|
||||||
(15, 'Redis 监控', 'Redis', 'redis', 0, null, 1, '/monitor/redis/index.vue', null, 1, 1, 1, null, null, 14, '2023-07-27 19:28:03', null),
|
(15, '菜单管理', 'SysMenu', 'sys-menu', 4, 'ant-design:menu-outlined', 1, '/system/menu/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:05:31', null),
|
||||||
(16, '服务器监控', 'Server', 'server', 0, null, 1, '/monitor/server/index.vue', null, 1, 1, 1, null, null, 14, '2023-07-27 19:28:29', null),
|
(16, '数据权限', 'SysDataPermission', 'sys-data-permission', 5, 'icon-park-outline:permissions', 0, null, null, 1, 1, 1, '', null, 2, '2025-06-09 18:07:04', null),
|
||||||
(17, '日志', 'Log', 'log', 0, 'carbon:cloud-logging', 0, null, null, 1, 1, 0, null, null, null, '2023-07-27 19:19:59', null),
|
(17, '数据范围', 'SysDataScope', 'sys-data-scope', 6, 'cuida:scope-outline', 1, '/system/data-permission/scope/index', null, 1, 1, 1, '', null, 16, '2025-06-09 18:07:46', null),
|
||||||
(18, '登录日志', 'Login', 'login', 0, null, 1, '/log/login/index.vue', null, 1, 1, 1, null, null, 17, '2023-07-27 19:20:56', null),
|
(18, '数据规则', 'SysDataRule', 'sys-data-rule', 7, 'material-symbols:rule', 1, '/system/data-permission/rule/index', null, 1, 1, 1, '', null, 16, '2025-06-09 18:08:22', null),
|
||||||
(19, '操作日志', 'Opera', 'opera', 0, null, 1, '/log/opera/index.vue', null, 1, 1, 1, null, null, 17, '2023-07-27 19:21:28', null),
|
(19, '插件管理', 'SysPlugin', 'sys-plugin', 8, 'clarity:plugin-line', 1, '/system/plugin/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:09:12', null),
|
||||||
(20, 'Apifox', 'Apifox', 'apifox', 997, 'simple-icons:apifox', 3, null, null, 1, 1, 0, 'https://apifox.com/apidoc/shared-28a93f02-730b-4f33-bb5e-4dad92058cc0', null, null, '2024-05-22 16:27:00', null),
|
(20, '参数管理', 'SysConfig', 'sys-config', 9, 'codicon:symbol-parameter', 1, '/system/config/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:10:20', null),
|
||||||
(21, '官网', 'Site', '', 998, 'dashicons:admin-site', 4, null, null, 1, 1, 0, 'https://fastapi-practices.github.io/fastapi_best_architecture_docs/', null, null, '2024-07-27 19:22:24', null),
|
(21, '字典管理', 'SysDict', 'sys-dict', 10, 'fluent-mdl2:dictionary', 1, '/system/dict/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:11:10', null),
|
||||||
(22, '赞助', 'Sponsor', '', 999, 'material-icon-theme:github-sponsors', 4, null, null, 1, 1, 0, 'https://wu-clan.github.io/sponsor/', null, null, '2024-07-27 12:39:57', null);
|
(22, '通知公告', 'SysNotice', 'sys-notice', 11, 'fe:notice-push', 1, '/system/notice/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:11:38', null),
|
||||||
|
(23, '代码生成', 'CodeGenerator', 'code-generator', 1, 'tabler:code', 1, '/automation/code-generator/index', null, 1, 1, 1, '', null, 3, '2025-06-09 18:12:38', null),
|
||||||
|
(24, '任务调度', 'Scheduler', 'scheduler', 2, 'ix:scheduler', 1, '/automation/scheduler/index', null, 1, 1, 1, '', null, 3, '2025-06-09 18:13:19', null),
|
||||||
|
(25, '登录日志', 'LoginLog', 'login', 1, 'mdi:login', 1, '/log/login/index', null, 1, 1, 1, '', null, 4, '2025-06-09 18:14:35', null),
|
||||||
|
(26, '操作日志', 'OperaLog', 'opera', 2, 'carbon:operations-record', 1, '/log/opera/index', null, 1, 1, 1, '', null, 4, '2025-06-09 18:15:26', null),
|
||||||
|
(27, '在线用户', 'Online', 'online', 1, 'wpf:online', 1, '/monitor/online/index', null, 1, 1, 1, '', null, 5, '2025-06-09 18:17:12', null),
|
||||||
|
(28, 'Redis', 'Redis', 'redis', 2, 'devicon:redis', 1, '/monitor/redis/index', null, 1, 1, 1, '', null, 5, '2025-06-09 18:17:42', null),
|
||||||
|
(29, 'Server', 'Server', 'server', 3, 'mdi:server-outline', 1, '/monitor/server/index', null, 1, 1, 1, '', null, 5, '2025-06-09 18:18:12', null),
|
||||||
|
(30, '新增', 'AddSysDept', null, 0, null, 2, null, 'sys:dept:add', 1, 0, 1, '', null, 12, '2025-06-09 18:21:17', null),
|
||||||
|
(31, '修改', 'EditSysDept', null, 0, null, 2, null, 'sys:dept:edit', 1, 0, 1, '', null, 12, '2025-06-09 18:22:01', null),
|
||||||
|
(32, '删除', 'DeleteSysDept', null, 0, null, 2, null, 'sys:dept:del', 1, 0, 1, '', null, 12, '2025-06-09 18:22:39', null),
|
||||||
|
(33, '删除', 'DeleteSysUser', null, 0, null, 2, null, 'sys:user:del', 1, 0, 1, '', null, 13, '2025-06-09 18:24:09', null),
|
||||||
|
(34, '新增', 'AddSysRole', null, 0, null, 2, null, 'sys:role:add', 1, 0, 1, '', null, 14, '2025-06-09 18:25:08', null),
|
||||||
|
(35, '修改', 'EditSysRole', null, 0, null, 2, null, 'sys:role:edit', 1, 0, 1, '', null, 14, '2025-06-09 18:26:30', null),
|
||||||
|
(36, '修改角色菜单', 'EditSysRoleMenu', null, 0, null, 2, null, 'sys:role:menu:edit', 1, 0, 1, '', null, 14, '2025-06-09 18:27:24', null),
|
||||||
|
(37, '修改角色数据范围', 'EditSysRoleScope', null, 0, null, 2, null, 'sys:role:scope:edit', 1, 0, 1, '', null, 14, '2025-06-09 18:28:25', null),
|
||||||
|
(38, '删除', 'DeleteSysRole', null, 0, null, 2, null, 'sys:role:del', 1, 0, 1, '', null, 14, '2025-06-09 18:28:55', null),
|
||||||
|
(39, '新增', 'AddSysMenu', null, 0, null, 2, null, 'sys:menu:add', 1, 0, 1, '', null, 15, '2025-06-09 18:29:51', null),
|
||||||
|
(40, '修改', 'EditSysMenu', null, 0, null, 2, null, 'sys:menu:edit', 1, 0, 1, '', null, 15, '2025-06-09 18:30:13', null),
|
||||||
|
(41, '删除', 'DeleteSysMenu', null, 0, null, 2, null, 'sys:menu:del', 1, 0, 1, '', null, 15, '2025-06-09 18:30:37', null),
|
||||||
|
(42, '新增', 'AddSysDataScope', null, 0, null, 2, null, 'data:scope:add', 1, 0, 1, '', null, 17, '2025-06-09 18:31:11', null),
|
||||||
|
(43, '修改', 'EditSysDataScope', null, 0, null, 2, null, 'data:scope:edit', 1, 0, 1, '', null, 17, '2025-06-09 18:31:42', null),
|
||||||
|
(44, '修改数据范围规则', 'EditDataScopeRule', null, 0, null, 2, null, 'data:scope:rule:edit', 1, 0, 1, '', null, 17, '2025-06-09 18:32:36', null),
|
||||||
|
(45, '删除', 'DeleteSysDataScope', null, 0, null, 2, null, 'data:scope:del', 1, 0, 1, '', null, 17, '2025-06-09 18:33:09', null),
|
||||||
|
(46, '新增', 'AddSysDataRule', null, 0, null, 2, null, 'data:rule:add', 1, 0, 1, '', null, 18, '2025-06-09 18:35:54', null),
|
||||||
|
(47, '修改', 'EditSysDataRule', null, 0, null, 2, null, 'data:rule:edit', 1, 0, 1, '', null, 18, '2025-06-09 18:36:19', null),
|
||||||
|
(48, '删除', 'DeleteSysDataRule', null, 0, null, 2, null, 'data:rule:del', 1, 0, 1, '', null, 18, '2025-06-09 18:36:44', null),
|
||||||
|
(49, '安装zip插件', 'InstallZipSysPlugin', null, 0, null, 2, null, 'sys:plugin:zip', 1, 0, 1, '', null, 19, '2025-06-09 18:38:14', null),
|
||||||
|
(50, '安装git插件', 'InstallGitSysPlugin', null, 0, null, 2, null, 'sys:plugin:git', 1, 0, 1, '', null, 19, '2025-06-09 18:38:43', null),
|
||||||
|
(51, '卸载', 'UninstallSysPlugin', null, 0, null, 2, null, 'sys:plugin:del', 1, 0, 1, '', null, 19, '2025-06-09 18:39:08', null),
|
||||||
|
(52, '修改', 'EditSysPlugin', null, 0, null, 2, null, 'sys:plugin:status', 1, 0, 1, '', null, 19, '2025-06-09 18:39:47', null),
|
||||||
|
(53, '新增网站参数', 'AddWebsiteSysConfig', null, 0, null, 2, null, 'sys:config:website:add', 1, 0, 1, '', null, 20, '2025-06-09 18:43:30', null),
|
||||||
|
(54, '新增用户协议', 'AddProtocolSysConfig', null, 0, null, 2, null, 'sys:config:protocol:add', 1, 0, 1, '', null, 20, '2025-06-09 18:44:13', null),
|
||||||
|
(55, '新增用户政策', 'AddPolicySysConfig', null, 0, null, 2, null, 'sys:config:policy:add', 1, 0, 1, '', null, 20, '2025-06-09 18:45:28', null),
|
||||||
|
(56, '新增', 'AddSysConfig', null, 0, null, 2, null, 'sys:config:add', 1, 0, 1, '', null, 20, '2025-06-09 18:45:52', null),
|
||||||
|
(57, '修改', 'EditSysConfig', null, 0, null, 2, null, 'sys:config:edit', 1, 0, 1, '', null, 20, '2025-06-09 18:46:13', null),
|
||||||
|
(58, '删除', 'DeleteSysConfig', null, 0, null, 2, null, 'sys:config:del', 1, 0, 1, '', null, 20, '2025-06-09 18:46:36', null),
|
||||||
|
(59, '新增类型', 'AddSysDictType', null, 0, null, 2, null, 'sys:dict:type:add', 1, 0, 1, '', null, 21, '2025-06-09 18:48:17', null),
|
||||||
|
(60, '修改类型', 'EditSysDictType', null, 0, null, 2, null, 'sys:dict:type:edit', 1, 0, 1, '', null, 21, '2025-06-09 18:48:49', null),
|
||||||
|
(61, '删除类型', 'DeleteSysDictType', null, 0, null, 2, null, 'sys:dict:type:del', 1, 0, 1, '', null, 21, '2025-06-09 18:49:23', null),
|
||||||
|
(62, '新增', 'AddSysDictData', null, 0, null, 2, null, 'sys:dict:data:add', 1, 0, 1, '', null, 21, '2025-06-09 18:50:01', null),
|
||||||
|
(63, '修改', 'EditSysDictData', null, 0, null, 2, null, 'sys:dict:data:edit', 1, 0, 1, '', null, 21, '2025-06-09 18:50:26', null),
|
||||||
|
(64, '删除', 'DeleteSysDictData', null, 0, null, 2, null, 'sys:dict:data:del', 1, 0, 1, '', null, 21, '2025-06-09 18:50:48', null),
|
||||||
|
(65, '新增', 'AddSysNotice', null, 0, null, 2, null, 'sys:notice:add', 1, 0, 1, '', null, 22, '2025-06-09 18:51:22', null),
|
||||||
|
(66, '修改', 'EditSysNotice', null, 0, null, 2, null, 'sys:notice:edit', 1, 0, 1, '', null, 22, '2025-06-09 18:51:45', null),
|
||||||
|
(67, '删除', 'DeleteSysNotice', null, 0, null, 2, null, 'sys:notice:del', 1, 0, 1, '', null, 22, '2025-06-09 18:52:10', null),
|
||||||
|
(68, '新增业务', 'AddSysGenCodeBusiness', null, 0, null, 2, null, 'gen:code:business:add', 1, 0, 1, '', null, 23, '2025-06-09 18:53:07', null),
|
||||||
|
(69, '修改业务', 'EditGenCodeBusiness', null, 0, null, 2, null, 'gen:code:business:edit', 1, 0, 1, '', null, 23, '2025-06-09 18:53:45', null),
|
||||||
|
(70, '删除业务', 'DeleteGenCodeBusiness', null, 0, null, 2, null, 'gen:code:business:del', 1, 0, 1, '', null, 23, '2025-06-09 18:54:11', null),
|
||||||
|
(71, '新增模型', 'AddGenCodeModel', null, 0, null, 2, null, 'gen:code:model:add', 1, 0, 1, '', null, 23, '2025-06-09 18:54:45', null),
|
||||||
|
(72, '修改模型', 'EditGenCodeModel', null, 0, null, 2, null, 'gen:code:model:edit', 1, 0, 1, '', null, 23, '2025-06-09 18:55:08', null),
|
||||||
|
(73, '删除模型', 'DeleteGenCodeModel', null, 0, null, 2, null, 'gen:code:model:del', 1, 0, 1, '', null, 23, '2025-06-09 18:55:35', null),
|
||||||
|
(74, '导入', 'ImportGenCode', null, 0, null, 2, null, 'gen:code:import', 1, 0, 1, '', null, 23, '2025-06-09 18:58:16', null),
|
||||||
|
(75, '写入', 'WriteGenCode', null, 0, null, 2, null, 'gen:code:write', 1, 0, 1, '', null, 23, '2025-06-09 19:01:22', null),
|
||||||
|
(76, '删除', 'DeleteSysLoginLog', null, 0, null, 2, null, 'log:login:del', 1, 0, 1, '', null, 25, '2025-06-09 19:02:21', null),
|
||||||
|
(77, '清空', 'EmptyLoginLog', null, 0, null, 2, null, 'log:login:empty', 1, 0, 1, '', null, 25, '2025-06-09 19:02:50', null),
|
||||||
|
(78, '删除', 'DeleteOperaLog', null, 0, null, 2, null, 'log:opera:del', 1, 0, 1, '', null, 26, '2025-06-09 19:03:13', null),
|
||||||
|
(79, '清空', 'EmptyOperaLog', null, 0, null, 2, null, 'log:opera:empty', 1, 0, 1, '', null, 26, '2025-06-09 19:03:40', null),
|
||||||
|
(80, '下线', 'KickSysToken', null, 0, null, 2, null, 'sys:token:kick', 1, 0, 1, '', null, 27, '2025-06-09 19:04:52', null);
|
||||||
|
|
||||||
insert into sys_role (id, name, status, is_filter_scopes, remark, created_time, updated_time)
|
insert into sys_role (id, name, status, is_filter_scopes, remark, created_time, updated_time)
|
||||||
values (1, 'test', 1, 1, null, '2023-06-26 17:13:45', null);
|
values (1, '测试', 1, 1, null, '2025-05-26 17:13:45', null);
|
||||||
|
|
||||||
insert into sys_role_menu (id, role_id, menu_id)
|
insert into sys_role_menu (id, role_id, menu_id)
|
||||||
values (1, 1, 1);
|
values (1, 1, 1),
|
||||||
|
(2, 1, 2),
|
||||||
|
(3, 1, 3),
|
||||||
|
(4, 1, 4);
|
||||||
|
|
||||||
insert into sys_user (id, uuid, username, nickname, password, salt, email, is_superuser, is_staff, status, is_multi_login, avatar, phone, join_time, last_login_time, dept_id, created_time, updated_time)
|
insert into sys_user (id, uuid, username, nickname, password, salt, email, is_superuser, is_staff, status, is_multi_login, avatar, phone, join_time, last_login_time, dept_id, created_time, updated_time)
|
||||||
values (1, 'af4c804f-3966-4949-ace2-3bb7416ea926', 'admin', '用户88888', '$2b$12$8y2eNucX19VjmZ3tYhBLcOsBwy9w1IjBQE4SSqwMDL5bGQVp2wqS.', 0x24326224313224387932654E7563583139566A6D5A33745968424C634F, 'admin@example.com', 1, 1, 1, 1, null, null, '2023-06-26 17:13:45', '2024-11-18 13:53:57', 1, '2023-06-26 17:13:45', '2024-11-18 13:53:57');
|
values (1, 'af4c804f-3966-4949-ace2-3bb7416ea926', 'admin', '用户88888', '$2b$12$8y2eNucX19VjmZ3tYhBLcOsBwy9w1IjBQE4SSqwMDL5bGQVp2wqS.', 0x24326224313224387932654E7563583139566A6D5A33745968424C634F, 'admin@example.com', 1, 1, 1, 1, null, null, '2023-06-26 17:13:45', '2024-11-18 13:53:57', 1, '2023-06-26 17:13:45', '2024-11-18 13:53:57');
|
||||||
|
|
||||||
insert into sys_user_role (id, user_id, role_id)
|
insert into sys_user_role (id, user_id, role_id)
|
||||||
values (1, 1, 1);
|
values (1, 1, 1);
|
||||||
|
|
||||||
|
insert into sys_data_scope (id, name, status, created_time, updated_time)
|
||||||
|
values (1, '测试部门数据权限', 1, '2025-06-09 16:53:29', null),
|
||||||
|
(2, '测试部门及以下数据权限', 1, '2025-06-09 16:53:40', null);
|
||||||
|
|
||||||
|
insert into sys_data_rule (id, name, model, `column`, operator, expression, `value`, created_time, updated_time)
|
||||||
|
values (1, '部门名称等于测试', '部门', 'name', 1, 0, '测试', '2025-06-09 16:56:06', null),
|
||||||
|
(2, '父部门 ID 等于 1', '部门', 'parent_id', 0, 0, '1', '2025-06-09 17:16:14', null);
|
||||||
|
|
||||||
|
insert into sys_data_scope_rule (id, data_scope_id, data_rule_id)
|
||||||
|
values (1, 1, 1),
|
||||||
|
(2, 2, 1),
|
||||||
|
(3, 2, 2);
|
||||||
|
|||||||
@@ -1,35 +1,96 @@
|
|||||||
insert into sys_dept (id, name, sort, leader, phone, email, status, del_flag, parent_id, created_time, updated_time)
|
insert into sys_dept (id, name, sort, leader, phone, email, status, del_flag, parent_id, created_time, updated_time)
|
||||||
values (1, 'test', 0, null, null, null, 1, 0, null, '2023-06-26 17:13:45', null);
|
values (1, '测试', 0, null, null, null, 1, 0, null, '2025-05-26 17:13:45', null);
|
||||||
|
|
||||||
insert into fba.sys_menu (id, title, name, path, sort, icon, type, component, perms, status, display, cache, link, remark, parent_id, created_time, updated_time)
|
insert into fba.sys_menu (id, title, name, path, sort, icon, type, component, perms, status, display, cache, link, remark, parent_id, created_time, updated_time)
|
||||||
values (1, '测试', 'Test', 'test', 0, null, 0, null, null, 0, 0, 0, null, null, null, '2023-07-27 19:14:10', null),
|
values (1, '概览', 'Dashboard', 'dashboard', 0, 'ant-design:dashboard-outlined', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:26:18', null),
|
||||||
(2, '仪表盘', 'Dashboard', 'dashboard', 0, 'material-symbols:dashboard', 0, null, null, 1, 1, 0, null, null, null, '2023-07-27 19:15:45', null),
|
(2, '系统管理', 'System', 'system', 1, 'eos-icons:admin', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:30:01', null),
|
||||||
(3, '工作台', 'Workspace', 'workspace', 0, null, 1, '/dashboard/workspace/index.vue', null, 1, 1, 1, null, null, 2, '2023-07-27 19:17:59', null),
|
(3, '系统自动化', 'Automation', 'automation', 2, 'material-symbols:automation', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:31:41', null),
|
||||||
(4, '数据分析', 'Analytics', 'analytics', 0, null, 1, '/dashboard/analytics/index.vue', null, 1, 1, 1, null, null, 2, '2023-07-27 19:17:59', null),
|
(4, '日志管理', 'Log', 'log', 3, 'carbon:cloud-logging', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:32:34', null),
|
||||||
(5, '系统管理', 'System', 'system', 0, 'eos-icons:admin', 0, null, null, 1, 1, 0, null, null, null, '2023-07-27 19:23:00', null),
|
(5, '系统监控', 'Monitor', 'monitor', 4, 'mdi:monitor-eye', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:33:29', null),
|
||||||
(6, '部门管理', 'SysDept', 'sys-dept', 0, null, 1, '/system/dept/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:23:42', null),
|
(6, '项目', 'Project', 'fba', 5, 'https://wu-clan.github.io/picx-images-hosting/logo/fba.png', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:35:41', null),
|
||||||
(7, '用户管理', 'SysUser', 'sys-user', 0, null, 1, '/system/user/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:25:13', null),
|
(7, '分析页', 'Analytics', 'analytics', 0, 'lucide:area-chart', 1, '/dashboard/analytics/index', null, 1, 1, 1, '', null, 1, '2025-06-09 17:54:29', null),
|
||||||
(8, '角色管理', 'SysRole', 'sys-role', 0, null, 1, '/system/role/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:25:45', null),
|
(8, '工作台', 'Workspace', 'workspace', 1, 'carbon:workspace', 1, '/dashboard/workspace/index', null, 1, 1, 1, '', null, 1, '2025-06-09 17:57:09', null),
|
||||||
(9, '菜单管理', 'SysMenu', 'sys-menu', 0, null, 1, '/system/menu/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:45:29', null),
|
(9, '文档', 'Document', null, 1, 'lucide:book-open-text', 4, null, null, 1, 1, 1, 'https://fastapi-practices.github.io/fastapi_best_architecture_docs', null, 6, '2025-06-09 17:59:44', null),
|
||||||
(10, '插件管理', 'SysPlugin', 'sys-plugin', 0, null, 1, '/system/plugin/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:24:12', null),
|
(10, 'Github', 'Github', null, 2, 'ant-design:github-filled', 4, null, null, 1, 1, 1, 'https://github.com/fastapi-practices/fastapi_best_architecture', null, 6, '2025-06-09 18:00:50', null),
|
||||||
(11, '数据权限', 'SysDataPermission', 'sys-data-permission', 0, null, 1, '/system/data-permission/index.vue', null, 1, 1, 1, null, null, 5, '2023-07-27 19:24:12', null),
|
(11, 'Apifox', 'Apifox', 'apifox', 3, 'simple-icons:apifox', 3, null, null, 1, 1, 1, 'https://apifox.com/apidoc/shared-28a93f02-730b-4f33-bb5e-4dad92058cc0', null, 6, '2025-06-09 18:01:39', null),
|
||||||
(12, '系统自动化', 'Automation', 'automation', 0, 'material-symbols:automation', 0, null, null, 1, 1, 0, null, null, null, '2024-07-27 02:06:20', null),
|
(12, '部门管理', 'SysDept', 'sys-dept', 1, 'mingcute:department-line', 1, '/system/dept/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:03:17', null),
|
||||||
(13, '代码生成', 'CodeGenerator', 'code-generator', 0, null, 1, '/automation/code-generator/index.vue', null, 1, 1, 1, null, null, 12, '2024-07-27 12:24:54', null),
|
(13, '用户管理', 'SysUser', 'sys-user', 2, 'ant-design:user-outlined', 1, '/system/user/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:03:54', null),
|
||||||
(14, '系统监控', 'Monitor', 'monitor', 0, 'mdi:monitor-eye', 0, null, null, 1, 1, 0, null, null, null, '2023-07-27 19:27:08', null),
|
(14, '角色管理', 'SysRole', 'sys-role', 3, 'carbon:user-role', 1, '/system/role/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:04:47', null),
|
||||||
(15, 'Redis 监控', 'Redis', 'redis', 0, null, 1, '/monitor/redis/index.vue', null, 1, 1, 1, null, null, 14, '2023-07-27 19:28:03', null),
|
(15, '菜单管理', 'SysMenu', 'sys-menu', 4, 'ant-design:menu-outlined', 1, '/system/menu/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:05:31', null),
|
||||||
(16, '服务器监控', 'Server', 'server', 0, null, 1, '/monitor/server/index.vue', null, 1, 1, 1, null, null, 14, '2023-07-27 19:28:29', null),
|
(16, '数据权限', 'SysDataPermission', 'sys-data-permission', 5, 'icon-park-outline:permissions', 0, null, null, 1, 1, 1, '', null, 2, '2025-06-09 18:07:04', null),
|
||||||
(17, '日志', 'Log', 'log', 0, 'carbon:cloud-logging', 0, null, null, 1, 1, 0, null, null, null, '2023-07-27 19:19:59', null),
|
(17, '数据范围', 'SysDataScope', 'sys-data-scope', 6, 'cuida:scope-outline', 1, '/system/data-permission/scope/index', null, 1, 1, 1, '', null, 16, '2025-06-09 18:07:46', null),
|
||||||
(18, '登录日志', 'Login', 'login', 0, null, 1, '/log/login/index.vue', null, 1, 1, 1, null, null, 17, '2023-07-27 19:20:56', null),
|
(18, '数据规则', 'SysDataRule', 'sys-data-rule', 7, 'material-symbols:rule', 1, '/system/data-permission/rule/index', null, 1, 1, 1, '', null, 16, '2025-06-09 18:08:22', null),
|
||||||
(19, '操作日志', 'Opera', 'opera', 0, null, 1, '/log/opera/index.vue', null, 1, 1, 1, null, null, 17, '2023-07-27 19:21:28', null),
|
(19, '插件管理', 'SysPlugin', 'sys-plugin', 8, 'clarity:plugin-line', 1, '/system/plugin/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:09:12', null),
|
||||||
(20, 'Apifox', 'Apifox', 'apifox', 997, 'simple-icons:apifox', 3, null, null, 1, 1, 0, 'https://apifox.com/apidoc/shared-28a93f02-730b-4f33-bb5e-4dad92058cc0', null, null, '2024-05-22 16:27:00', null),
|
(20, '参数管理', 'SysConfig', 'sys-config', 9, 'codicon:symbol-parameter', 1, '/system/config/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:10:20', null),
|
||||||
(21, '官网', 'Site', '', 998, 'dashicons:admin-site', 4, null, null, 1, 1, 0, 'https://fastapi-practices.github.io/fastapi_best_architecture_docs/', null, null, '2024-07-27 19:22:24', null),
|
(21, '字典管理', 'SysDict', 'sys-dict', 10, 'fluent-mdl2:dictionary', 1, '/system/dict/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:11:10', null),
|
||||||
(22, '赞助', 'Sponsor', '', 999, 'material-icon-theme:github-sponsors', 4, null, null, 1, 1, 0, 'https://wu-clan.github.io/sponsor/', null, null, '2024-07-27 12:39:57', null);
|
(22, '通知公告', 'SysNotice', 'sys-notice', 11, 'fe:notice-push', 1, '/system/notice/index', null, 1, 1, 1, '', null, 2, '2025-06-09 18:11:38', null),
|
||||||
|
(23, '代码生成', 'CodeGenerator', 'code-generator', 1, 'tabler:code', 1, '/automation/code-generator/index', null, 1, 1, 1, '', null, 3, '2025-06-09 18:12:38', null),
|
||||||
|
(24, '任务调度', 'Scheduler', 'scheduler', 2, 'ix:scheduler', 1, '/automation/scheduler/index', null, 1, 1, 1, '', null, 3, '2025-06-09 18:13:19', null),
|
||||||
|
(25, '登录日志', 'LoginLog', 'login', 1, 'mdi:login', 1, '/log/login/index', null, 1, 1, 1, '', null, 4, '2025-06-09 18:14:35', null),
|
||||||
|
(26, '操作日志', 'OperaLog', 'opera', 2, 'carbon:operations-record', 1, '/log/opera/index', null, 1, 1, 1, '', null, 4, '2025-06-09 18:15:26', null),
|
||||||
|
(27, '在线用户', 'Online', 'online', 1, 'wpf:online', 1, '/monitor/online/index', null, 1, 1, 1, '', null, 5, '2025-06-09 18:17:12', null),
|
||||||
|
(28, 'Redis', 'Redis', 'redis', 2, 'devicon:redis', 1, '/monitor/redis/index', null, 1, 1, 1, '', null, 5, '2025-06-09 18:17:42', null),
|
||||||
|
(29, 'Server', 'Server', 'server', 3, 'mdi:server-outline', 1, '/monitor/server/index', null, 1, 1, 1, '', null, 5, '2025-06-09 18:18:12', null),
|
||||||
|
(30, '新增', 'AddSysDept', null, 0, null, 2, null, 'sys:dept:add', 1, 0, 1, '', null, 12, '2025-06-09 18:21:17', null),
|
||||||
|
(31, '修改', 'EditSysDept', null, 0, null, 2, null, 'sys:dept:edit', 1, 0, 1, '', null, 12, '2025-06-09 18:22:01', null),
|
||||||
|
(32, '删除', 'DeleteSysDept', null, 0, null, 2, null, 'sys:dept:del', 1, 0, 1, '', null, 12, '2025-06-09 18:22:39', null),
|
||||||
|
(33, '删除', 'DeleteSysUser', null, 0, null, 2, null, 'sys:user:del', 1, 0, 1, '', null, 13, '2025-06-09 18:24:09', null),
|
||||||
|
(34, '新增', 'AddSysRole', null, 0, null, 2, null, 'sys:role:add', 1, 0, 1, '', null, 14, '2025-06-09 18:25:08', null),
|
||||||
|
(35, '修改', 'EditSysRole', null, 0, null, 2, null, 'sys:role:edit', 1, 0, 1, '', null, 14, '2025-06-09 18:26:30', null),
|
||||||
|
(36, '修改角色菜单', 'EditSysRoleMenu', null, 0, null, 2, null, 'sys:role:menu:edit', 1, 0, 1, '', null, 14, '2025-06-09 18:27:24', null),
|
||||||
|
(37, '修改角色数据范围', 'EditSysRoleScope', null, 0, null, 2, null, 'sys:role:scope:edit', 1, 0, 1, '', null, 14, '2025-06-09 18:28:25', null),
|
||||||
|
(38, '删除', 'DeleteSysRole', null, 0, null, 2, null, 'sys:role:del', 1, 0, 1, '', null, 14, '2025-06-09 18:28:55', null),
|
||||||
|
(39, '新增', 'AddSysMenu', null, 0, null, 2, null, 'sys:menu:add', 1, 0, 1, '', null, 15, '2025-06-09 18:29:51', null),
|
||||||
|
(40, '修改', 'EditSysMenu', null, 0, null, 2, null, 'sys:menu:edit', 1, 0, 1, '', null, 15, '2025-06-09 18:30:13', null),
|
||||||
|
(41, '删除', 'DeleteSysMenu', null, 0, null, 2, null, 'sys:menu:del', 1, 0, 1, '', null, 15, '2025-06-09 18:30:37', null),
|
||||||
|
(42, '新增', 'AddSysDataScope', null, 0, null, 2, null, 'data:scope:add', 1, 0, 1, '', null, 17, '2025-06-09 18:31:11', null),
|
||||||
|
(43, '修改', 'EditSysDataScope', null, 0, null, 2, null, 'data:scope:edit', 1, 0, 1, '', null, 17, '2025-06-09 18:31:42', null),
|
||||||
|
(44, '修改数据范围规则', 'EditDataScopeRule', null, 0, null, 2, null, 'data:scope:rule:edit', 1, 0, 1, '', null, 17, '2025-06-09 18:32:36', null),
|
||||||
|
(45, '删除', 'DeleteSysDataScope', null, 0, null, 2, null, 'data:scope:del', 1, 0, 1, '', null, 17, '2025-06-09 18:33:09', null),
|
||||||
|
(46, '新增', 'AddSysDataRule', null, 0, null, 2, null, 'data:rule:add', 1, 0, 1, '', null, 18, '2025-06-09 18:35:54', null),
|
||||||
|
(47, '修改', 'EditSysDataRule', null, 0, null, 2, null, 'data:rule:edit', 1, 0, 1, '', null, 18, '2025-06-09 18:36:19', null),
|
||||||
|
(48, '删除', 'DeleteSysDataRule', null, 0, null, 2, null, 'data:rule:del', 1, 0, 1, '', null, 18, '2025-06-09 18:36:44', null),
|
||||||
|
(49, '安装zip插件', 'InstallZipSysPlugin', null, 0, null, 2, null, 'sys:plugin:zip', 1, 0, 1, '', null, 19, '2025-06-09 18:38:14', null),
|
||||||
|
(50, '安装git插件', 'InstallGitSysPlugin', null, 0, null, 2, null, 'sys:plugin:git', 1, 0, 1, '', null, 19, '2025-06-09 18:38:43', null),
|
||||||
|
(51, '卸载', 'UninstallSysPlugin', null, 0, null, 2, null, 'sys:plugin:del', 1, 0, 1, '', null, 19, '2025-06-09 18:39:08', null),
|
||||||
|
(52, '修改', 'EditSysPlugin', null, 0, null, 2, null, 'sys:plugin:status', 1, 0, 1, '', null, 19, '2025-06-09 18:39:47', null),
|
||||||
|
(53, '新增网站参数', 'AddWebsiteSysConfig', null, 0, null, 2, null, 'sys:config:website:add', 1, 0, 1, '', null, 20, '2025-06-09 18:43:30', null),
|
||||||
|
(54, '新增用户协议', 'AddProtocolSysConfig', null, 0, null, 2, null, 'sys:config:protocol:add', 1, 0, 1, '', null, 20, '2025-06-09 18:44:13', null),
|
||||||
|
(55, '新增用户政策', 'AddPolicySysConfig', null, 0, null, 2, null, 'sys:config:policy:add', 1, 0, 1, '', null, 20, '2025-06-09 18:45:28', null),
|
||||||
|
(56, '新增', 'AddSysConfig', null, 0, null, 2, null, 'sys:config:add', 1, 0, 1, '', null, 20, '2025-06-09 18:45:52', null),
|
||||||
|
(57, '修改', 'EditSysConfig', null, 0, null, 2, null, 'sys:config:edit', 1, 0, 1, '', null, 20, '2025-06-09 18:46:13', null),
|
||||||
|
(58, '删除', 'DeleteSysConfig', null, 0, null, 2, null, 'sys:config:del', 1, 0, 1, '', null, 20, '2025-06-09 18:46:36', null),
|
||||||
|
(59, '新增类型', 'AddSysDictType', null, 0, null, 2, null, 'sys:dict:type:add', 1, 0, 1, '', null, 21, '2025-06-09 18:48:17', null),
|
||||||
|
(60, '修改类型', 'EditSysDictType', null, 0, null, 2, null, 'sys:dict:type:edit', 1, 0, 1, '', null, 21, '2025-06-09 18:48:49', null),
|
||||||
|
(61, '删除类型', 'DeleteSysDictType', null, 0, null, 2, null, 'sys:dict:type:del', 1, 0, 1, '', null, 21, '2025-06-09 18:49:23', null),
|
||||||
|
(62, '新增', 'AddSysDictData', null, 0, null, 2, null, 'sys:dict:data:add', 1, 0, 1, '', null, 21, '2025-06-09 18:50:01', null),
|
||||||
|
(63, '修改', 'EditSysDictData', null, 0, null, 2, null, 'sys:dict:data:edit', 1, 0, 1, '', null, 21, '2025-06-09 18:50:26', null),
|
||||||
|
(64, '删除', 'DeleteSysDictData', null, 0, null, 2, null, 'sys:dict:data:del', 1, 0, 1, '', null, 21, '2025-06-09 18:50:48', null),
|
||||||
|
(65, '新增', 'AddSysNotice', null, 0, null, 2, null, 'sys:notice:add', 1, 0, 1, '', null, 22, '2025-06-09 18:51:22', null),
|
||||||
|
(66, '修改', 'EditSysNotice', null, 0, null, 2, null, 'sys:notice:edit', 1, 0, 1, '', null, 22, '2025-06-09 18:51:45', null),
|
||||||
|
(67, '删除', 'DeleteSysNotice', null, 0, null, 2, null, 'sys:notice:del', 1, 0, 1, '', null, 22, '2025-06-09 18:52:10', null),
|
||||||
|
(68, '新增业务', 'AddSysGenCodeBusiness', null, 0, null, 2, null, 'gen:code:business:add', 1, 0, 1, '', null, 23, '2025-06-09 18:53:07', null),
|
||||||
|
(69, '修改业务', 'EditGenCodeBusiness', null, 0, null, 2, null, 'gen:code:business:edit', 1, 0, 1, '', null, 23, '2025-06-09 18:53:45', null),
|
||||||
|
(70, '删除业务', 'DeleteGenCodeBusiness', null, 0, null, 2, null, 'gen:code:business:del', 1, 0, 1, '', null, 23, '2025-06-09 18:54:11', null),
|
||||||
|
(71, '新增模型', 'AddGenCodeModel', null, 0, null, 2, null, 'gen:code:model:add', 1, 0, 1, '', null, 23, '2025-06-09 18:54:45', null),
|
||||||
|
(72, '修改模型', 'EditGenCodeModel', null, 0, null, 2, null, 'gen:code:model:edit', 1, 0, 1, '', null, 23, '2025-06-09 18:55:08', null),
|
||||||
|
(73, '删除模型', 'DeleteGenCodeModel', null, 0, null, 2, null, 'gen:code:model:del', 1, 0, 1, '', null, 23, '2025-06-09 18:55:35', null),
|
||||||
|
(74, '导入', 'ImportGenCode', null, 0, null, 2, null, 'gen:code:import', 1, 0, 1, '', null, 23, '2025-06-09 18:58:16', null),
|
||||||
|
(75, '写入', 'WriteGenCode', null, 0, null, 2, null, 'gen:code:write', 1, 0, 1, '', null, 23, '2025-06-09 19:01:22', null),
|
||||||
|
(76, '删除', 'DeleteSysLoginLog', null, 0, null, 2, null, 'log:login:del', 1, 0, 1, '', null, 25, '2025-06-09 19:02:21', null),
|
||||||
|
(77, '清空', 'EmptyLoginLog', null, 0, null, 2, null, 'log:login:empty', 1, 0, 1, '', null, 25, '2025-06-09 19:02:50', null),
|
||||||
|
(78, '删除', 'DeleteOperaLog', null, 0, null, 2, null, 'log:opera:del', 1, 0, 1, '', null, 26, '2025-06-09 19:03:13', null),
|
||||||
|
(79, '清空', 'EmptyOperaLog', null, 0, null, 2, null, 'log:opera:empty', 1, 0, 1, '', null, 26, '2025-06-09 19:03:40', null),
|
||||||
|
(80, '下线', 'KickSysToken', null, 0, null, 2, null, 'sys:token:kick', 1, 0, 1, '', null, 27, '2025-06-09 19:04:52', null);
|
||||||
|
|
||||||
insert into sys_role (id, name, status, is_filter_scopes, remark, created_time, updated_time)
|
insert into sys_role (id, name, status, is_filter_scopes, remark, created_time, updated_time)
|
||||||
values (1, 'test', 1, 1, null, '2023-06-26 17:13:45', null);
|
values (1, '测试', 1, 1, null, '2025-05-26 17:13:45', null);
|
||||||
|
|
||||||
insert into sys_role_menu (id, role_id, menu_id)
|
insert into sys_role_menu (id, role_id, menu_id)
|
||||||
values (1, 1, 1);
|
values (1, 1, 1),
|
||||||
|
(2, 1, 2),
|
||||||
|
(3, 1, 3),
|
||||||
|
(4, 1, 4);
|
||||||
|
|
||||||
insert into sys_user (id, uuid, username, nickname, password, salt, email, is_superuser, is_staff, status, is_multi_login, avatar, phone, join_time, last_login_time, dept_id, created_time, updated_time)
|
insert into sys_user (id, uuid, username, nickname, password, salt, email, is_superuser, is_staff, status, is_multi_login, avatar, phone, join_time, last_login_time, dept_id, created_time, updated_time)
|
||||||
values (1, 'af4c804f-3966-4949-ace2-3bb7416ea926', 'admin', '用户88888', '$2b$12$8y2eNucX19VjmZ3tYhBLcOsBwy9w1IjBQE4SSqwMDL5bGQVp2wqS.', '0x24326224313224387932654E7563583139566A6D5A33745968424C634F', 'admin@example.com', 1, 1, 1, 1, null, null, '2023-06-26 17:13:45', '2024-11-18 13:53:57', 1, '2023-06-26 17:13:45', '2024-11-18 13:53:57');
|
values (1, 'af4c804f-3966-4949-ace2-3bb7416ea926', 'admin', '用户88888', '$2b$12$8y2eNucX19VjmZ3tYhBLcOsBwy9w1IjBQE4SSqwMDL5bGQVp2wqS.', '0x24326224313224387932654E7563583139566A6D5A33745968424C634F', 'admin@example.com', 1, 1, 1, 1, null, null, '2023-06-26 17:13:45', '2024-11-18 13:53:57', 1, '2023-06-26 17:13:45', '2024-11-18 13:53:57');
|
||||||
@@ -37,6 +98,19 @@ values (1, 'af4c804f-3966-4949-ace2-3bb7416ea926', 'admin', '用户88888', '$2b
|
|||||||
insert into sys_user_role (id, user_id, role_id)
|
insert into sys_user_role (id, user_id, role_id)
|
||||||
values (1, 1, 1);
|
values (1, 1, 1);
|
||||||
|
|
||||||
|
insert into sys_data_scope (id, name, status, created_time, updated_time)
|
||||||
|
values (1, '测试部门数据权限', 1, '2025-06-09 16:53:29', null),
|
||||||
|
(2, '测试部门及以下数据权限', 1, '2025-06-09 16:53:40', null);
|
||||||
|
|
||||||
|
insert into sys_data_rule (id, name, model, `column`, operator, expression, `value`, created_time, updated_time)
|
||||||
|
values (1, '部门名称等于测试', '部门', 'name', 1, 0, '测试', '2025-06-09 16:56:06', null),
|
||||||
|
(2, '父部门 ID 等于 1', '部门', 'parent_id', 0, 0, '1', '2025-06-09 17:16:14', null);
|
||||||
|
|
||||||
|
insert into sys_data_scope_rule (id, data_scope_id, data_rule_id)
|
||||||
|
values (1, 1, 1),
|
||||||
|
(2, 2, 1),
|
||||||
|
(3, 2, 2);
|
||||||
|
|
||||||
-- Reset auto-increment values for each table based on max id
|
-- Reset auto-increment values for each table based on max id
|
||||||
SELECT setval(pg_get_serial_sequence('sys_dept', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_dept;
|
SELECT setval(pg_get_serial_sequence('sys_dept', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_dept;
|
||||||
SELECT setval(pg_get_serial_sequence('sys_menu', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_menu;
|
SELECT setval(pg_get_serial_sequence('sys_menu', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_menu;
|
||||||
@@ -44,3 +118,6 @@ SELECT setval(pg_get_serial_sequence('sys_role', 'id'),COALESCE(MAX(id), 0) + 1,
|
|||||||
SELECT setval(pg_get_serial_sequence('sys_role_menu', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_role_menu;
|
SELECT setval(pg_get_serial_sequence('sys_role_menu', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_role_menu;
|
||||||
SELECT setval(pg_get_serial_sequence('sys_user', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_user;
|
SELECT setval(pg_get_serial_sequence('sys_user', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_user;
|
||||||
SELECT setval(pg_get_serial_sequence('sys_user_role', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_user_role;
|
SELECT setval(pg_get_serial_sequence('sys_user_role', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_user_role;
|
||||||
|
SELECT setval(pg_get_serial_sequence('sys_data_scope', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_data_scope;
|
||||||
|
SELECT setval(pg_get_serial_sequence('sys_data_rule', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_data_rule;
|
||||||
|
SELECT setval(pg_get_serial_sequence('sys_data_scope_rule', 'id'),COALESCE(MAX(id), 0) + 1, true) FROM sys_data_scope_rule;
|
||||||
|
|||||||
Reference in New Issue
Block a user