using MoYu.RemoteRequest.Extensions; namespace SafeCampus.Application.Services.Business.PersonFacesService; public class PersonFacesService:DbRepository, IPersonFacesService { public async Task BatchAdd(List list) { var oldList = await GetListAsync(x => x.PersonId == list[0].PersonId); await DeleteAsync(oldList); foreach (var item in list) { var signImg = Path.Combine(Directory.GetCurrentDirectory(), "Files", App.Configuration["AppInfo:PersonImg"], item.FaceId + ".jpg"); await item.FaceUrl.GetToSaveAsync(signImg); item.FaceUrl = $"/Files/{App.Configuration["AppInfo:PersonImg"]}/{item.FaceId}.jpg"; await InsertAsync(item); } //await InsertRangeAsync(list); return true; } public async Task Add(PersonFaces entity) { await InsertAsync(entity); return true; } public async Task Delete(string personId, List faceIds) { var delList = await GetListAsync(x => x.PersonId == personId && faceIds.Contains(x.FaceId)); await DeleteAsync(delList); return true; } }