package com.jeesharp.business.modules.member.mapper;

import com.jeesharp.business.modules.member.entity.MemberVip;
import com.jeesharp.business.modules.member.vo.MemberVipQueryVO;
import com.jeesharp.framework.mybatis.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;

/**
 * 会员付费开通记录 Mapper 接口
 *
 * @author jeesharp
 * @version 2026-03-19
 */
@Mapper
public interface MemberVipMapper extends BaseMapper<MemberVip, MemberVipQueryVO> {

    /**
     * 查询会员当前有效付费记录（status=1 且 expire_date > now）
     *
     * @param memberId 会员ID
     * @param now      当前时间
     * @return 有效付费记录，取到期时间最晚的一条
     */
    MemberVip selectActiveVipByMemberId(@Param("memberId") String memberId, @Param("now") LocalDateTime now);
}
