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

namespace Mall.Repository.User
{
    /// <summary>
    /// 更新用户下线日志记录仓储层
    /// </summary>
    public class RB_User_ReferralsLogRepository : BaseRepository<RB_User_ReferralsLog>
    {

        /// <summary>
        /// 获取最新的记录
        /// </summary>
        /// <param name="mallBaseId"></param>
        /// <returns></returns>
        public RB_User_ReferralsLog GetNewLog(int mallBaseId)
        {
            string sql = $@"SELECT * FROM rb_user_referralslog WHERE MallBaseId ={mallBaseId} ORDER BY Id DESC LIMIT 1";
            return Get(sql).FirstOrDefault();
        }
    }
}
