using Edu.Common.Enum;
using Edu.Model.Entity.User;
using Edu.Model.ViewModel.User;
using System;
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_DeptRepository : BaseRepository<RB_Notice_Dept>
    {
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="demodel"></param>
        /// <returns></returns>
        public List<RB_Notice_Dept> GetList(RB_Notice_Dept demodel, string NoticeIds)
        {
            string where = "1=1";
            if (demodel.NoticeId > 0)
            {
                where += $@" and {nameof(RB_Notice_Dept.NoticeId)} ={demodel.NoticeId}";
            }
            if (!string.IsNullOrEmpty(NoticeIds))
            {
                where += $@" and {nameof(RB_Notice_Dept.NoticeId)} in({NoticeIds})";
            }
            if (demodel.DeptId > 0)
            {
                where += $@" and {nameof(RB_Notice_Dept.DeptId)} ={demodel.DeptId}";
            }

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