招聘后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.1 KiB

using Dapper;
using System.Collections.Generic;
using Znyc.Recruitment.Admin.Commons.IDbContext;
using Znyc.Recruitment.Admin.Commons.Repositories;
using Znyc.Recruitment.Admin.Security.Entitys;
using Znyc.Recruitment.Admin.Security.IRepositories;
namespace Znyc.Recruitment.Admin.Security.Repositories
{
public class MenuRepository : BaseRepository<MenuEntity, long>, IMenuRepository
{
public MenuRepository()
{
}
public MenuRepository(IDbContextCore dbContext) : base(dbContext)
{
}
/// <summary>
/// ���ݽ�ɫID�ַ��������ŷֿ�)��ϵͳ����ID����ȡ��Ӧ�IJ��������б�
/// </summary>
/// <param name="roleIds">��ɫID</param>
/// <param name="typeID">ϵͳ����ID</param>
/// <param name="isMenu">�Ƿ��Dz˵�</param>
/// <returns></returns>
public IEnumerable<MenuEntity> GetFunctions(string roleIds, string typeID, bool isMenu = false)
{
string sql =
"SELECT DISTINCT b.* FROM sys_menu as b INNER JOIN Sys_RoleAuthorize as a On b.Id = a.ItemId WHERE ObjectId IN (" +
roleIds + ")";
if (roleIds == "")
{
sql = "SELECT DISTINCT b.* FROM sys_menu as b where 1=1 ";
}
if (isMenu)
{
sql = sql + "and menutype in('M','C')";
}
if (!string.IsNullOrEmpty(typeID))
{
sql = sql + string.Format(" AND SystemTypeId='{0}' ", typeID);
}
return DapperConnRead.Query<MenuEntity>(sql);
}
/// <summary>
/// ����ϵͳ����ID����ȡ��Ӧ�IJ��������б�
/// </summary>
/// <param name="typeID">ϵͳ����ID</param>
/// <returns></returns>
public IEnumerable<MenuEntity> GetFunctions(string typeID)
{
string sql = "SELECT DISTINCT b.* FROM sys_menu as b ";
if (!string.IsNullOrEmpty(typeID))
{
sql = sql + string.Format(" Where SystemTypeId='{0}' ", typeID);
}
return DapperConnRead.Query<MenuEntity>(sql);
}
}
}