LHAParametersDal.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using Cksoft.Data;
  2. using DllEapEntity;
  3. using DllEapEntity.Dtos;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. namespace DllEapDal
  8. {
  9. public class LHAParametersDal
  10. {
  11. private readonly IDatabase db = null;
  12. public LHAParametersDal(IDatabase db)
  13. {
  14. this.db = db;
  15. }
  16. public LayuiModel<LHAParametersnew> Get(string fcode, DateTime? value1, DateTime? value2, string recipe, int pageIndex, int pageSize)
  17. {
  18. string str = $@" ";
  19. if (!string.IsNullOrEmpty(fcode))
  20. {
  21. str += $" and b.FCode like '%{fcode}'";
  22. }
  23. if (!string.IsNullOrEmpty(recipe))
  24. {
  25. str += $" and a.Type like '%{recipe}%'";
  26. }
  27. str += $" and a.RecTime > '{value1.Value.ToString("yyyy-MM-dd HH:mm:ss")}'";
  28. str += $" and a.RecTime < '{value2.Value.ToString("yyyy-MM-dd HH:mm:ss")}'";
  29. str += $" limit {(pageIndex - 1) * pageSize} ,{pageSize}";
  30. string ERR = String.Empty;
  31. var datas = db.FindListForCondition<LHAParametersnew>(str, ref ERR);
  32. foreach (var item in datas)
  33. {
  34. item.Type = item.Type.Split('-')[0];
  35. }
  36. var str1 = "SELECT Count(1) from ";
  37. LHAParametersnew aaParametersInfo = new LHAParametersnew();
  38. str1 += aaParametersInfo.GetQueryTabSql();
  39. str1 += " where 1=1 " + str;
  40. var total = Convert.ToInt32(db.FindObject(str1));
  41. return new LayuiModel<LHAParametersnew>
  42. {
  43. code = 1,
  44. count = total,
  45. data = datas
  46. };
  47. }
  48. }
  49. }