|
|
|
@ -49,7 +49,6 @@ import java.util.Map;
|
|
|
|
|
@RequestMapping("/tenant") |
|
|
|
|
@ApiIgnore |
|
|
|
|
@Api(value = "租户管理", tags = "接口") |
|
|
|
|
@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
|
|
|
|
public class TenantController extends BladeController { |
|
|
|
|
|
|
|
|
|
private ITenantService tenantService; |
|
|
|
@ -60,6 +59,7 @@ public class TenantController extends BladeController {
|
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@ApiOperation(value = "详情", notes = "传入tenant") |
|
|
|
|
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) |
|
|
|
|
public R<Tenant> detail(Tenant tenant) { |
|
|
|
|
Tenant detail = tenantService.getOne(Condition.getQueryWrapper(tenant)); |
|
|
|
|
return R.data(detail); |
|
|
|
@ -76,6 +76,7 @@ public class TenantController extends BladeController {
|
|
|
|
|
}) |
|
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
|
@ApiOperation(value = "分页", notes = "传入tenant") |
|
|
|
|
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) |
|
|
|
|
public R<IPage<Tenant>> list(@ApiIgnore @RequestParam Map<String, Object> tenant, Query query, BladeUser bladeUser) { |
|
|
|
|
QueryWrapper<Tenant> queryWrapper = Condition.getQueryWrapper(tenant, Tenant.class); |
|
|
|
|
IPage<Tenant> pages = tenantService.page(Condition.getPage(query), (!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.lambda().eq(Tenant::getTenantId, bladeUser.getTenantId()) : queryWrapper); |
|
|
|
@ -88,6 +89,7 @@ public class TenantController extends BladeController {
|
|
|
|
|
@GetMapping("/select") |
|
|
|
|
@ApiOperationSupport(order = 3) |
|
|
|
|
@ApiOperation(value = "下拉数据源", notes = "传入tenant") |
|
|
|
|
@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
|
|
|
|
public R<List<Tenant>> select(Tenant tenant, BladeUser bladeUser) { |
|
|
|
|
QueryWrapper<Tenant> queryWrapper = Condition.getQueryWrapper(tenant); |
|
|
|
|
List<Tenant> list = tenantService.list((!bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID)) ? queryWrapper.lambda().eq(Tenant::getTenantId, bladeUser.getTenantId()) : queryWrapper); |
|
|
|
@ -100,6 +102,7 @@ public class TenantController extends BladeController {
|
|
|
|
|
@GetMapping("/page") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@ApiOperation(value = "分页", notes = "传入tenant") |
|
|
|
|
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) |
|
|
|
|
public R<IPage<Tenant>> page(Tenant tenant, Query query) { |
|
|
|
|
IPage<Tenant> pages = tenantService.selectTenantPage(Condition.getPage(query), tenant); |
|
|
|
|
return R.data(pages); |
|
|
|
@ -111,6 +114,7 @@ public class TenantController extends BladeController {
|
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入tenant") |
|
|
|
|
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) |
|
|
|
|
public R submit(@Valid @RequestBody Tenant tenant) { |
|
|
|
|
return R.status(tenantService.saveTenant(tenant)); |
|
|
|
|
} |
|
|
|
@ -122,6 +126,7 @@ public class TenantController extends BladeController {
|
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
|
|
|
|
@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR) |
|
|
|
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(tenantService.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
} |
|
|
|
@ -134,6 +139,7 @@ public class TenantController extends BladeController {
|
|
|
|
|
@GetMapping("/find-by-name") |
|
|
|
|
@ApiOperationSupport(order = 7) |
|
|
|
|
@ApiOperation(value = "详情", notes = "传入tenant") |
|
|
|
|
@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
|
|
|
|
public R<List<Tenant>> findByName(String name) { |
|
|
|
|
List<Tenant> list = tenantService.list(Wrappers.<Tenant>query().lambda().like(Tenant::getTenantName, name)); |
|
|
|
|
return R.data(list); |
|
|
|
|