MacCheckDal.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using Cksoft.Data;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using DllEapEntity.OFILM;
  6. using System.Linq;
  7. namespace DllEapDal.OFILM
  8. {
  9. public class MacCheckDal
  10. {
  11. private IDatabase CurrDb;
  12. public MacCheckDal(IDatabase db)
  13. {
  14. CurrDb = db;
  15. }
  16. public IEnumerable<MacCheckDto> GetCheckDtos(int start, int length, string order, string sort, string filter, string subFilter, string errorinfo, out int total)
  17. {
  18. var sql = $@"select tt.maccode,tt.checkmode checktype,tt.rectime checktime,b.paramCode,b.paramval paramvalue,d.fcode macmodel
  19. from (select a.maccode,a.id,a.checkmode,a.rectime from maccheckmst a where 1=1 {filter}) tt
  20. left join maccheckdetail b on tt.id=b.MacCheckMstID
  21. left join machine c on tt.maccode=c.FCode
  22. left join macmodel d on c.mmodeid=c.id
  23. where 1=1 {subFilter}";
  24. var datas = CurrDb.FindList<MacCheckDto>(sql);
  25. sql = $@"select count(1)
  26. from (select a.maccode,a.id,a.checkmode,a.rectime from maccheckmst a where 1=1 {filter}) tt
  27. left join maccheckdetail b on tt.id=b.MacCheckMstID
  28. left join machine c on tt.maccode=c.FCode
  29. left join macmodel d on c.mmodeid=c.id
  30. where 1=1 {subFilter}";
  31. total = Convert.ToInt32(CurrDb.FindList<string>(sql).FirstOrDefault() ?? "-1");
  32. return datas;
  33. }
  34. }
  35. }