| | |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | |
| | | * @return true开启,false关闭 |
| | | */ |
| | | @Override |
| | | public boolean selectCaptchaOnOff() { |
| | | String captchaOnOff = selectConfigByKey("sys.account.captchaOnOff"); |
| | | if (StringUtils.isEmpty(captchaOnOff)) { |
| | | public boolean selectCaptchaEnabled() { |
| | | String captchaEnabled = selectConfigByKey("sys.account.captchaEnabled"); |
| | | if (StringUtils.isEmpty(captchaEnabled)) { |
| | | return true; |
| | | } |
| | | return Convert.toBool(captchaOnOff); |
| | | return Convert.toBool(captchaEnabled); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public int updateConfig(SysConfig config) { |
| | | int row = baseMapper.updateById(config); |
| | | int row = 0; |
| | | if (config.getConfigId() != null) { |
| | | row = baseMapper.updateById(config); |
| | | } else { |
| | | row = baseMapper.update(config, new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, config.getConfigKey())); |
| | | } |
| | | if (row > 0) { |
| | | RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); |
| | | } |
| | |
| | | * 批量删除参数信息 |
| | | * |
| | | * @param configIds 需要删除的参数ID |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public void deleteConfigByIds(Long[] configIds) { |
| | |
| | | */ |
| | | @Override |
| | | public void clearConfigCache() { |
| | | Collection<String> keys = RedisUtils.keys(Constants.SYS_CONFIG_KEY + "*"); |
| | | Collection<String> keys = RedisUtils.keys(CacheConstants.SYS_CONFIG_KEY + "*"); |
| | | RedisUtils.deleteObject(keys); |
| | | } |
| | | |
| | |
| | | * @return 缓存键key |
| | | */ |
| | | private String getCacheKey(String configKey) { |
| | | return Constants.SYS_CONFIG_KEY + configKey; |
| | | return CacheConstants.SYS_CONFIG_KEY + configKey; |
| | | } |
| | | } |