package com.cyksj.mapper;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cyksj.model.entity.UserGalaxyCoinRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * 项目名: yhlxj
 * 文件名: UserGalaxyCoinRecordMapper
 * 创建者: JavaZou
 * 创建时间:2025/7/7 15:19
 */
public interface UserGalaxyCoinRecordMapper extends BaseMapper<UserGalaxyCoinRecord> {

	@Select("select sum(remain_galaxy_coin) from user_galaxy_coin_record where user_id = #{userId} and is_expired is false and expiry_time <= #{expiryTime}")
	BigDecimal selectExpiredGalaxyCoinAfterDays(@Param("userId") Long userId, @Param("expiryTime") DateTime expiryTime);
}
