/// <summary>
        /// 查询集合,带分页
        /// </summary>
        /// <param name="item">框架实体</param>
        /// <param name="dp">分页对象</param>
        /// <returns>对象集合</returns>
        public List <T> SelectList(FrameWorkItem item, DataPage dp = null)
        {
            IDataReader dr = null;

            try
            {
                dr = BuildDataReader(item, dp);

                List <T> list = new List <T>();
                if (dp != null && dp.PageSize > 0)
                {
                    int result = GetResult <int>(string.Format("SELECT COUNT(1) FROM ({0}) a", item.Sql), item.ConnectionString, item.SqlParam);
                    dp.RowCount = result;
                }
                while (dr != null && dr.Read())
                {
                    T tempT = new T();
                    tempT = DynamicBuilderEntity <T> .CreateBuilder(dr).Build(dr);

                    list.Add(tempT);
                }
                return(list);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }
        }
        /// <summary>
        /// 查询单个实体
        /// </summary>
        /// <param name="item">框架实体</param>
        /// <returns>单个对象</returns>
        public T SelectModel(FrameWorkItem item)
        {
            IDataReader dr = null;

            try
            {
                dr = BuildDataReader(item);
                if (dr != null && dr.Read())
                {
                    return(DynamicBuilderEntity <T> .CreateBuilder(dr).Build(dr));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }
            return(default(T));
        }
        /// <summary>
        /// 查询表格数据
        /// </summary>
        /// <param name="item">框架实体</param>
        /// <param name="dp">分页对象</param>
        /// <returns></returns>
        public DataTable SelectDataTable(FrameWorkItem item, DataPage dp = null)
        {
            IDataReader dr     = null;
            DataTable   result = new DataTable();

            try
            {
                dr = BuildDataReader(item, dp);
                var datasSet = dr.ToDataSet();
                if (datasSet.Tables.Count > 0)
                {
                    result = datasSet.Tables[0];
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
            }
        }
        /// <summary>
        /// 根据框架实体,条件式的选用sqlhelper
        /// </summary>
        /// <param name="item">框架实体</param>
        /// <param name="dp">分页</param>
        /// <returns>IDataReader</returns>
        private IDataReader BuildDataReader(FrameWorkItem item, DataPage dp = null)
        {
            var sql        = DalAid.CreatePageQuerySql(item.Sql, dp, dbType);
            var connection = new MySqlConnection(item.ConnectionString);
            var cmd        = GetCommand(sql, item.ConnectionString, item.SqlParam);
            var cnt        = cmd.ExecuteReader();

            return(cnt);
        }
        /// <summary>
        /// 执行查询,并返回查询所返回的结果集中第一行的第一列。 忽略额外的列或行。
        /// </summary>
        /// <param name="item">参数</param>
        /// <returns>结果</returns>
        public object ExecuteScalar(FrameWorkItem item)
        {
            object result = null;;

            try
            {
                using (var cmd = GetCommand(item.Sql, item.ConnectionString, item.SqlParam))
                {
                    if (cmd != null)
                    {
                        result = cmd.ExecuteScalar();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message + "\r\n" + item.Sql);
            }
            return(result);
        }