Beispiel #1
0
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="condition">条件</param>
        /// <returns></returns>
        public int Delete(object condition)
        {
            SqlQuery query = SqlQueryUtil.BuildDelete(condition, _tableName);

            return(GetDataAccess().ExecuteNonQuery(query));
        }
Beispiel #2
0
        /// <summary>
        /// 根据条件获取Dto
        /// </summary>
        /// <typeparam name="TDto"></typeparam>
        /// <param name="condition"></param>
        /// <param name="ignoreFields"></param>
        /// <param name="isWrite"></param>
        /// <returns></returns>
        public TDto GetDto <TDto>(object condition, string[] ignoreFields = null, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <TDto>(condition, _tableName);

            return(GetDataAccess(isWrite).QuerySingleOrDefault <TDto>(query));
        }
Beispiel #3
0
        /// <summary>
        /// 获取分页查询
        /// </summary>
        /// <typeparam name="TModel"></typeparam>
        /// <param name="selectColumn"></param>
        /// <param name="selectTable"></param>
        /// <param name="where"></param>
        /// <param name="order"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="cmdParms"></param>
        /// <returns></returns>
        public IEnumerable <TModel> PageQuery <TModel>(string selectColumn, string selectTable, string where, string order, int pageIndex, int pageSize, object cmdParms = null)
        {
            SqlQuery query = SqlQueryUtil.BuilderPageSqlQuery(selectColumn, selectTable, where, order, pageIndex, pageSize, cmdParams: cmdParms);

            return(GetDataAccess().Query <TModel>(query));
        }
Beispiel #4
0
        /// <summary>
        /// 更新记录
        /// </summary>
        /// <param name="data"></param>
        /// <param name="condition"></param>
        /// <param name="ignoreFields"></param>
        /// <returns></returns>
        public int Update(object data, object condition, string[] ignoreFields = null)
        {
            SqlQuery query = SqlQueryUtil.BuildUpdate(data, condition, _tableName, ignoreFields);

            return(GetDataAccess(true).ExecuteNonQuery(query));
        }
Beispiel #5
0
        /// <summary>
        /// 查询列表
        /// </summary>
        /// <typeparam name="TDto"></typeparam>
        /// <param name="condition"></param>
        /// <param name="ignoreFields"></param>
        /// <param name="isWrite"></param>
        /// <returns></returns>
        public IEnumerable <TDto> QueryList <TDto>(object condition, string[] ignoreFields = null, string orderBy = "", int top = 0, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <TDto>(condition, _tableName, ignoreFields, top: top);

            return(GetDataAccess(isWrite).Query <TDto>(query));
        }
Beispiel #6
0
        /// <summary>
        /// 查询列表
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="isWrite"></param>
        /// <returns></returns>
        public IEnumerable <T> QueryList(object condition, int top = 0, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <T>(condition, _tableName, top: top);

            return(GetDataAccess(isWrite).Query <T>(query));
        }
Beispiel #7
0
        /// <summary>
        /// 获取查询列表
        /// </summary>
        /// <param name="isWrite"></param>
        /// <returns></returns>
        public IEnumerable <T> QueryList(bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery <T>(null, _tableName);

            return(GetDataAccess(isWrite).Query <T>(query));
        }
Beispiel #8
0
        /// <summary>
        /// 查询数量结果
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="isWrite"></param>
        /// <returns></returns>
        public int QueryCount(object condition, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQueryCountSqlQuery(condition, _tableName);

            return(GetDataAccess(isWrite).ExecuteScalar <int>(query));
        }
Beispiel #9
0
        /// <summary>
        /// 获取Info
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="ignoreFields"></param>
        /// <param name="isWrite"></param>
        /// <returns></returns>
        public T GetInfo(object condition, string[] ignoreFields = null, bool isWrite = false)
        {
            SqlQuery query = SqlQueryUtil.BuilderQuerySqlQuery(condition, _tableName, ignoreFields);

            return(GetDataAccess().QuerySingleOrDefault <T>(query));
        }