/// <summary> /// 设置条件 /// </summary> /// <param name="command"></param> /// <param name="filter"></param> private static void SetCondition(DataCommand command, ExamTestFilter filter) { //测验类型 if (filter.mode.HasValue) { command.QuerySetCondition("t.mode", ConditionOperation.Equal, DbType.Int32, filter.mode.Value); } //针对文档 if (!string.IsNullOrEmpty(filter.document_name)) { command.QuerySetCondition("d.name", ConditionOperation.Like, DbType.String, filter.document_name); } //针对模拟考试 if (filter.examid.HasValue) { command.QuerySetCondition("t.exam_id", ConditionOperation.Equal, DbType.Int32, filter.examid.Value); } //开始日期 if (filter.StartTime.HasValue) { command.QuerySetCondition("t.begin_time", ConditionOperation.MoreThanEqual, DbType.DateTime, filter.StartTime); } //结束日期 if (filter.EndTime.HasValue) { command.QuerySetCondition("t.begin_time", ConditionOperation.LessThan, DbType.DateTime, filter.EndTime.Value.AddDays(1)); } command.ReplaceAndSetSQLTag("TagOrder" + filter.sortColumn, filter.sortColumn); command.CommandText = command.CommandText.Replace("#STRWHERE#", command.QueryConditionString); }
public static List <ReportChartVO> ActivityStatisticsChart(QF_Report filter) { var cmd = new DataCommand("Report.ActivityStatisticsChart"); string formatKey = GetFormatKey(filter.DateTimeType.Value); cmd.SetParameter("@FormatDate", DbType.String, formatKey); cmd.QuerySetCondition("tud.create_time", ConditionOperation.MoreThanEqual, DbType.DateTime, filter.StartTime); cmd.QuerySetCondition("tud.create_time", ConditionOperation.LessThan, DbType.DateTime, handleEndTime(filter.EndTime)); if (filter.DepartmentId.HasValue) { cmd.ReplaceAndSetSQLTag("TagFilterDepartment"); cmd.QuerySetCondition("tud2.department_id", ConditionOperation.Equal, DbType.Int32, filter.DepartmentId); } else { cmd.ReplaceSQLTag("TagFilterDepartment", string.Empty); } if (filter.DateTimeType.Value == DateTimeTypeEnum.Week) { cmd.CommandText = cmd.CommandText.Replace("#filterDistinct#", string.Empty); } else { cmd.CommandText = cmd.CommandText.Replace("#filterDistinct#", "distinct "); } cmd.CommandText = cmd.CommandText.Replace("#STRWHERE#", cmd.QueryConditionString); return(cmd.ExecuteEntityList <ReportChartVO>()); }
private static void SetCondition(DataCommand command, QF_Subject filter, string type) { if (!string.IsNullOrEmpty(filter.Keyword)) { command.ReplaceAndSetSQLTag("TagFilterKeyword", filter.Keyword); command.ReplaceSQLTag("TagFilterKeyword", string.Empty); } else { command.ReplaceSQLTag("TagFilterKeyword", string.Empty); } command.QuerySetCondition("ts.create_time", ConditionOperation.MoreThanEqual, DbType.DateTime, filter.StartTime); if (filter.EndTime.HasValue) { command.QuerySetCondition("ts.create_time", ConditionOperation.LessThan, DbType.DateTime, filter.EndTime.Value.AddDays(1)); } command.QuerySetCondition("tc.id", ConditionOperation.Equal, DbType.Int32, filter.CatId); command.QuerySetCondition("ts.department_id", ConditionOperation.Equal, DbType.Int32, filter.DepartmentId); command.QuerySetCondition("ts.is_delete", ConditionOperation.Equal, DbType.Int32, DeletedEnums.Actived); if (type == "Search") { command.QuerySetCondition("d.name", ConditionOperation.Like, DbType.String, filter.VendorName); } else { command.QuerySetCondition("vn.name", ConditionOperation.Like, DbType.String, filter.VendorName); } command.CommandText = command.CommandText.Replace("#STRWHERE#", command.QueryConditionString); }
public static QueryResult <ProductVendorStatisticsVO> ProductVendorStatisticsList(QF_Report filter) { var cmd = new DataCommand("Report.ProductVendorStatisticsList"); if (filter.StatisticsObject == StatisticsObject.Product) { cmd.ReplaceAndSetSQLTag("TagProductFragment"); cmd.ReplaceSQLTag("TagVendorFragment", string.Empty); } else { cmd.ReplaceAndSetSQLTag("TagVendorFragment"); cmd.ReplaceSQLTag("TagProductFragment", string.Empty); } cmd.QuerySetCondition("ts.create_time", ConditionOperation.MoreThanEqual, DbType.DateTime, filter.StartTime); cmd.QuerySetCondition("ts.create_time", ConditionOperation.LessThan, DbType.DateTime, handleEndTime(handleEndTime(filter.EndTime))); cmd.QuerySetCondition("ts.department_id", ConditionOperation.Equal, DbType.Int32, filter.DepartmentId); cmd.QuerySetCondition("ts.is_delete", ConditionOperation.Equal, DbType.Int32, DeletedEnums.Actived); cmd.CommandText = cmd.CommandText.Replace("#STRWHERE#", cmd.QueryConditionString); return(cmd.Query <ProductVendorStatisticsVO>(filter, "count(1) DESC", null, true)); }
/// <summary> /// 设置条件 /// </summary> /// <param name="command"></param> /// <param name="filter"></param> private static void SetCondition(DataCommand command, TestStatisticsFilter filter) { //测验类型 if (filter.mode.HasValue) { command.QuerySetCondition("t.mode", ConditionOperation.Equal, DbType.Int32, filter.mode.Value); } //统计模式 if (filter.statisticsMode == 1)//1:个人了联系 { //个人练习 command.ReplaceAndSetSQLTag("TagFilterdocument_id", ""); //针对文档 个人练习才有文档 if (!string.IsNullOrEmpty(filter.document_name)) { command.QuerySetCondition("d.name", ConditionOperation.Like, DbType.String, filter.document_name); } } else { //模拟考试 command.ReplaceAndSetSQLTag("TagFilterexam_id", ""); } if (filter.statisticsObj == 1) { //单位 command.ReplaceAndSetSQLTag("TagGroupDpName", ""); command.ReplaceAndSetSQLTag("TagColumnDpName", ""); } else { //个人 command.ReplaceAndSetSQLTag("TagGroupUName", ""); command.ReplaceAndSetSQLTag("TagColumnUName", ""); } //针对模拟考试 if (filter.examid.HasValue) { command.QuerySetCondition("t.exam_id", ConditionOperation.Equal, DbType.Int32, filter.examid.Value); } //开始日期 if (filter.StartTime.HasValue) { command.QuerySetCondition("t.begin_time", ConditionOperation.MoreThanEqual, DbType.DateTime, filter.StartTime); } //结束日期 if (filter.EndTime.HasValue) { command.QuerySetCondition("t.begin_time", ConditionOperation.LessThan, DbType.DateTime, filter.EndTime.Value.AddDays(1)); } command.ReplaceAndSetSQLTag("TagOrder" + filter.sortColumn, filter.sortColumn); command.CommandText = command.CommandText.Replace("#STRWHERE#", command.QueryConditionString); }