mirror of
				https://gitee.com/ThingsGateway/ThingsGateway.git
				synced 2025-11-04 17:43:58 +08:00 
			
		
		
		
	更新 变量管理-上传设备筛选功能
This commit is contained in:
		@@ -12,6 +12,8 @@
 | 
			
		||||
 | 
			
		||||
using SqlSugar;
 | 
			
		||||
 | 
			
		||||
using System.Linq.Expressions;
 | 
			
		||||
 | 
			
		||||
namespace ThingsGateway.Admin.Core;
 | 
			
		||||
 | 
			
		||||
/// <summary>
 | 
			
		||||
@@ -55,12 +57,14 @@ public static class SqlSugarPageExtension
 | 
			
		||||
    /// <param name="whereExpression"></param>
 | 
			
		||||
    /// <returns></returns>
 | 
			
		||||
    public static async Task<SqlSugarPagedList<TEntity>> ToPagedListAsync<TEntity>(this ISugarQueryable<TEntity> queryable,
 | 
			
		||||
        int pageIndex, int pageSize, Func<TEntity, bool> whereExpression = null)
 | 
			
		||||
        int pageIndex, int pageSize, Expression<Func<TEntity, bool>> whereExpression = null)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        RefAsync<int> totalCount = 0;
 | 
			
		||||
        if (whereExpression != null)
 | 
			
		||||
            queryable = queryable.Where(whereExpression);
 | 
			
		||||
        var records = await queryable.ToPageListAsync(pageIndex, pageSize, totalCount);
 | 
			
		||||
        records = whereExpression != null ? records.Where(whereExpression).ToList() : records;
 | 
			
		||||
        //records = whereExpression != null ? records.Where(whereExpression).ToList() : records;
 | 
			
		||||
        var totalPages = (int)Math.Ceiling(totalCount / (double)pageSize);
 | 
			
		||||
        return new SqlSugarPagedList<TEntity>
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
@@ -1495,7 +1495,7 @@
 | 
			
		||||
            <param name="size"></param>
 | 
			
		||||
            <returns></returns>
 | 
			
		||||
        </member>
 | 
			
		||||
        <member name="M:ThingsGateway.Admin.Core.SqlSugarPageExtension.ToPagedListAsync``1(SqlSugar.ISugarQueryable{``0},System.Int32,System.Int32,System.Func{``0,System.Boolean})">
 | 
			
		||||
        <member name="M:ThingsGateway.Admin.Core.SqlSugarPageExtension.ToPagedListAsync``1(SqlSugar.ISugarQueryable{``0},System.Int32,System.Int32,System.Linq.Expressions.Expression{System.Func{``0,System.Boolean}})">
 | 
			
		||||
            <summary>
 | 
			
		||||
            SqlSugar分页扩展
 | 
			
		||||
            </summary>
 | 
			
		||||
 
 | 
			
		||||
@@ -129,11 +129,11 @@ public class VariableService : DbRepository<DeviceVariable>, IVariableService
 | 
			
		||||
        {
 | 
			
		||||
            uploadDevid = _uploadDeviceService.GetIdByName(input.UploadDeviceName);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!string.IsNullOrEmpty(input.UploadDeviceName))
 | 
			
		||||
        {
 | 
			
		||||
            var pageInfo = await query.ToPagedListAsync(input.Current, input.Size, a => a.VariablePropertys.ContainsKey(uploadDevid ?? 0));//分页
 | 
			
		||||
            var pageInfo = await query.ToPagedListAsync(input.Current, input.Size, a => SqlFunc.JsonLike(a.VariablePropertys, uploadDevid.ToString()));//分页
 | 
			
		||||
            return pageInfo;
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user