Exemplo n.º 1
0
        /// <summary>
        /// 根据模型更新
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>是否成功</returns>
        public bool Update(Commrecommend model, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var update = new LambdaUpdate <Commrecommend>();

            if (!model.Id.IsNullOrEmpty())
            {
                update.Where(p => p.Id == model.Id);
            }
            if (!model.CommId.IsNullOrEmpty())
            {
                update.Set(p => p.CommId == model.CommId);
            }
            if (!model.OrderID.IsNullOrEmpty())
            {
                update.Set(p => p.OrderID == model.OrderID);
            }
            if (!model.FrontImage.IsNullOrEmpty())
            {
                update.Set(p => p.FrontImage == model.FrontImage);
            }
            if (!model.AttrSpan.IsNullOrEmpty())
            {
                update.Set(p => p.AttrSpan == model.AttrSpan);
            }
            if (!model.BehindImage.IsNullOrEmpty())
            {
                update.Set(p => p.BehindImage == model.BehindImage);
            }
            return(update.GetUpdateResult(connection, transaction));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据模型插入
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>是否成功</returns>
        public int InsertReturnKey(Commrecommend model, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var insert = new LambdaInsert <Commrecommend>();

            if (!model.CommId.IsNullOrEmpty())
            {
                insert.Insert(p => p.CommId == model.CommId);
            }
            if (!model.OrderID.IsNullOrEmpty())
            {
                insert.Insert(p => p.OrderID == model.OrderID);
            }
            if (!model.FrontImage.IsNullOrEmpty())
            {
                insert.Insert(p => p.FrontImage == model.FrontImage);
            }
            if (!model.AttrSpan.IsNullOrEmpty())
            {
                insert.Insert(p => p.AttrSpan == model.AttrSpan);
            }
            if (!model.BehindImage.IsNullOrEmpty())
            {
                insert.Insert(p => p.BehindImage == model.BehindImage);
            }
            return(insert.GetInsertResult(connection, transaction));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 根据模型删除数据
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>是否成功</returns>
        public bool DeleteModel(Commrecommend model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var delete = new LambdaDelete <Commrecommend>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    delete.Where(p => p.Id == model.Id);
                }
                if (!model.CommId.IsNullOrEmpty())
                {
                    delete.Where(p => p.CommId == model.CommId);
                }
                if (!model.OrderID.IsNullOrEmpty())
                {
                    delete.Where(p => p.OrderID == model.OrderID);
                }
                if (!model.FrontImage.IsNullOrEmpty())
                {
                    delete.Where(p => p.FrontImage == model.FrontImage);
                }
                if (!model.AttrSpan.IsNullOrEmpty())
                {
                    delete.Where(p => p.AttrSpan == model.AttrSpan);
                }
                if (!model.BehindImage.IsNullOrEmpty())
                {
                    delete.Where(p => p.BehindImage == model.BehindImage);
                }
            }
            return(delete.GetDeleteResult(connection, transaction));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 数据条数
        /// </summary>
        /// <param name="model">模型</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public int SelectCount(Commrecommend model = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Commrecommend>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.CommId.IsNullOrEmpty())
                {
                    query.Where(p => p.CommId == model.CommId);
                }
                if (!model.OrderID.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderID == model.OrderID);
                }
                if (!model.FrontImage.IsNullOrEmpty())
                {
                    query.Where(p => p.FrontImage == model.FrontImage);
                }
                if (!model.AttrSpan.IsNullOrEmpty())
                {
                    query.Where(p => p.AttrSpan == model.AttrSpan);
                }
                if (!model.BehindImage.IsNullOrEmpty())
                {
                    query.Where(p => p.BehindImage == model.BehindImage);
                }
            }
            return(query.GetQueryCount(connection, transaction));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 根据分页筛选数据
        /// </summary>
        /// <param name="Key">主键</param>
        /// <param name="start">开始数据</param>
        /// <param name="PageSize">页面长度</param>
        /// <param name="desc">排序</param>
        /// <param name="model">对象</param>
        /// <param name="connection">连接</param>
        /// <param name="transaction">事务</param>
        /// <returns>对象列表</returns>
        public List <Commrecommend> SelectByPage(string Key, int start, int PageSize, bool desc = true, Commrecommend model = null, string SelectFiled = null, IDbConnection connection = null, IDbTransaction transaction = null)
        {
            var query = new LambdaQuery <Commrecommend>();

            if (model != null)
            {
                if (!model.Id.IsNullOrEmpty())
                {
                    query.Where(p => p.Id == model.Id);
                }
                if (!model.CommId.IsNullOrEmpty())
                {
                    query.Where(p => p.CommId == model.CommId);
                }
                if (!model.OrderID.IsNullOrEmpty())
                {
                    query.Where(p => p.OrderID == model.OrderID);
                }
                if (!model.FrontImage.IsNullOrEmpty())
                {
                    query.Where(p => p.FrontImage == model.FrontImage);
                }
                if (!model.AttrSpan.IsNullOrEmpty())
                {
                    query.Where(p => p.AttrSpan == model.AttrSpan);
                }
                if (!model.BehindImage.IsNullOrEmpty())
                {
                    query.Where(p => p.BehindImage == model.BehindImage);
                }
            }
            if (SelectFiled != null)
            {
                SelectFiled = SelectFiled.ToLowerInvariant();
                if (SelectFiled.Contains("id,"))
                {
                    query.Select(p => new { p.Id });
                }
                if (SelectFiled.Contains("commid,"))
                {
                    query.Select(p => new { p.CommId });
                }
                if (SelectFiled.Contains("orderid,"))
                {
                    query.Select(p => new { p.OrderID });
                }
                if (SelectFiled.Contains("frontimage,"))
                {
                    query.Select(p => new { p.FrontImage });
                }
                if (SelectFiled.Contains("attrspan,"))
                {
                    query.Select(p => new { p.AttrSpan });
                }
                if (SelectFiled.Contains("behindimage,"))
                {
                    query.Select(p => new { p.BehindImage });
                }
            }
            if (Key != null)
            {
                query.OrderByKey(Key, desc);
            }
            return(query.GetQueryPageList(start, PageSize, connection, transaction));
        }
