cnf
2025-11-29 e57987bff5891297af9ecbbec5ed6dc9e84bdad2
WebApi/Gs.Warehouse/Services/MesDepotSectionsManager.cs
@@ -24,6 +24,51 @@
        //    UtilityHelper.GetUserGuidAndOrgGuid(_http);
    }
      /// <summary>
    ///     查询列表,支持分页
    /// </summary>
    /// <param name="query"></param>
    /// <returns></returns>
    [RequestMethod(RequestMethods.POST)]
    public ReturnDto<PageList<MesDepotSections>> GetListPage(PageQuery query)
    {
        var pageList = new PageList<MesDepotSections>();
        try
        {
            var _sbWhere = new StringBuilder(" 1=1" + query.keyWhere);
            var _sbBy = new StringBuilder(query.sortName + " " + query.sortOrder);
            var totalCount = 0;
            // 先构建基础查询
            var queryBase = Db.Queryable<MesDepots>()
                .LeftJoin<MesDepotSections>((a, b) => a.Guid == b.DepotGuid);
                //.LeftJoin<SysOrganization>((a, b, c) => a.FSubsidiary == c.Fid)
                //.LeftJoin<MesStaff>((a, b, c, d) => a.CreateBy == d.Id.ToString())
                //.LeftJoin<MesCustomer>((a, b, c, d, e) => e.Id.ToString() == a.ClientId)
                //.LeftJoin<MesSupplier>((a, b, c, d, e, f) => f.Id.ToString() == a.SuppLierId)
                //.LeftJoin<SysDepartment>((a, b, c, d, e, f, g) => g.Id.ToString() == a.department);
            // 然后进行选择和分页
            var itemsList = queryBase.Select((a, b) => new MesDepotSections
            {
                Guid = b.Guid,
                DepotSectionCode = b.DepotSectionCode,
                DepotSectionName = b.DepotSectionName
            })
            .Where(_sbWhere.ToString())
            .OrderBy(_sbBy.ToString())
            .ToPageList(query.currentPage, query.everyPageSize, ref totalCount);
            pageList = new PageList<MesDepotSections>(itemsList, totalCount,
                query.everyPageSize);
            return ReturnDto<PageList<MesDepotSections>>.QuickReturn(pageList,
                ReturnCode.Success, "读取成功");
        }
        catch (Exception ex)
        {
            return ReturnDto<PageList<MesDepotSections>>.QuickReturn(pageList,
                ReturnCode.Default, ex.Message);
        }
    }
    /// <summary>
    ///     查询列表,支持分页,用于各种绑定