using Cksoft.Data; using System; using System.Collections.Generic; using System.Text; using DllEapEntity.OFILM; using System.Linq; namespace DllEapDal.OFILM { public class MacCheckDal { private IDatabase CurrDb; public MacCheckDal(IDatabase db) { CurrDb = db; } public IEnumerable GetCheckDtos(int start, int length, string order, string sort, string filter, string subFilter, string errorinfo, out int total) { var sql = $@"select tt.maccode,tt.checkmode checktype,tt.rectime checktime,b.paramCode,b.paramval paramvalue,d.fcode macmodel from (select a.maccode,a.id,a.checkmode,a.rectime from maccheckmst a where 1=1 {filter}) tt left join maccheckdetail b on tt.id=b.MacCheckMstID left join machine c on tt.maccode=c.FCode left join macmodel d on c.mmodeid=c.id where 1=1 {subFilter}"; var datas = CurrDb.FindList(sql); sql = $@"select count(1) from (select a.maccode,a.id,a.checkmode,a.rectime from maccheckmst a where 1=1 {filter}) tt left join maccheckdetail b on tt.id=b.MacCheckMstID left join machine c on tt.maccode=c.FCode left join macmodel d on c.mmodeid=c.id where 1=1 {subFilter}"; total = Convert.ToInt32(CurrDb.FindList(sql).FirstOrDefault() ?? "-1"); return datas; } } }