add
This commit is contained in:
@ -10,6 +10,7 @@ import com.qiaoba.common.base.validate.AddGroup;
|
||||
import com.qiaoba.common.base.validate.EditGroup;
|
||||
import com.qiaoba.common.database.entity.PageQuery;
|
||||
import com.qiaoba.common.database.entity.TableDataInfo;
|
||||
import com.qiaoba.common.redis.service.RedisService;
|
||||
import com.qiaoba.module.tenant.entity.dto.TenantSettingDto;
|
||||
import com.qiaoba.module.tenant.service.SysTenantService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -33,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class SysTenantController {
|
||||
|
||||
private final SysTenantService sysTenantService;
|
||||
private final RedisService redisService;
|
||||
|
||||
@PreAuthorize("hasAuthority('tenant:add')")
|
||||
@PostMapping
|
||||
@ -93,4 +95,11 @@ public class SysTenantController {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "测试Redis消息")
|
||||
@GetMapping("/test")
|
||||
public AjaxResult msg(String msg) {
|
||||
redisService.convertAndSend("switch_primary_datasource",msg);
|
||||
redisService.convertAndSend("test",msg);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,14 @@ public interface SysTenantDatasourceService {
|
||||
*/
|
||||
int updateById(SysTenantDatasource sysTenantDatasource);
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
*
|
||||
* @param sysTenantDatasource sysTenantDatasource
|
||||
* @return 结果
|
||||
*/
|
||||
int updateStatus(SysTenantDatasource sysTenantDatasource);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
|
@ -50,7 +50,7 @@ public class DynamicDatasourceServiceImpl implements DynamicDatasourceService {
|
||||
SysTenantDatasource sysTenantDatasource = new SysTenantDatasource();
|
||||
sysTenantDatasource.setDatasourceId(datasourceId);
|
||||
sysTenantDatasource.setIsPrimary(BaseEnum.YES.getCode());
|
||||
sysTenantDatasourceService.updateById(sysTenantDatasource);
|
||||
sysTenantDatasourceService.updateStatus(sysTenantDatasource);
|
||||
// 将该租户下的其他数据源设置为非主要数据源
|
||||
sysTenantDatasourceService.setBackupDatasourceExcludeId(tenantId, datasourceId);
|
||||
}
|
||||
|
@ -92,6 +92,11 @@ public class SysTenantDatasourceServiceImpl implements SysTenantDatasourceServic
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateStatus(SysTenantDatasource sysTenantDatasource) {
|
||||
return sysTenantDatasourceMapper.updateById(sysTenantDatasource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByIds(List<String> ids) {
|
||||
// 删除备用Map
|
||||
|
Reference in New Issue
Block a user