Exemplo n.º 6
0
 /// <summary>
 /// 筛选全部数据
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>对象列表</returns>
 public List <Commrecommend> SelectByModel(Commrecommend model)
 {
     return(CommrecommendOper.Instance.SelectAll(model));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 数据条数
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>对象列表</returns>
 public int SelectCount(Commrecommend model)
 {
     return(CommrecommendOper.Instance.SelectCount(model));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 根据模型插入
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>是否成功</returns>
 public int InsertReturnKey(Commrecommend model)
 {
     return(CommrecommendOper.Instance.InsertReturnKey(model));
 }
Exemplo n.º 9
0
 /// <summary>
 /// 根据模型插入
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>是否成功</returns>
 public bool Insert(Commrecommend model)
 {
     return(CommrecommendOper.Instance.Insert(model));
 }
Exemplo n.º 10
0
 /// <summary>
 /// 根据模型更新
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>是否成功</returns>
 public bool Update(Commrecommend model)
 {
     return(CommrecommendOper.Instance.Update(model));
 }
Exemplo n.º 11
0
 /// <summary>
 /// 根据模型删除数据
 /// </summary>
 /// <param name="model">模型</param>
 /// <returns>是否成功</returns>
 public bool DeleteModel(Commrecommend model)
 {
     return(CommrecommendOper.Instance.DeleteModel(model));
 }
Exemplo n.º 12
0
 /// <summary>
 /// 根据分页筛选数据
 /// </summary>
 /// <param name="Key">主键</param>
 /// <param name="start">开始数据</param>
 /// <param name="PageSize">页面长度</param>
 /// <param name="desc">排序</param>
 /// <param name="model">对象</param>
 /// <returns>对象列表</returns>
 public List <Commrecommend> SelectByPage(string Key, int start, int PageSize, bool desc, Commrecommend model, string SelectFiled)
 {
     return(CommrecommendOper.Instance.SelectByPage(Key, start, PageSize, desc, model));
 }