OpinionaireRepository.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Security.Policy;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using AutoMapper;
  9. using OASystem.Domain.Entities.Groups;
  10. using OASystem.Domain.ViewModels.Groups;
  11. using OASystem.Infrastructure.Tools;
  12. namespace OASystem.Infrastructure.Repositories.Groups
  13. {
  14. /// <summary>
  15. /// 团组接待意见调查
  16. /// 仓储
  17. /// </summary>
  18. public class OpinionaireRepository : BaseRepository<Grp_Opinionaire, OpinionaireView>
  19. {
  20. private readonly IMapper _mapper;
  21. private string _url;
  22. private string _filePath;
  23. private JsonView _jsonView;
  24. public OpinionaireRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar)
  25. {
  26. _mapper = mapper;
  27. _url = $"{AppSettingsHelper.Get("GrpFileFtpPath")}OpinionaireElectronicSignature";
  28. _filePath = $"{AppSettingsHelper.Get("GrpFileBasePath")}OpinionaireElectronicSignature";
  29. if (!Directory.Exists(_filePath))
  30. {
  31. Directory.CreateDirectory(_filePath);
  32. }
  33. _jsonView= new JsonView(){Code = 400 ,Msg = "操作失败"};
  34. }
  35. /// <summary>
  36. /// 列表
  37. /// </summary>
  38. /// <param name="portType"></param>
  39. /// <param name="diId"></param>
  40. /// <param name="type"></param>
  41. /// <returns></returns>
  42. public async Task<JsonView> Item(int portType, int diId, int type = 1)
  43. {
  44. if (portType < 1 || portType > 3) return new JsonView() { Code = 400, Msg = "请传入有效的portType" };
  45. if (diId < 1) return new JsonView() { Code = 400, Msg = "请传入有效的diId!" };
  46. var data = await Query(x => x.IsDel == 0 && x.DiId == diId).ToListAsync();
  47. return _jsonView;
  48. }
  49. }
  50. }