using Edu.Common.Enum;
using Edu.Model.Entity.User;
using Edu.Model.ViewModel.User;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;

namespace Edu.Repository.User
{
    /// <summary>
    /// 公告基础仓储层
    /// </summary>
    public class RB_Notice_BaseRepository : BaseRepository<RB_Notice_Base>
    {
        public List<RB_Notice_Base_ViewModel> GetList(RB_Notice_Base_ViewModel demodel)
        {
            string where = $@" 1=1 and Status=0 ";
            if (demodel.Group_Id > 0)
            {
                where += $@" and {nameof(RB_Notice_Base.Group_Id)} ={demodel.Group_Id}";
            }
            if (demodel.School_Id > 0)
            {
                where += $@" and {nameof(RB_Notice_Base.School_Id)} ={demodel.School_Id}";
            }

            string sql = $@" select * from RB_Notice_Base where {where}";
            return Get<RB_Notice_Base_ViewModel>(sql).ToList();
        }
    }
}