public PageData <IEntity> ToList(int pageIndex, int pageSize) { string text = ""; //先取出OrderByClip中的item,再取出WhereClip中的item foreach (ItemStruct item in OrderByClip) { if (text.Length > 0) { text += ","; } text = item.Value + ""; } string groupByStr = GroupByClip.ToString(); PageData <IEntity> pageData = new PageData <IEntity>(); if (WhereClip.Count <= 0) { //没有where条件,直接返回结果,使用sqlSetting的SerchSQL语句模型 List <string> list = excuteImport.sqlSetting.Search_sql(TableName, GetSelectField(), GetJoin(), "", text, groupByStr, pageIndex, pageSize, true, PrimaryKey, 2018); return(excuteImport.ExecutePagerData <IEntity>(list[0], list[1], null)); } //有Where条件,添加Dbparamerts List <DbParameter> parameters = new List <DbParameter>(); string sqlWhereClip = ""; WhereClip.GetPartmerStrings(excuteImport, ref sqlWhereClip, ref parameters); List <string> list2 = excuteImport.sqlSetting.Search_sql(TableName, GetSelectField(), GetJoin(), sqlWhereClip, text, groupByStr, pageIndex, pageSize, true, PrimaryKey, 2018); return(excuteImport.ExecutePagerData <IEntity>(list2[0], list2[1], parameters)); }
private string GetCondition(bool flag) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(GetJoin()); if (WhereClip.Count > 0) { string sqlWhereClip = ""; List <DbParameter> parameters = new List <DbParameter>(); WhereClip.GetPartmerStrings(excuteImport, ref sqlWhereClip, ref parameters); lstDbParmeters.AddRange(parameters); if (flag) { //是where条件语句的头部 stringBuilder.Append(" WHERE " + sqlWhereClip); } else { stringBuilder.Append(" AND " + sqlWhereClip); } } if (GroupByClip.Count > 0) { stringBuilder.Append(" GROUP BY " + GroupByClip.ToString()); } if (OrderByClip.Count > 0) { stringBuilder.Append(" ORDER BY " + OrderByClip.ToString()); } return(stringBuilder.ToString()); }
public ReflectionGenerics SetGroupByClip(GroupByClip groupByClip) { foreach (Column item in groupByClip) { GroupByClip.Add(item); } return(this); }
public void ClearCondition() { SelectName = new SelectName(); InsertClip = new InsertClip(); UpdateClip = new UpdateClip(); OrderByClip = new OrderByClip(); GroupByClip = new GroupByClip(); WhereClip = new WhereClip(); OtherT = new List <string>(); SKipNum = 0; TakeNum = 0; lstDbParmeters = new List <DbParameter>(); }
public void GetCondition(ref StringBuilder strBuilder) { strBuilder.Append(GetJoin()); if (WhereClip.Count > 0) { string sqlWhereClip = ""; List <DbParameter> parameters = new List <DbParameter>(); WhereClip.GetPartmerStrings(excuteImport, ref sqlWhereClip, ref parameters); lstDbParmeters.AddRange(parameters); strBuilder.Append(" WHERE " + sqlWhereClip); } if (GroupByClip.Count > 0) { strBuilder.Append(" GROUP BY " + GroupByClip.ToString()); } if (OrderByClip.Count > 0) { strBuilder.Append(" ORDER BY " + OrderByClip.ToString()); } }
public ReflectionGenerics SetGroupByClip(Column groupByClip) { GroupByClip.Add(groupByClip); return(this); }
public string GetSelectJsons(SelectName selectClip, WhereClip whereClip, OrderByClip orderByClip, GroupByClip groupByClip, int pageIndex, int pageSize, Dictionary <string, Dictionary <string, string> > dtConvert = null) { PageData <T> page = EntityGenerics <DB, T> .Instance.Select(selectClip).SetWhereClip(whereClip) .SetOrderByClip(orderByClip).SetGroupByClip(groupByClip).ToList(pageSize, pageIndex); page.Rows = ChangeSource(page.Rows, dtConvert); return(JsonConvert.SerializeObject((object)page, dateTimeJsonSerializerSettings)); }
public PageData <T> GetSelect(SelectName selectClip, WhereClip whereClip, OrderByClip orderByClip, GroupByClip groupByClip, int pageIndex, int pageSize, Dictionary <string, Dictionary <string, string> > dtConvert = null) { PageData <T> page = EntityGenerics <DB, T> .Instance.Select(selectClip).SetWhereClip(whereClip) .SetOrderByClip(orderByClip).SetGroupByClip(groupByClip).ToList(pageSize, pageIndex); page.Rows = ChangeSource(page.Rows, dtConvert); return(page); }
public string GetSelectJsons(SelectName selectClip, WhereClip whereClip, OrderByClip orderByClip, GroupByClip groupByClip, Dictionary <string, Dictionary <string, string> > dtConvert = null) { IEnumerable <T> lst = EntityGenerics <DB, T> .Instance.Select(selectClip).SetWhereClip(whereClip) .SetOrderByClip(orderByClip).SetGroupByClip(groupByClip).ToList(); lst = ChangeSource(lst, dtConvert); return(JsonConvert.SerializeObject((object)lst, DateTimeJsonSerializerSettings)); }
public IEnumerable <T> GetSelect(SelectName selectClip, WhereClip whereClip, OrderByClip orderByClip, GroupByClip groupByClip, Dictionary <string, Dictionary <string, string> > dtConvert = null) { IEnumerable <T> lst = EntityGenerics <DB, T> .Instance.Select(selectClip).SetWhereClip(whereClip) .SetOrderByClip(orderByClip).SetGroupByClip(groupByClip).ToList(); return(ChangeSource(lst, dtConvert)); }