Skip to content

Commit d0ce00e

Browse files
committed
update tools
1 parent 573f990 commit d0ce00e

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

backend/app/admin/crud/crud_user.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,10 @@ async def get_list(self, dept: int = None, username: str = None, phone: str = No
176176
"""
177177
获取用户列表
178178
179-
:param dept:
180-
:param username:
181-
:param phone:
182-
:param status:
179+
:param dept: 部门 ID(可选)
180+
:param username: 用户名(可选)
181+
:param phone: 电话号码(可选)
182+
:param status: 用户状态(可选)
183183
:return:
184184
"""
185185
stmt = (
@@ -191,17 +191,22 @@ async def get_list(self, dept: int = None, username: str = None, phone: str = No
191191
)
192192
.order_by(desc(self.model.join_time))
193193
)
194-
where_list = []
194+
195+
# 构建过滤条件
196+
filters = []
195197
if dept:
196-
where_list.append(self.model.dept_id == dept)
198+
filters.append(self.model.dept_id == dept)
197199
if username:
198-
where_list.append(self.model.username.like(f'%{username}%'))
200+
filters.append(self.model.username.like(f'%{username}%'))
199201
if phone:
200-
where_list.append(self.model.phone.like(f'%{phone}%'))
202+
filters.append(self.model.phone.like(f'%{phone}%'))
201203
if status is not None:
202-
where_list.append(self.model.status == status)
203-
if where_list:
204-
stmt = stmt.where(and_(*where_list))
204+
filters.append(self.model.status == status)
205+
206+
# 应用过滤条件
207+
if filters:
208+
stmt = stmt.where(and_(*filters))
209+
205210
return stmt
206211

207212
async def get_super(self, db: AsyncSession, user_id: int) -> bool:

backend/plugin/tools.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def _load_plugin_config(plugin: str) -> dict[str, Any]:
6464
加载插件配置
6565
6666
:param plugin: 插件名称
67+
:return:
6768
"""
6869
toml_path = os.path.join(PLUGIN_DIR, plugin, 'plugin.toml')
6970
if not os.path.exists(toml_path):
@@ -79,6 +80,7 @@ def _inject_extra_router(plugin: str, data: dict[str, Any]) -> None:
7980
8081
:param plugin: 插件名称
8182
:param data: 插件配置数据
83+
:return:
8284
"""
8385
app_include = data.get('app', {}).get('include', '')
8486
if not app_include:
@@ -138,6 +140,7 @@ def _inject_app_router(plugin: str, data: dict[str, Any]) -> None:
138140
139141
:param plugin: 插件名称
140142
:param data: 插件配置数据
143+
:return:
141144
"""
142145
module_path = f'backend.plugin.{plugin}.api.router'
143146
try:
@@ -180,6 +183,7 @@ def _install_plugin_requirements(plugin: str, requirements_file: str) -> None:
180183
181184
:param plugin: 插件名称
182185
:param requirements_file: 依赖文件路径
186+
:return:
183187
"""
184188
try:
185189
ensurepip_install = [sys.executable, '-m', 'ensurepip', '--upgrade']

0 commit comments

Comments
 (0)