|
|
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.iflytop.handacid.app.common.enums.SystemConfigKey; |
|
|
|
import com.iflytop.handacid.common.mapper.SystemConfigMapper; |
|
|
|
import com.iflytop.handacid.common.model.entity.SystemConfig; |
|
|
|
import com.iflytop.handacid.common.model.entity.User; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
@ -17,11 +16,16 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
public class SystemConfigService extends ServiceImpl<SystemConfigMapper, SystemConfig> { |
|
|
|
|
|
|
|
public String getValueByKey(SystemConfigKey key){ |
|
|
|
public String getValueByKeyToString(SystemConfigKey key){ |
|
|
|
SystemConfig systemConfig = this.getOne(new LambdaQueryWrapper<>(SystemConfig.class).eq(SystemConfig::getKey, key)); |
|
|
|
return systemConfig != null ? systemConfig.getValue() : null; |
|
|
|
} |
|
|
|
|
|
|
|
public Integer getValueByKeyToInteger(SystemConfigKey key){ |
|
|
|
SystemConfig systemConfig = this.getOne(new LambdaQueryWrapper<>(SystemConfig.class).eq(SystemConfig::getKey, key)); |
|
|
|
return systemConfig != null ? Integer.parseInt(systemConfig.getValue()) : null; |
|
|
|
} |
|
|
|
|
|
|
|
public boolean updateValueByKey(SystemConfigKey key, String value){ |
|
|
|
SystemConfig systemConfig = this.getOne(new LambdaQueryWrapper<>(SystemConfig.class).eq(SystemConfig::getKey, key)); |
|
|
|
systemConfig.setValue(value); |
|
|
|