using SqlSugar; using System.Collections.Generic; using VolPro.Core.ManageUser; using VolPro.Entity.DomainModels; namespace VolPro.Core.Tenancy { public static class TenancySqlManager { /// /// 自定义主表查询 /// /// 查询的表名 /// 查询的sql(框架生成的,可以直接用也可以单独写) /// 查询条件 /// public static string GetSearchSqlQuery(this string tableName, string selectSql, List filters, List 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; } } }