chore(base-service): 完善batchDelete方法的返回类型并添加返回值

为batchDelete方法添加明确的Promise<number>返回类型,同时返回实际删除的id数量
This commit is contained in:
xiaojunnuo
2026-07-12 02:38:49 +08:00
parent 083df61fcc
commit d609ee2b7a
@@ -279,7 +279,7 @@ export abstract class BaseService<T> {
return item != null && item != ""; return item != null && item != "";
}); });
} }
async batchDelete(ids: number[], userId: number, projectId?: number) { async batchDelete(ids: number[], userId: number, projectId?: number): Promise<number> {
ids = this.filterIds(ids); ids = this.filterIds(ids);
if (userId != null) { if (userId != null) {
const userProjectQuery = this.buildUserProjectQuery(userId, projectId); const userProjectQuery = this.buildUserProjectQuery(userId, projectId);
@@ -295,6 +295,7 @@ export abstract class BaseService<T> {
} }
await this.delete(ids); await this.delete(ids);
return ids.length;
} }
async findOne(options: FindOneOptions<T>) { async findOne(options: FindOneOptions<T>) {