public async Task <List <OrderMaterielDetailEntity> > GetList(OrderMaterielDetailListParam param)
        {
            var expression = ListFilter(param);
            var list       = await this.BaseRepository().FindList(expression);

            return(list.ToList());
        }
        private Expression <Func <OrderMaterielDetailEntity, bool> > ListFilter(OrderMaterielDetailListParam param)
        {
            var expression = LinqExtensions.True <OrderMaterielDetailEntity>();

            if (param != null)
            {
            }
            return(expression);
        }
        public async Task <TData <List <OrderMaterielDetailEntity> > > GetPageList(OrderMaterielDetailListParam param, Pagination pagination)
        {
            TData <List <OrderMaterielDetailEntity> > obj = new TData <List <OrderMaterielDetailEntity> >();

            obj.Data = await orderMaterielDetailService.GetPageList(param, pagination);

            obj.Total = pagination.TotalCount;
            obj.Tag   = 1;
            return(obj);
        }
        public async Task <TData <List <OrderMaterielDetailEntity> > > GetList(OrderMaterielDetailListParam param)
        {
            TData <List <OrderMaterielDetailEntity> > obj = new TData <List <OrderMaterielDetailEntity> >();

            obj.Data = await orderMaterielDetailService.GetList(param);

            obj.Total = obj.Data.Count;
            obj.Tag   = 1;
            return(obj);
        }
        public async Task <List <OrderMaterielDetailEntity> > GetPageList(OrderMaterielDetailListParam param, Pagination pagination)
        {
            /*
             * var expression = ListFilter(param);
             * var list= await this.BaseRepository().FindList(expression, pagination);
             * return list.ToList();
             */
            StringBuilder sql  = CreateListSql(param);
            var           data = await this.BaseRepository().FindList <OrderMaterielDetailEntity>(sql.ToString(), pagination);

            return(data.list.ToList <OrderMaterielDetailEntity>());
        }
        /// <summary>
        /// 创建查询sql
        /// </summary>
        /// <param name="param">查询条件数据</param>
        /// <returns></returns>
        private StringBuilder CreateListSql(OrderMaterielDetailListParam param)
        {
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat(" select a.*,b.RealName AS BaseCreatorTxt,c.MaterielName from  ");
            sql.AppendFormat(" (");
            sql.AppendFormat("  SELECT * FROM order_materiel_detail ");
            sql.AppendFormat("  where 1=1 ");
            if (param != null)
            {
                if (param.MaterielId > 0)
                {
                    sql.AppendFormat(" AND MaterielId ={0}", param.MaterielId);
                }
                if (!string.IsNullOrEmpty(param.Flag))
                {
                    if (param.Flag == "-")
                    {
                        sql.AppendFormat(" and ChangeNum < 0");
                    }
                    else if (param.Flag == "+")
                    {
                        sql.AppendFormat(" and ChangeNum > 0");
                    }
                }
                if (!string.IsNullOrEmpty(param.StartTime))
                {
                    sql.AppendFormat(" AND BaseCreateTime >'{0} 00:00:00'", param.StartTime);
                }
                if (!string.IsNullOrEmpty(param.EndTime))
                {
                    sql.AppendFormat(" AND BaseCreateTime <'{0} 23:59:59'", param.EndTime);
                }
            }
            sql.AppendFormat(" ) a ");
            sql.AppendFormat(" join ");
            sql.AppendFormat(" ( ");
            sql.AppendFormat("   select Id,RealName from sysuser ");
            sql.AppendFormat("   where 1=1 ");

            sql.AppendFormat(" ) b");
            sql.AppendFormat(" on a.BaseCreatorId =b.Id ");

            sql.AppendFormat(" join ");
            sql.AppendFormat(" ( ");
            sql.AppendFormat("   select Id,MaterielName from order_materiel ");
            sql.AppendFormat("   where 1=1 ");

            sql.AppendFormat(" ) c");
            sql.AppendFormat(" on a.MaterielId =c.Id ");
            return(sql);
        }
Beispiel #7
0
        public async Task <ActionResult> GetPageListJson(OrderMaterielDetailListParam param, Pagination pagination)
        {
            TData <List <OrderMaterielDetailEntity> > obj = await orderMaterielDetailBLL.GetPageList(param, pagination);

            return(Json(obj));
        }