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

namespace Mall.Repository.Product
{
    /// <summary>
    /// 商品订单售后流程仓储层
    /// </summary>
    public class RB_Goods_OrderAfterSaleLogRepository : RepositoryBase<RB_Goods_OrderAfterSaleLog>
    {

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

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