2024-05-22 17:19:22 +08:00
|
|
|
|
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<List<RulePermissonResult>> 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
|
|
|
|
|
*/
|
2024-05-23 16:41:06 +08:00
|
|
|
|
var result = await Db.Queryable<RulePermissonModel, PermissonModel, RuleModel>((rp, p, r)
|
2024-05-22 17:19:22 +08:00
|
|
|
|
=> 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|