123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using Cksoft.Data;
- using DllEapEntity;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace DllEapDal
- {
- public class FileParamsCommstDal
- {
- private IDatabase CurrDb;
- public FileParamsCommstDal(IDatabase db)
- {
- CurrDb = db;
- }
- public IEnumerable<FileParamsComMst> Get(int start, int length, string order, string sort, string filter, string errorinfo)
- {
- var pros = CurrDb.FindListForCondition<FileParamsComMst>($" {filter} order by {sort} {order} limit {start - 1},{length}", ref errorinfo).ToList();
- // 加入参数信息
- if (pros != null && pros.Count() > 0)
- {
- for (var i = 0; i < pros.Count(); i++)
- {
- var detail = CurrDb.FindListForCondition<FileParamsComDetail>($" and a.PreID='{pros[i].ID}'", ref errorinfo).ToList();
- // var detail = CurrDb.FindList<ParamsComDetail>(sql).ToList();
- if (detail == null)
- {
- detail = new List<FileParamsComDetail>();
- }
- pros[i].CurrDetails = detail;
- }
- }
- return pros;
- }
- public int GetCount(string filter)
- {
- string errorinfo = string.Empty;
- var entities = CurrDb.FindListForCondition<FileParamsComMst>(filter, ref errorinfo);
- if (entities != null)
- {
- return entities.Count();
- }
- return 0;
- }
- }
- }
|