package com.fjhx.service.common.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fjhx.entity.common.CommonConfig;
import com.fjhx.mapper.common.CommonConfigMapper;
import com.fjhx.service.common.CommonConfigService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 公共配置 服务实现类
 * </p>
 *
 * @author ${author}
 * @since 2022-08-05
 */
@Service
public class CommonConfigServiceImpl extends ServiceImpl<CommonConfigMapper, CommonConfig> implements CommonConfigService {

    @Override
    public String getValue(String key) {
        return getOne(Wrappers.<CommonConfig>lambdaQuery().eq(CommonConfig::getConfigKey, key))
                .getConfigValue();
    }

    @Override
    public void updateValue(String key, String value) {
        update(Wrappers.<CommonConfig>lambdaUpdate()
                .eq(CommonConfig::getConfigKey, key)
                .set(CommonConfig::getConfigValue, value));
    }

}
