using Edu.Model.Entity.System;
using Edu.Model.ViewModel.System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.System
{
///
/// 岗位角色表仓储层
///
public class RB_Post_RoleRepository : BaseRepository
{
///
/// 获取岗位角色列表
///
///
///
public List GetPostRoleListRepository(RB_Post_Role_ViewModel query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Post_Role
WHERE 1=1
");
if (query != null)
{
if (query.Id > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Post_Role_ViewModel.Id), query.Id);
}
if (query.PostId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Post_Role_ViewModel.PostId), query.PostId);
}
if (query.RoleId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Post_Role_ViewModel.RoleId), query.RoleId);
}
}
return Get(builder.ToString()).ToList();
}
}
}