package com.seer.teach.pay.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.seer.teach.pay.entity.PayWithdrawalConfigEntity;
import com.seer.teach.pay.mapper.PayWithdrawalConfigMapper;
import com.seer.teach.pay.service.IPayWithdrawalConfigService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 支付模块-提现规则配置表（动态调整提现政策） 服务实现类
 * </p>
 *
 * @author ZS
 * @since 2025-09-17
 */
@Service
public class IPayWithdrawalConfigServiceImpl extends ServiceImpl<PayWithdrawalConfigMapper, PayWithdrawalConfigEntity> implements IPayWithdrawalConfigService {

    @Override
    public PayWithdrawalConfigEntity getActiveAndLatestConfig() {
        return super.getOne(new LambdaQueryWrapper<PayWithdrawalConfigEntity>().eq(PayWithdrawalConfigEntity::getStatus, 1).orderByDesc(PayWithdrawalConfigEntity::getCreateTime).last("LIMIT 1"));
    }
}
