完成项目管理模块的接口测试

This commit is contained in:
2025-04-18 17:22:57 +08:00
parent 434e1af3e8
commit 7a9e571a96
16 changed files with 91 additions and 74 deletions

View File

@ -263,6 +263,16 @@ class DalBase:
await self.db.execute(insert(self.model), datas)
await self.db.flush()
async def create_models(self, datas: list[Any]) -> None:
"""
批量创建数据
SQLAlchemy 2.0 批量插入不支持 MySQL 返回值:
https://docs.sqlalchemy.org/en/20/orm/queryguide/dml.html#getting-new-objects-with-returning
:param datas: model数组
"""
self.db.add_all(datas)
await self.db.flush()
async def put_data(
self,
data_id: int,