Esempio n. 1
0
        public async Task <List <PartsEntity> > GetList(PartsListParam param)
        {
            var expression = ListFilter(param);
            var list       = await this.BaseRepository().FindList(expression);

            return(list.ToList());
        }
Esempio n. 2
0
        public async Task <TData <List <PartsEntity> > > GetPageList(PartsListParam param, Pagination pagination)
        {
            TData <List <PartsEntity> > obj = new TData <List <PartsEntity> >();

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

            obj.Total = pagination.TotalCount;
            obj.Tag   = 1;
            return(obj);
        }
Esempio n. 3
0
        public async Task <TData <List <PartsEntity> > > GetList(PartsListParam param)
        {
            TData <List <PartsEntity> > obj = new TData <List <PartsEntity> >();

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

            obj.Total = obj.Data.Count;
            obj.Tag   = 1;
            return(obj);
        }
Esempio n. 4
0
        public async Task <List <PartsEntity> > GetPageList(PartsListParam 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 <PartsEntity>(sql.ToString(), pagination);

            return(data.list.ToList <PartsEntity>());
        }
Esempio n. 5
0
        private Expression <Func <PartsEntity, bool> > ListFilter(PartsListParam param)
        {
            var expression = LinqExtensions.True <PartsEntity>();

            if (param != null)
            {
                if (!string.IsNullOrEmpty(param.PartName))
                {
                    expression = expression.And(t => t.PartName.Contains(param.PartName));
                }
            }
            return(expression);
        }
Esempio n. 6
0
        /// <summary>
        /// 创建查询sql
        /// </summary>
        /// <param name="param">查询条件数据</param>
        /// <returns></returns>
        private StringBuilder CreateListSql(PartsListParam param)
        {
            StringBuilder sql = new StringBuilder();

            sql.AppendFormat(" SELECT * FROM (");
            sql.AppendFormat(" SELECT a.*,b.RealName AS BaseCreatorTxt ");
            sql.AppendFormat(" FROM  ter_parts a ");
            sql.AppendFormat(" JOIN sysuser b ON a.BaseCreatorId = b.Id ");
            sql.AppendFormat(" ) T WHERE 1=1 ");
            if (param != null)
            {
                if (!string.IsNullOrEmpty(param.PartName))
                {
                    sql.AppendFormat(" AND PartName LIKE '%{0}%'", param.PartName);
                }
            }
            return(sql);
        }
Esempio n. 7
0
        public async Task <ActionResult> GetPageListJson(PartsListParam param, Pagination pagination)
        {
            TData <List <PartsEntity> > obj = await partsBLL.GetPageList(param, pagination);

            return(Json(obj));
        }