【服务层新范式批量铺开】4 个 uniform 模块: - service:get_x_page(params)->dict、add/update/status(data)->None、 delete(ids)->int、get_info 委托 Repository(新建 repository.py) - 业务失败 raise BizError;router 取参包 R - level 的 Excel import/export 暂保留 R 返回(后续统一改造) 【工具】codemod 函数级转换(try/except 退格移除、R.failed→BizError、 R.ok→return data)+ black 格式化 + 未用导入清理 【教训】清理脚本 startswith 前缀误删含多名字的 import 行(models_to_list, model_to_dict 同行)导致 F821,已按 F821 精确补回 【验收】应用启动;4 服务分页查询运行时正常;12 passed;flake8 零告警 Co-Authored-By: Claude <noreply@anthropic.com>
16 lines
345 B
Python
16 lines
345 B
Python
"""
|
|
Notice 仓储模块
|
|
=============================================================
|
|
|
|
数据访问层,继承 BaseRepository 获得通用 CRUD 能力。
|
|
"""
|
|
|
|
from src.common.base_repository import BaseRepository
|
|
from src.modules.notice.models import Notice
|
|
|
|
|
|
class NoticeRepository(BaseRepository):
|
|
"""Notice 仓储"""
|
|
|
|
model = Notice
|