namespace SafeCampus.Application.Services.Business.BuildingService; public class BuildingService:DbRepository,IBuildingService { public async Task Add(BuildingInfoDto input) { var model = input.Adapt(); await InsertAsync(model); return true; } public async Task Update(BuildingInfoDto input) { if (!input.Id.HasValue) { throw Oops.Oh("请填写ID"); } var model = await GetFirstAsync(p => p.Id == input.Id); if (model == null) { throw Oops.Oh("信息不存在"); } var res = input.Adapt(model); await UpdateAsync(res); return true; } public async Task GetInfo(long id) { var model = await Context.Queryable() .FirstAsync(x => x.Id == id); if (model == null) { return null; } return model.Adapt(); } public async Task Delete(long id) { var model = await GetFirstAsync(x => x.Id == id); if (model == null) { throw Oops.Oh("信息不存在"); } await DeleteAsync(model); return true; } public async Task> GetNoPageList() { var list = await Context.Queryable() .Includes(x => x.InsCameraInfoItem) .Includes(x => x.OutCameraInfoItem) .ToListAsync(); //var list = await GetListAsync(); return list.Adapt>(); } }