Esempio n. 1
0
        /// <summary>
        /// 获取数据列表(分页)
        /// </summary>
        public PageModel GetDataListForPage(ProcessingTechnologyRequest request)
        {
            //组装查询语句
            #region 模糊搜索条件

            var where = new Where <TbProcessingTechnology>();
            if (!string.IsNullOrWhiteSpace(request.ProcessingTechnologyName))
            {
                where.And(p => p.ProcessingTechnologyName == request.ProcessingTechnologyName);
            }

            #endregion

            try
            {
                var ret = Db.Context.From <TbProcessingTechnology>()
                          .Select(
                    TbProcessingTechnology._.All
                    , TbProcessingTechnology._.ProcessingTechnologyName.As("PProcessingTechnologyName"))
                          .LeftJoin <TbProcessingTechnology>((a, c) => a.PID == c.ID).Where(where).OrderByDescending(d => d.ID).ToPageList(request.rows, request.page);
                return(ret);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        public DataTable GetExportList(ProcessingTechnologyRequest request)
        {
            string sql  = @"select Tb1.ProcessingTechnologyName as PProcessingTechnologyName,Tb2.ProcessingTechnologyName,Tb1.childCount from (select tb1.ID,tb1.ProcessingTechnologyName,tb1.Sort,COUNT(tb1.ID) as childCount from TbProcessingTechnology tb1
left join TbProcessingTechnology tb2 on tb1.ID=tb2.PID
where tb2.ID is not null group by tb1.ID,tb1.ProcessingTechnologyName,tb1.Sort) Tb1
left join TbProcessingTechnology Tb2 on Tb1.ID=Tb2.PID order by Tb1.Sort,Tb2.Sort asc";
            var    data = Db.Context.FromSql(sql).ToDataTable();

            return(data);
        }