publicvirtualIEnumerable<Role>RetrievesByUserId(stringuserId)=>DbManager.Create().Fetch<Role>("select r.ID, r.RoleName, r.Description, case ur.RoleID when r.ID then 'checked' else '' end Checked from Roles r left join UserRole ur on r.ID = ur.RoleID and UserID = @0",userId);
/// <summary>
/// 删除角色表
/// </summary>
/// <param name="value"></param>
publicvirtualboolDelete(IEnumerable<string>value)
{
if(!value.Any())returntrue;
boolret=false;
varids=string.Join(",",value);
vardb=DbManager.Create();
try
{
db.BeginTransaction();
db.Execute($"delete from UserRole where RoleID in ({ids})");
db.Execute($"delete from RoleGroup where RoleID in ({ids})");
db.Execute($"delete from NavigationRole where RoleID in ({ids})");
db.Execute($"delete from Roles where ID in ({ids})");
publicvirtualIEnumerable<Role>RetrievesByMenuId(stringmenuId)=>DbManager.Create().Fetch<Role>("select r.ID, r.RoleName, r.Description, case ur.RoleID when r.ID then 'checked' else '' end Checked from Roles r left join NavigationRole ur on r.ID = ur.RoleID and NavigationID = @0",menuId);
publicvirtualIEnumerable<Role>RetrievesByGroupId(stringgroupId)=>DbManager.Create().Fetch<Role>("select r.ID, r.RoleName, r.Description, case ur.RoleID when r.ID then 'checked' else '' end Checked from Roles r left join RoleGroup ur on r.ID = ur.RoleID and GroupID = @0",groupId);