package com.yaoai.domain.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yaoai.domain.entity.SystemSetting;
import org.apache.ibatis.annotations.Mapper;

import java.util.Optional;

@Mapper
public interface SystemSettingMapper extends BaseMapper<SystemSetting> {

    default Optional<SystemSetting> findByKey(String key) {
        return Optional.ofNullable(selectOne(Wrappers.<SystemSetting>lambdaQuery()
                .eq(SystemSetting::getSettingKey, key)));
    }
}
