SnapshotUserInfoRepository.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. using Hotline.Repository.SqlSugar.DataPermissions;
  2. using Hotline.Share.Tools;
  3. using Hotline.Snapshot;
  4. using Hotline.Snapshot.Interfaces;
  5. using Hotline.Snapshot;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using XF.Domain.Dependency;
  12. using SqlSugar;
  13. using Hotline.Repository.SqlSugar.DataPermissions;
  14. namespace Hotline.Repository.SqlSugar.Snapshot;
  15. public class SnapshotUserInfoRepository : BaseRepository<SnapshotUserInfo>, ISnapshotUserInfoRepository, IScopeDependency
  16. {
  17. public SnapshotUserInfoRepository(ISugarUnitOfWork<HotlineDbContext> uow, IDataPermissionFilterBuilder dataPermissionFilterBuilder, IServiceProvider serviceProvider) : base(uow, dataPermissionFilterBuilder, serviceProvider)
  18. {
  19. }
  20. public async Task<SnapshotUserInfo?> GetByPhoneNumberAsync(string? phoneNumber)
  21. {
  22. if (phoneNumber.IsNullOrEmpty()) return null;
  23. return await Queryable().Where(m => m.PhoneNumber == phoneNumber).FirstAsync();
  24. }
  25. public async Task<SnapshotUserInfo> GetByThirdIdAsync(string id)
  26. {
  27. return await Queryable().Where(m => m.ThirdAccountId == id).FirstAsync();
  28. }
  29. }