ForeignReceivablesRepository.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using AutoMapper;
  2. using OASystem.Domain;
  3. using OASystem.Domain.Entities.Financial;
  4. using OASystem.Domain.ViewModels.Financial;
  5. using SqlSugar;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace OASystem.Infrastructure.Repositories.Financial
  12. {
  13. /// <summary>
  14. /// 财务 - 团组应收款项 仓库
  15. /// 雷怡 2023.08.16 15:03
  16. /// </summary>
  17. public class ForeignReceivablesRepository:BaseRepository<Fin_ForeignReceivables,Fin_ForeignReceivablesView>
  18. {
  19. private readonly IMapper _mapper;
  20. public ForeignReceivablesRepository(SqlSugarClient sqlSugar, IMapper mapper)
  21. :base(sqlSugar)
  22. {
  23. _mapper = mapper;
  24. }
  25. /// <summary>
  26. /// 根据diid查询团组应收款项
  27. /// </summary>
  28. /// <param name="diid"></param>
  29. /// <returns></returns>
  30. public async Task<Result> GetGroupReceivablesByDiid(int diid)
  31. {
  32. Result result = new() { Code = -2 };
  33. string sql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", diid);
  34. var groupReceivedList = await _sqlSugar.SqlQueryable<Fin_ForeignReceivables>(sql).ToListAsync();
  35. result.Code = 0;
  36. result.Msg = "查询成功!";
  37. result.Data = groupReceivedList;
  38. return result;
  39. }
  40. /// <summary>
  41. /// 根据diid 数组 查询团组应收款项
  42. /// </summary>
  43. /// <param name="diid"></param>
  44. /// <returns></returns>
  45. public async Task<Result> GetGroupReceivablesByDiids(int[] diids)
  46. {
  47. Result result = new() { Code = -2 };
  48. //string sql = string.Format(@"Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0}", diids);
  49. var groupReceivedList = await _sqlSugar.Queryable<Fin_ForeignReceivables>()
  50. .Where(pr => pr.IsDel == 0 && diids.Contains(pr.Diid)).ToListAsync();
  51. result.Code = 0;
  52. result.Msg = "查询成功!";
  53. result.Data = groupReceivedList;
  54. return result;
  55. }
  56. }
  57. }