| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.dromara.common.core.constant.CacheNames; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.exception.ServiceException; |
| | | import org.dromara.common.core.service.ConfigService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | |
| | | */ |
| | | @Override |
| | | public boolean selectRegisterEnabled(String tenantId) { |
| | | SysConfig retConfig = baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, "sys.account.registerUser") |
| | | .eq(TenantHelper.isEnable(),SysConfig::getTenantId, tenantId)); |
| | | SysConfig retConfig = TenantHelper.dynamic(tenantId, () -> { |
| | | return baseMapper.selectOne(new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, "sys.account.registerUser")); |
| | | }); |
| | | if (ObjectUtil.isNull(retConfig)) { |
| | | return false; |
| | | } |
| | |
| | | } |
| | | row = baseMapper.updateById(config); |
| | | } else { |
| | | CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey()); |
| | | row = baseMapper.update(config, new LambdaQueryWrapper<SysConfig>() |
| | | .eq(SysConfig::getConfigKey, config.getConfigKey())); |
| | | } |
| | |
| | | public void deleteConfigByIds(Long[] configIds) { |
| | | for (Long configId : configIds) { |
| | | SysConfig config = baseMapper.selectById(configId); |
| | | if (StringUtils.equals(UserConstants.YES, config.getConfigType())) { |
| | | if (StringUtils.equals(SystemConstants.YES, config.getConfigType())) { |
| | | throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey())); |
| | | } |
| | | CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey()); |
| | | } |
| | | baseMapper.deleteBatchIds(Arrays.asList(configIds)); |
| | | baseMapper.deleteByIds(Arrays.asList(configIds)); |
| | | } |
| | | |
| | | /** |