AaParametersInfoDal.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 AaParametersInfoDal
  10. {
  11. private IDatabase db;
  12. public AaParametersInfoDal(IDatabase db)
  13. {
  14. this.db = db;
  15. }
  16. /// <summary>
  17. ///
  18. /// </summary>
  19. /// <param name="fcode"></param>
  20. /// <param name="value1"></param>
  21. /// <param name="value2"></param>
  22. /// <param name="recipe"></param>
  23. /// <param name="pageIndex"></param>
  24. /// <param name="pageSize"></param>
  25. /// <returns></returns>
  26. public LayuiModel<AaParametersInfo> Get(string fcode, DateTime? value1, DateTime? value2, string recipe, int pageIndex, int pageSize)
  27. {
  28. string str = $@" ";
  29. if (!string.IsNullOrEmpty(fcode))
  30. {
  31. str += $" and b.FCode like '%{fcode}'";
  32. }
  33. if (!string.IsNullOrEmpty(recipe))
  34. {
  35. str += $" and a.Type like '%{recipe}%'";
  36. }
  37. if (value1.HasValue)
  38. {
  39. str += $" and a.RecTime > '{value1.Value.ToString("yyyy-MM-dd HH:mm:ss")}'";
  40. }
  41. if (value2.HasValue)
  42. {
  43. str += $" and a.RecTime < '{value2.Value.ToString("yyyy-MM-dd HH:mm:ss")}'";
  44. }
  45. str += $" limit {(pageIndex - 1) * pageSize} ,{pageSize}";
  46. string ERR = String.Empty;
  47. var datas = db.FindListForCondition<AaParametersInfo>(str, ref ERR);
  48. foreach (var item in datas)
  49. {
  50. item.Type = item.Type.Split('-')[0];
  51. }
  52. var str1 = "SELECT Count(1) from ";
  53. AaParametersInfo aaParametersInfo = new AaParametersInfo();
  54. str1 += aaParametersInfo.GetQueryTabSql();
  55. str1 += " where 1=1 "+ str;
  56. var total = Convert.ToInt32(db.FindObject(str1));
  57. return new LayuiModel<AaParametersInfo>
  58. {
  59. code = 1,
  60. count = total,
  61. data = datas
  62. };
  63. }
  64. }
  65. }