Files
SecMPS/api_sqlsugar/VolPro.Core/Tenancy/TenancySqlManager.cs
2026-05-15 23:22:48 +08:00

42 lines
1.4 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using SqlSugar;
using System.Collections.Generic;
using VolPro.Core.ManageUser;
using VolPro.Entity.DomainModels;
namespace VolPro.Core.Tenancy
{
public static class TenancySqlManager
{
/// <summary>
/// 自定义主表查询
/// </summary>
/// <param name="tableName">查询的表名</param>
/// <param name="selectSql">查询的sql框架生成的可以直接用也可以单独写</param>
/// <param name="filters">查询条件</param>
/// <returns></returns>
public static string GetSearchSqlQuery(this string tableName, string selectSql, List<SearchParameters> filters, List<SugarParameter> parameters)
{
//超级管理员不限制(这里可以根据tableName表名自己判断要不要限制超级管理员)
if (UserContext.Current.IsSuperAdmin)
{
return null;
}
switch (tableName.ToLower())
{
//根据不同的表名设置不同的查询查询条件在filters中
case "sys_user":
/* 重新生杨sql
* selectSql = $"select * from {tableName} where xx=@xx";
* 添加自定义参数
* parameters.Add("@xx", "value");
*/
break;
default:
break;
}
return selectSql;
}
}
}