diff --git a/fastapi_modules/fastapi_leaudit/domian/Dto/entryModuleDto.py b/fastapi_modules/fastapi_leaudit/domian/Dto/entryModuleDto.py index 972bd9d..289fbe3 100644 --- a/fastapi_modules/fastapi_leaudit/domian/Dto/entryModuleDto.py +++ b/fastapi_modules/fastapi_leaudit/domian/Dto/entryModuleDto.py @@ -17,6 +17,7 @@ class EntryModuleCreateDTO(BaseModel): name: str = Field(..., description="模块名称") description: str | None = Field(None, description="模块描述") path: str | None = Field(None, description="前端路由路径") + route_path: str | None = Field(None, description="前端跳转路径") areas: list[EntryModuleAreaDTO] | None = Field(None, description="地区配置") @@ -26,4 +27,5 @@ class EntryModuleUpdateDTO(BaseModel): name: str | None = Field(None, description="模块名称") description: str | None = Field(None, description="模块描述") path: str | None = Field(None, description="前端路由路径") + route_path: str | None = Field(None, description="前端跳转路径") areas: list[EntryModuleAreaDTO] | None = Field(None, description="地区配置") diff --git a/fastapi_modules/fastapi_leaudit/services/impl/entryModuleAdminServiceImpl.py b/fastapi_modules/fastapi_leaudit/services/impl/entryModuleAdminServiceImpl.py index 1976111..8e3eb9c 100644 --- a/fastapi_modules/fastapi_leaudit/services/impl/entryModuleAdminServiceImpl.py +++ b/fastapi_modules/fastapi_leaudit/services/impl/entryModuleAdminServiceImpl.py @@ -86,6 +86,7 @@ class EntryModuleAdminServiceImpl(IEntryModuleAdminService): async def CreateModule(self, Body: EntryModuleCreateDTO) -> EntryModuleVO: """创建入口模块。""" + route_path = (Body.route_path if Body.route_path is not None else Body.path or "").strip() or None async with GetAsyncSession() as Session: try: row = ( @@ -103,7 +104,7 @@ class EntryModuleAdminServiceImpl(IEntryModuleAdminService): { "name": Body.name.strip(), "description": (Body.description or "").strip() or None, - "route_path": (Body.path or "").strip() or None, + "route_path": route_path, "icon_path": None, "areas": self._areasJson(Body.areas), "sort_order": await self._nextSortOrder(Session), @@ -119,6 +120,7 @@ class EntryModuleAdminServiceImpl(IEntryModuleAdminService): async def UpdateModule(self, ModuleId: int, Body: EntryModuleUpdateDTO) -> EntryModuleVO: """更新入口模块。""" current = await self._getModuleRow(ModuleId) + incoming_route_path = Body.route_path if Body.route_path is not None else Body.path async with GetAsyncSession() as Session: row = ( await Session.execute( @@ -140,7 +142,7 @@ class EntryModuleAdminServiceImpl(IEntryModuleAdminService): "module_id": ModuleId, "name": Body.name.strip() if Body.name is not None else current["name"], "description": (Body.description.strip() if Body.description is not None else current["description"]), - "route_path": (Body.path.strip() if Body.path is not None else current["path"]), + "route_path": (incoming_route_path.strip() if incoming_route_path is not None else current["path"]), "areas": self._areasJson(Body.areas) if Body.areas is not None else self._areasJson(current["areas"]), }, )