public MqPathModel CreateModel(DataRow dr)
        {
            var o = new MqPathModel();

            //
            if (dr.Table.Columns.Contains("id"))
            {
                o.id = dr["id"].Toint();
            }
            //mq路径
            if (dr.Table.Columns.Contains("mqpath"))
            {
                o.mqpath = dr["mqpath"].Tostring();
            }
            //该路径下mq,配置最后更新时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("lastupdatetime"))
            {
                o.lastupdatetime = dr["lastupdatetime"].ToDateTime();
            }
            //mq创建时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("createtime"))
            {
                o.createtime = dr["createtime"].ToDateTime();
            }
            return(o);
        }
Пример #2
0
        public MqPathModel CreateModel(DataRow dr)
        {
            var o = new MqPathModel();

            //
            if (dr.Table.Columns.Contains("id"))
            {
                o.id = dr["id"].Toint();
            }
            //mq路径
            if (dr.Table.Columns.Contains("mqpath"))
            {
                o.mqpath = dr["mqpath"].Tostring();
            }
            //该路径下mq,配置最后更新时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("lastupdatetime"))
            {
                o.lastupdatetime = dr["lastupdatetime"].ToDateTime();
            }
            //mq创建时间(以当前库时间为准)
            if (dr.Table.Columns.Contains("createtime"))
            {
                o.createtime = dr["createtime"].ToDateTime();
            }
            return o;
        }
Пример #3
0
        public IList<MqPathModel> GetPageList(DbConn conn, string mqpathid, string mqpath, int pageIndex, int pageSize, ref int count)
        {
            int tempCount = 0;
            IList<MqPathModel> list = new List<MqPathModel>();
            MqPathModel createM = new MqPathModel();
            var result = SqlHelper.Visit((ps) =>
            {
                StringBuilder where = new StringBuilder(" WHERE 1=1");
                if (!string.IsNullOrEmpty(mqpath))
                {
                    where.AppendFormat(" AND mqpath LIKE '%{0}%'", mqpath);
                }
                if (!string.IsNullOrEmpty(mqpathid))
                {
                    where.AppendFormat(" AND id = '{0}'", mqpathid);
                }
                string sql = "SELECT ROW_NUMBER() OVER(ORDER BY Id DESC) AS rownum,* FROM tb_mqpath  WITH(NOLOCK)";
                string countSql = "SELECT COUNT(1) FROM tb_mqpath WITH(NOLOCK)" + where;
                object obj = conn.ExecuteScalar(countSql, null);
                if (obj != DBNull.Value && obj != null)
                {
                    tempCount = LibConvert.ObjToInt(obj);
                }
                string sqlPage = string.Concat("SELECT * FROM (", sql.ToString(), where.ToString(), ") as t WHERE rownum BETWEEN ", ((pageIndex - 1) * pageSize + 1), " AND ", pageSize * pageIndex);
                DataTable dt = conn.SqlToDataTable(sqlPage, null);
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        MqPathModel model = createM.CreateModel(dr);

                        model.ProductCount = proDal.GetProductCount(conn, model.id, XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.SystemParamConfig.Producter_HeatBeat_Every_Time);
                        model.NonProductCount = proDal.GetNonProductCount(conn, model.id, XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.SystemParamConfig.Producter_HeatBeat_Every_Time);

                        model.Connsumer = new tb_consumer_partition_dal().GetActiveConsumerCount(conn,model.id);
                        model.NonConnsumer = new tb_consumer_partition_dal().GetLogoutConsumerCount(conn, model.id);

                        model.Partition = parDal.GetPartitionCountByState(conn, (int)XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.EnumMqPathPartitionState.Running, model.id);
                        model.NonPartition = parDal.GetPartitionCountByState(conn, (int)XXF.BaseService.MessageQuque.BusinessMQ.SystemRuntime.EnumMqPathPartitionState.WaitConsumeCompleted, model.id);

                        list.Add(model);
                    }
                }
                return list;
            });
            count = tempCount;
            return result;
        }