12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- using Cksoft.Data;
- using DllEapEntity;
- using DllEapEntity.Dtos;
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace DllEapDal
- {
- public class AaParametersInfoDal
- {
- private IDatabase db;
- public AaParametersInfoDal(IDatabase db)
- {
- this.db = db;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="fcode"></param>
- /// <param name="value1"></param>
- /// <param name="value2"></param>
- /// <param name="recipe"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public LayuiModel<AaParametersInfo> Get(string fcode, DateTime? value1, DateTime? value2, string recipe, int pageIndex, int pageSize)
- {
- string str = $@" ";
- if (!string.IsNullOrEmpty(fcode))
- {
- str += $" and b.FCode like '%{fcode}'";
- }
- if (!string.IsNullOrEmpty(recipe))
- {
- str += $" and a.Type like '%{recipe}%'";
- }
- if (value1.HasValue)
- {
- str += $" and a.RecTime > '{value1.Value.ToString("yyyy-MM-dd HH:mm:ss")}'";
- }
- if (value2.HasValue)
- {
- str += $" and a.RecTime < '{value2.Value.ToString("yyyy-MM-dd HH:mm:ss")}'";
- }
- str += $" limit {(pageIndex - 1) * pageSize} ,{pageSize}";
- string ERR = String.Empty;
- var datas = db.FindListForCondition<AaParametersInfo>(str, ref ERR);
- foreach (var item in datas)
- {
- item.Type = item.Type.Split('-')[0];
- }
- var str1 = "SELECT Count(1) from ";
- AaParametersInfo aaParametersInfo = new AaParametersInfo();
- str1 += aaParametersInfo.GetQueryTabSql();
- str1 += " where 1=1 "+ str;
- var total = Convert.ToInt32(db.FindObject(str1));
- return new LayuiModel<AaParametersInfo>
- {
- code = 1,
- count = total,
- data = datas
- };
- }
- }
- }
|