Commit 14ec4b54 authored by 黄奎's avatar 黄奎

页面修改

parent 6bac38c9
......@@ -58,9 +58,36 @@ namespace Mall.Module.User
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Role_Extend> GetRoleListExtModule(RB_Role_Extend query)
public string GetRoleListExtModule(RB_Role_Extend query)
{
return roleRepository.GetRoleListExtRepository(query);
string menuIds = "";
List<string> menuIdList = new List<string>();
var list= roleRepository.GetRoleListExtRepository(query);
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
if (!string.IsNullOrWhiteSpace(item.RoleAuth))
{
var tempArray= item.RoleAuth.Split(',');
if (tempArray != null && tempArray.Length > 0)
{
foreach (var subItem in tempArray)
{
if (!string.IsNullOrWhiteSpace(subItem))
{
menuIdList.Add(subItem);
}
}
}
}
}
}
if (menuIdList != null && menuIdList.Count > 0)
{
menuIds = string.Join(",", menuIdList);
}
return menuIds;
}
/// <summary>
......
......@@ -79,13 +79,19 @@ namespace Mall.Repository.User
/// <returns></returns>
public List<RB_Role_Extend> GetRoleListExtRepository(RB_Role_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT group_concat(RoleAuth) AS RoleAuth
string empRoleSql = string.Format(@" SELECT RoleAuth FROM rb_employee WHERE empId={0} ", query.EmpId);
var roleObj = base.ExecuteScalar(empRoleSql);
if (roleObj != null && !string.IsNullOrWhiteSpace(roleObj.ToString()))
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM rb_role
WHERE `Status`=0 AND RoleId IN (SELECT group_concat(RoleAuth) AS RoleAuth FROM rb_employee WHERE empId={0} )
",query.EmpId);
return Get<RB_Role_Extend>(builder.ToString()).ToList();
WHERE `Status`=0 AND RoleId IN ({0})
", roleObj.ToString());
return Get<RB_Role_Extend>(builder.ToString()).ToList();
}
return new List<RB_Role_Extend>();
}
}
}
\ No newline at end of file
......@@ -970,10 +970,10 @@ namespace Mall.WebApi.Controllers.User
var list = new List<RB_Menu_Extend>();
if (RequestParm.EmpId > 0)
{
var roleList = employeeModule.GetRoleListExtModule(new RB_Role_Extend() { EmpId = RequestParm.EmpId });
if (roleList != null && roleList.Count > 0)
var menuIds = employeeModule.GetRoleListExtModule(new RB_Role_Extend() { EmpId = RequestParm.EmpId });
if (!string.IsNullOrWhiteSpace(menuIds))
{
list = menuModule.GetMenuListModule(new RB_Menu_Extend() { QMenuIds = roleList?.FirstOrDefault()?.RoleAuth });
list = menuModule.GetMenuListModule(new RB_Menu_Extend() { QMenuIds = menuIds });
var superList = new List<RB_Menu_Extend>();
foreach (var item in list)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment