using CeramicProjectTool.Model; using CeramicProjectTool.Model.ResultModel; using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CeramicProjectTool.Util { public partial class DBHelper { public static async Task> GetPermissonsByRule(string ruleName, string moduleName) { /* nr_z_quanxian rp nr_sys_gn p nr_z_yhjs r select * from nr_z_quanxian a left join nr_sys_gn b on a.gnid = b.id left join nr_z_yhjs c on a.jsid = c.id */ var result = await Db.Queryable((rp, p, r) => new JoinQueryInfos( JoinType.Left, rp.FeatureId == p.Id, JoinType.Left, rp.RuleId == r.Id)) .Where((rp, p, r) => r.RuleName == ruleName && p.ModuleName == moduleName) .Select((rp, p, r) => new RulePermissonResult { FeatureId = p.Id, RuleId = r.Id, PermissonId = rp.Id, RuleName = r.RuleName, FeatureName = p.Feature, IsEnabled = true }) .ToListAsync(); return result; } } }