feat: 增加高级查询

This commit is contained in:
wintel
2025-05-06 21:15:47 +08:00
parent a28458347a
commit 576ff6e98a
3 changed files with 12 additions and 0 deletions

View File

@@ -15,6 +15,11 @@
public string key { get; set; } public string key { get; set; }
/// <summary>
/// 自定义sql条件
/// </summary>
public string sqlWhere { get; set; }
public PageReq() public PageReq()
{ {
page = 1; page = 1;

View File

@@ -569,6 +569,9 @@ namespace OpenAuth.App
{ {
return "DateTime.Now"; return "DateTime.Now";
} }
else if (type == "bool"){
return "false";
}
return Activator.CreateInstance(t).ToString(); return Activator.CreateInstance(t).ToString();
} }

View File

@@ -32,6 +32,10 @@ namespace OpenAuth.App
{ {
objs = objs.Where(u => u.Name.Contains(request.key)); objs = objs.Where(u => u.Name.Contains(request.key));
} }
if (!string.IsNullOrEmpty(request.sqlWhere))
{
objs = objs.Where(request.sqlWhere);
}
result.data = objs.OrderBy(u => u.Name) result.data = objs.OrderBy(u => u.Name)
.Skip((request.page - 1) * request.limit) .Skip((request.page - 1) * request.limit)