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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.seer.teach.common.enums.ResultCodeEnum;
import com.seer.teach.common.utils.AssertUtils;
import com.seer.teach.pay.entity.PayChannelEntity;
import com.seer.teach.pay.mapper.PayChannelMapper;
import com.seer.teach.pay.service.IPayChannelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Wang
 * @since 2025-09-11 14:04:02
 */
@Service
public class PayChannelServiceImpl extends ServiceImpl<PayChannelMapper, PayChannelEntity> implements IPayChannelService {

    @Override
    public PayChannelEntity checkChannelByChannelCode(String channelCode) {
        PayChannelEntity payChannel = this.getOne(new LambdaQueryWrapper<PayChannelEntity>()
                .eq(PayChannelEntity::getChannelCode, channelCode));
        AssertUtils.notNull(payChannel, ResultCodeEnum.PAY_CHANNEL_IS_NOT_EXIST);
        return payChannel;
    }
}
