FileParamsCommstDal.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Cksoft.Data;
  2. using DllEapEntity;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. namespace DllEapDal
  8. {
  9. public class FileParamsCommstDal
  10. {
  11. private IDatabase CurrDb;
  12. public FileParamsCommstDal(IDatabase db)
  13. {
  14. CurrDb = db;
  15. }
  16. public IEnumerable<FileParamsComMst> Get(int start, int length, string order, string sort, string filter, string errorinfo)
  17. {
  18. var pros = CurrDb.FindListForCondition<FileParamsComMst>($" {filter} order by {sort} {order} limit {start - 1},{length}", ref errorinfo).ToList();
  19. // 加入参数信息
  20. if (pros != null && pros.Count() > 0)
  21. {
  22. for (var i = 0; i < pros.Count(); i++)
  23. {
  24. var detail = CurrDb.FindListForCondition<FileParamsComDetail>($" and a.PreID='{pros[i].ID}'", ref errorinfo).ToList();
  25. // var detail = CurrDb.FindList<ParamsComDetail>(sql).ToList();
  26. if (detail == null)
  27. {
  28. detail = new List<FileParamsComDetail>();
  29. }
  30. pros[i].CurrDetails = detail;
  31. }
  32. }
  33. return pros;
  34. }
  35. public int GetCount(string filter)
  36. {
  37. string errorinfo = string.Empty;
  38. var entities = CurrDb.FindListForCondition<FileParamsComMst>(filter, ref errorinfo);
  39. if (entities != null)
  40. {
  41. return entities.Count();
  42. }
  43. return 0;
  44. }
  45. }
  46. }