wx
2022-11-04 583cc420580a07c595fd6a876c9321c46248bcdf
分页增加自定义查询条件
4个文件已修改
2个文件已添加
110 ■■■■■ 已修改文件
ZTICInterface.Application/App/IndustryPolicyApp.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/Repository.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/Service/IndustryPolicyService.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/ZTICInterface.Application.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Core/Extend/PageSearchParam.cs 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Core/ZTICInterface.Core.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ZTICInterface.Application/App/IndustryPolicyApp.cs
@@ -3,8 +3,10 @@
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using ZTICInterface.Application;
using ZTICInterface.Application.Service;
using ZTICInterface.Core.Entity;
using ZTICInterface.Core.Extend;
using ZTICInterface.Core.Method;
namespace ZTICInterface.Application.App;
@@ -13,8 +15,8 @@
/// </summary>
public class IndustryPolicyApp:IDynamicApiController
{
    private readonly Repository<IndustryPolicy> _industryPolicyService;
    public IndustryPolicyApp(Repository<IndustryPolicy> industryPolicyService)
    private readonly IndustryPolicyService _industryPolicyService;
    public IndustryPolicyApp(IndustryPolicyService industryPolicyService)
    {
        _industryPolicyService = industryPolicyService;
    }
@@ -31,5 +33,15 @@
        return await _industryPolicyService.GetPagesAsync(pageIndex, pageSize,null,a=>a.PublishDate,OrderByType.Desc);
    }
    /// <summary>
    /// 高级查询分页
    /// </summary>
    /// <param name="param"></param>
    /// <returns></returns>
    [HttpPost]
    public async Task<Page<IndustryPolicy>> GetPages([FromBody] PageSearchParam param)
    {
        var where = param.ColCondition.ToIConditionalModels();
        return await _industryPolicyService.GetPagesByConditionalAsync(param.PageIndex, param.PageSize, where, a => a.PublishDate, OrderByType.Desc);
    }
}
ZTICInterface.Application/Repository.cs
@@ -121,6 +121,8 @@
        return res;
    }
    /// <summary>
    /// 分页
    /// </summary>
@@ -140,6 +142,24 @@
    }
    /// <summary>
    /// 分页
    /// </summary>
    /// <param name="parm">分页参数</param>
    /// <param name="where">条件</param>
    /// <param name="order">排序值</param>
    /// <param name="orderEnum">排序方式OrderByType</param>
    /// <returns></returns>
    public async Task<Page<T>> GetPagesByConditionalAsync(int pageIndex, int pageSize, List<IConditionalModel> where,
        Expression<Func<T, object>> order, OrderByType orderEnum, bool Async = true)
    {
        var query = Context.Queryable<T>()
            .Where(where)
            .OrderBy(order, orderEnum);
        var res = Async ? await query.ToPageAsync(pageIndex, pageSize) : query.ToPage(pageIndex, pageSize);
        return res;
    }
    /// <summary>
    /// 获得列表
    /// </summary>
    /// <param name="parm">PageParm</param>
ZTICInterface.Application/Service/IndustryPolicyService.cs
New file
@@ -0,0 +1,9 @@
using Furion.DependencyInjection;
using ZTICInterface.Core.Entity;
namespace ZTICInterface.Application.Service;
public class IndustryPolicyService : Repository<IndustryPolicy>, ISingleton
{
}
ZTICInterface.Application/ZTICInterface.Application.xml
@@ -17,6 +17,13 @@
            <param name="pageSize"></param>
            <returns></returns>
        </member>
        <member name="M:ZTICInterface.Application.App.IndustryPolicyApp.GetPages(ZTICInterface.Core.Extend.PageSearchParam)">
            <summary>
            高级查询分页
            </summary>
            <param name="param"></param>
            <returns></returns>
        </member>
        <member name="T:ZTICInterface.Application.App.TableProductionSalesApp">
            <summary>
            报表-生成及销售数据
@@ -62,6 +69,16 @@
            <param name="orderEnum">排序方式OrderByType</param>
            <returns></returns>
        </member>
        <member name="M:ZTICInterface.Application.Repository`1.GetPagesByConditionalAsync(System.Int32,System.Int32,System.Collections.Generic.List{SqlSugar.IConditionalModel},System.Linq.Expressions.Expression{System.Func{`0,System.Object}},SqlSugar.OrderByType,System.Boolean)">
            <summary>
            分页
            </summary>
            <param name="parm">分页参数</param>
            <param name="where">条件</param>
            <param name="order">排序值</param>
            <param name="orderEnum">排序方式OrderByType</param>
            <returns></returns>
        </member>
        <member name="M:ZTICInterface.Application.Repository`1.GetListAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}},System.Linq.Expressions.Expression{System.Func{`0,System.Object}},SqlSugar.OrderByType,System.Boolean)">
            <summary>
            获得列表
ZTICInterface.Core/Extend/PageSearchParam.cs
New file
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
namespace ZTICInterface.Core.Extend;
/// <summary>
/// 分页高级搜索条件
/// </summary>
public class PageSearchParam
{
    /// <summary>
    /// 页码
    /// </summary>
    public int PageIndex { get; set; }
    /// <summary>
    /// 条数
    /// </summary>
    public int PageSize { get; set; }
    /// <summary>
    /// 指标查询条件
    /// </summary>
    public List<SugarTableSearchSimple> ColCondition { get; set; }
}
ZTICInterface.Core/ZTICInterface.Core.xml
@@ -181,6 +181,26 @@
            <param name="isOrderBy"></param>
            <returns></returns>
        </member>
        <member name="T:ZTICInterface.Core.Extend.PageSearchParam">
            <summary>
            分页高级搜索条件
            </summary>
        </member>
        <member name="P:ZTICInterface.Core.Extend.PageSearchParam.PageIndex">
            <summary>
            页码
            </summary>
        </member>
        <member name="P:ZTICInterface.Core.Extend.PageSearchParam.PageSize">
            <summary>
            条数
            </summary>
        </member>
        <member name="P:ZTICInterface.Core.Extend.PageSearchParam.ColCondition">
            <summary>
            指标查询条件
            </summary>
        </member>
        <member name="P:ZTICInterface.Core.Extend.SugarTableSearchSimple.FieldName">
            <summary>
            字段名