using System.Collections.Generic;
using System.Linq;
using Edu.Model.Entity.System;
using Edu.Model.ViewModel.System;
namespace Edu.Repository.System
{
///
/// 系统菜单消息(气泡)仓储层
///
public class RB_Menu_InformationRepository : BaseRepository
{
///
/// 根据where获取菜单列表
///
///
///
public List GetList(RB_Menu_Information_ViewModel dmodel)
{
string where = $@" 1=1 and Rb_GroupId={dmodel.Group_Id}";
if (dmodel.MenuId > 0)
{
where += " and " + nameof(RB_Menu_Information_ViewModel.MenuId) + "=" + dmodel.MenuId;
}
if (!string.IsNullOrWhiteSpace(dmodel.MenuIdStr))
{
where += " and " + nameof(RB_Menu_Information_ViewModel.MenuId) + " in(" + dmodel.MenuIdStr + ")";
}
if (dmodel.MsgType > 0)
{
where += " and " + nameof(RB_Menu_Information_ViewModel.MsgType) + "=" + dmodel.MsgType;
}
if (dmodel.EmployeeId > 0)
{
where += " and (" + nameof(RB_Menu_Information_ViewModel.EmployeeId) + "=" + dmodel.EmployeeId + " or EmployeeId=-1)";
}
if (dmodel.DepartmentId > 0)
{
where += " and (" + nameof(RB_Menu_Information_ViewModel.DepartmentId) + "=" + dmodel.DepartmentId + " or DepartmentId=-1)";
}
if (dmodel.SourceId > 0)
{
where += " and " + nameof(RB_Menu_Information_ViewModel.SourceId) + "=" + dmodel.SourceId;
}
if (dmodel.SourceType > 0)
{
where += " and " + nameof(RB_Menu_Information_ViewModel.SourceType) + "=" + dmodel.SourceType;
}
if (dmodel.School_Id >= 0)
{
where += " and " + nameof(RB_Menu_Information_ViewModel.School_Id) + "=" + dmodel.School_Id;
}
return Get(" select * from RB_Menu_Information where" + where).ToList();
}
}
}