public string GetPageSql(string sql, OrderClause clause) { return string.Format(@"SELECT t.*,count(1) over() recountCount FROM (SELECT T.*, ROWNUM RN FROM ({0}) T WHERE ROWNUM <= {2}) T WHERE RN > {1}", sql, (clause.PageIndex - 1)*clause.PageSize, clause.PageIndex*clause.PageSize); }
public List<WorkDetailInfoEntity> GetAllWorkOrder(OrderClause clause) { try { return Dal.GetAllWorkOrder(clause); } catch (Exception e) { LogManager.Instance.Log.Info(e.ToString()); } return new List<WorkDetailInfoEntity>(); }
public List<WorkDetailInfoEntity> GetAllWorkOrder(OrderClause clause) { var schem = ConfigureManager.Logsever.ProvinceConfig.DefaultSchem; if (GetFilter().ProvinceId != 0) { var helperDal = new HelperDal(); schem = helperDal.GetDbUser(Convert.ToInt32(GetFilter().ProvinceId)); } var subGroups = QueryBySql<WorkSubItemGroupEntity>(GetPageSql(string.Format( @" select distinct t.id,t.work_id,t.group_name,t.create_date,r.build_auid,count(1) over() recordCount from {0}.work_sub_item_group t left join work_report_building r on t.work_id=r.work_id and t.id=r.s_group_id where t.WORK_ID like '%{1}%' group by t.work_id,t.group_name,t.create_date,t.id,r.build_auid order by t.create_date desc", schem, clause.WorkId), clause)); if (subGroups.Count > 0) { var workOrders = QueryBySql<WorkDetailInfoEntity>( string.Format("select * from {1}.work_detail_info t where t.work_id in ({0})", string.Join(",", subGroups.GroupBy(d => d.WorkId).Select(d => d.Key)), schem)); foreach (var workSubItemGroupEntity in subGroups) { WorkSubItemGroupEntity entity = workSubItemGroupEntity; var orders = workOrders.Where(d => d.WorkId == entity.WorkId); if (orders.Any()) { var order = orders.First(); if (order != null && order.WorkSubItemGroup != null) { LogManager.Instance.Log.Info("sss"+order.WorkId); order = DeepCopy.DeepCopyEntity(order); workOrders.Add(order); } order.WorkSubItemGroup = entity; if (entity.BuildingId != null) { order.HaveQuality = true; } } } return workOrders.ToList(); } return new List<WorkDetailInfoEntity>(); }
public List<WorkDetailInfoEntity> GetAllWorkOrder(OrderClause clause) { return Bll.GetAllWorkOrder(clause); }