多租户列表查询
This commit is contained in:
parent
2086924387
commit
edf50e1b78
@ -54,6 +54,17 @@ public class TenantController {
|
|||||||
return success(tenant != null ? tenant.getId() : null);
|
return success(tenant != null ? tenant.getId() : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getListByWebsite")
|
||||||
|
@PermitAll
|
||||||
|
@Operation(summary = "使用域名,获得租户信息", description = "登录界面,根据用户的域名,获得租户信息")
|
||||||
|
@Parameter(name = "website", description = "域名", required = true, example = "www.iocoder.cn")
|
||||||
|
public CommonResult<?> getListByWebsite(@RequestParam("website") String website) {
|
||||||
|
List<TenantDO> tenants = tenantService.getListByWebsite(website);
|
||||||
|
return success(tenants);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建租户")
|
@Operation(summary = "创建租户")
|
||||||
@PreAuthorize("@ss.hasPermission('system:tenant:create')")
|
@PreAuthorize("@ss.hasPermission('system:tenant:create')")
|
||||||
|
@ -135,4 +135,5 @@ public interface TenantService {
|
|||||||
*/
|
*/
|
||||||
void validTenant(Long id);
|
void validTenant(Long id);
|
||||||
|
|
||||||
|
List<TenantDO> getListByWebsite(String website);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler;
|
|||||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
@ -106,6 +107,13 @@ public class TenantServiceImpl implements TenantService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TenantDO> getListByWebsite(String website) {
|
||||||
|
QueryWrapper<TenantDO> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("website", website);
|
||||||
|
return tenantMapper.selectList(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换
|
@DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换
|
||||||
public Long createTenant(TenantSaveReqVO createReqVO) {
|
public Long createTenant(TenantSaveReqVO createReqVO) {
|
||||||
|
Loading…
Reference in New Issue
Block a user