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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.seer.teach.common.enums.ResultCodeEnum;
import com.seer.teach.common.utils.AssertUtils;
import com.seer.teach.iot.module.entity.AppKeySecretsEntity;
import com.seer.teach.iot.module.mapper.AppKeySecretsMapper;
import com.seer.teach.iot.service.AppKeySecretsService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author Wang
 * @since 2025-11-22 09:11:13
 */
@Service
public class AppKeySecretsServiceImpl extends ServiceImpl<AppKeySecretsMapper, AppKeySecretsEntity> implements AppKeySecretsService {

    @Override
    public AppKeySecretsEntity getByAppKey(String appKey) {
        AppKeySecretsEntity one = this.lambdaQuery()
                .eq(AppKeySecretsEntity::getKey, appKey)
                .one();
        AssertUtils.notNull(one, ResultCodeEnum.APPID_NOT_EXIST);
        return one;
    }
}
