sunkaixuan
8 years ago
15 changed files with 125 additions and 10 deletions
@ -0,0 +1,21 @@ |
|||
using OrmTest.Demo; |
|||
using SqlSugar; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
|
|||
namespace OrmTest.Demos |
|||
{ |
|||
namespace OrmTest.Demo |
|||
{ |
|||
public class Filter : DemoBase |
|||
{ |
|||
public static void Init() |
|||
{ |
|||
var db = GetInstance(); |
|||
// db.QueryFilter.Add(eSqlFilterItem(){ });
|
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
|
|||
namespace SqlSugar |
|||
{ |
|||
public class QueryFilterProvider |
|||
{ |
|||
internal SqlSugarClient Context{ get; set; } |
|||
private List<SqlFilterItem> _Filters { get; set; } |
|||
|
|||
public void Add(SqlFilterItem filter) |
|||
{ |
|||
if (_Filters == null) |
|||
_Filters = new List<SqlFilterItem>(); |
|||
} |
|||
|
|||
public void Remove(string filterName) |
|||
{ |
|||
if (_Filters == null) |
|||
_Filters = new List<SqlFilterItem>(); |
|||
_Filters.RemoveAll(it => it.FilterName == filterName); |
|||
} |
|||
|
|||
public List<SqlFilterItem> GeFilterList |
|||
{ |
|||
get |
|||
{ |
|||
if (_Filters == null) |
|||
_Filters = new List<SqlFilterItem>(); |
|||
return _Filters; |
|||
} |
|||
} |
|||
public void Clear() |
|||
{ |
|||
_Filters = new List<SqlFilterItem>(); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
|
|||
namespace SqlSugar |
|||
{ |
|||
public class SqlFilterItem |
|||
{ |
|||
public string FilterName { get; set; } |
|||
public Func<SqlSugarClient,SqlFilterResult> GetFilterSql { get; set; } |
|||
public bool IsJoinQuery { get; set; } |
|||
} |
|||
|
|||
public class SqlFilterResult |
|||
{ |
|||
public string Sql { get; set; } |
|||
public List<SugarParameter> Parameters { get; set; } |
|||
} |
|||
} |
Loading…
Reference in new issue