升级 Knife4j 版本 , 增加租户管理的功能

This commit is contained in:
zhonghua1
2025-12-20 17:45:38 +08:00
parent 08bc957bd0
commit 7e12a154c5
6 changed files with 213 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
package com.rj.controller;
import com.rj.entity.Tenant;
import com.rj.service.ITenantService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -81,5 +82,56 @@ public class TenantController {
expireStartTime, expireEndTime);
return ResponseEntity.ok(result);
}
/**
* 新增租户
*/
@PostMapping("/add")
@Operation(summary = "新增租户", description = "添加新的租户信息")
public ResponseEntity<Map<String, Object>> addTenant(
@Parameter(description = "租户信息", required = true)
@RequestBody Tenant tenant) {
Map<String, Object> result = tenantService.addTenant(tenant);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
} else {
return ResponseEntity.badRequest().body(result);
}
}
/**
* 更新租户信息
*/
@PutMapping("/update")
@Operation(summary = "更新租户信息", description = "更新租户详细信息")
public ResponseEntity<Map<String, Object>> updateTenant(
@Parameter(description = "租户信息", required = true)
@RequestBody Tenant tenant) {
Map<String, Object> result = tenantService.updateTenant(tenant);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
} else {
return ResponseEntity.badRequest().body(result);
}
}
/**
* 根据ID删除租户
*/
@DeleteMapping("/delete/{id}")
@Operation(summary = "删除租户", description = "根据租户ID删除租户信息")
public ResponseEntity<Map<String, Object>> deleteTenant(
@Parameter(description = "租户ID", required = true)
@PathVariable String id) {
Map<String, Object> result = tenantService.deleteTenant(id);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {
return ResponseEntity.ok(result);
} else {
return ResponseEntity.badRequest().body(result);
}
}
}