using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Property;
using System.Linq;
using Mall.Model.Entity.User;

namespace Mall.Repository.Property
{
    /// <summary>
    /// 商品订单日志仓储层
    /// </summary>
    public class RB_Property_LogRepository : RepositoryBase<RB_Property_Log>
    {

        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="dmodel"></param>
        /// <returns></returns>
        public List<RB_Property_Log> GetList(RB_Property_Log dmodel)
        {
            string where = $" 1=1 ";
            if (dmodel.Type > 0)
            {
                where += $@" and {nameof(RB_Property_Log.Type)}={dmodel.Type}";
            }
            if (dmodel.SourceId > 0)
            {
                where += $@" and {nameof(RB_Property_Log.SourceId)}={dmodel.SourceId}";
            }            

            string sql = $@"SELECT * FROM RB_Property_Log where {where} order by Id asc";
            return Get<RB_Property_Log>(sql).ToList();
        }
    }
}
