SetDataRepository.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. 
  2. using OASystem.Domain;
  3. using OASystem.Domain.Dtos.UserDto;
  4. using OASystem.Domain.Entities.System;
  5. using OASystem.Domain.ViewModels.System;
  6. namespace OASystem.Infrastructure.Repositories.System
  7. {
  8. public class SetDataRepository : BaseRepository<Sys_SetData, SetDataView>
  9. {
  10. public SetDataRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
  11. {
  12. }
  13. /// <summary>
  14. /// 获取所有系统模块
  15. /// </summary>
  16. /// <param name="_SetData"></param>
  17. /// <returns></returns>
  18. public async Task<Result> GetSySDefultModule(SetDataRepository _SetData)
  19. {
  20. Result result = new Result();
  21. string sql = "select * from Sys_SetData where STid = 5 and isdel = 0";
  22. var DBdata = await _SetData.GetListBySqlWithNolockAsync(sql);
  23. if (DBdata == null || DBdata.Count == 0)
  24. {
  25. return result;
  26. }
  27. result.Data = DBdata.Select(x=> new SetDataView
  28. {
  29. Name = x.Name,
  30. STid = x.STid,
  31. Id = x.Id,
  32. });
  33. result.Code = 0;
  34. result.Msg = "成功!";
  35. return result;
  36. }
  37. /// <summary>
  38. /// 获取类型Data By STId
  39. /// </summary>
  40. /// <param name="_SetData"></param>
  41. /// <returns></returns>
  42. public async Task<Result> GetSetDataBySTId(SetDataRepository _SetData,int stId)
  43. {
  44. Result result = new Result();
  45. string sql = string.Format(@"select * from Sys_SetData where STid = {0} and isdel = 0",stId);
  46. var DBdata = await _SetData.GetListBySqlWithNolockAsync(sql);
  47. if (DBdata == null || DBdata.Count == 0)
  48. {
  49. return result;
  50. }
  51. result.Data = DBdata.Select(x => new SetDataInfoView
  52. {
  53. Name = x.Name,
  54. Id = x.Id,
  55. });
  56. result.Code = 0;
  57. result.Msg = "成功!";
  58. return result;
  59. }
  60. }
  61. }