租户管理的代码框架
This commit is contained in:
85
src/main/java/com/rj/controller/TenantController.java
Normal file
85
src/main/java/com/rj/controller/TenantController.java
Normal file
@@ -0,0 +1,85 @@
|
||||
package com.rj.controller;
|
||||
|
||||
import com.rj.service.ITenantService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 租户表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author 系统生成
|
||||
* @since 2025-01-XX
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/tenant")
|
||||
@Tag(name = "租户管理", description = "租户管理相关接口")
|
||||
public class TenantController {
|
||||
|
||||
@Autowired
|
||||
private ITenantService tenantService;
|
||||
|
||||
/**
|
||||
* 分页查询租户列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "分页查询租户列表", description = "根据条件分页查询租户信息列表")
|
||||
public ResponseEntity<Map<String, Object>> getTenantList(
|
||||
@Parameter(description = "页码", example = "1")
|
||||
@RequestParam(defaultValue = "1") Integer current,
|
||||
@Parameter(description = "每页大小", example = "10")
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@Parameter(description = "租户编码(精确查询)")
|
||||
@RequestParam(required = false) String tenantCode,
|
||||
@Parameter(description = "租户名称(模糊查询)")
|
||||
@RequestParam(required = false) String tenantName,
|
||||
@Parameter(description = "状态:1-启用,0-禁用")
|
||||
@RequestParam(required = false) Integer status,
|
||||
@Parameter(description = "联系人姓名(模糊查询)")
|
||||
@RequestParam(required = false) String contactName,
|
||||
@Parameter(description = "联系人电话(模糊查询)")
|
||||
@RequestParam(required = false) String contactPhone,
|
||||
@Parameter(description = "过期时间开始(格式:yyyy-MM-dd HH:mm:ss)")
|
||||
@RequestParam(required = false) String expireStartTime,
|
||||
@Parameter(description = "过期时间结束(格式:yyyy-MM-dd HH:mm:ss)")
|
||||
@RequestParam(required = false) String expireEndTime) {
|
||||
Map<String, Object> result = tenantService.getTenantList(current, size, tenantCode, tenantName,
|
||||
status, contactName, contactPhone,
|
||||
expireStartTime, expireEndTime);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件查询租户列表(不分页)
|
||||
*/
|
||||
@GetMapping("/listAll")
|
||||
@Operation(summary = "查询租户列表(不分页)", description = "根据条件查询所有租户信息,不分页")
|
||||
public ResponseEntity<Map<String, Object>> getTenantListWithoutPage(
|
||||
@Parameter(description = "租户编码(精确查询)")
|
||||
@RequestParam(required = false) String tenantCode,
|
||||
@Parameter(description = "租户名称(模糊查询)")
|
||||
@RequestParam(required = false) String tenantName,
|
||||
@Parameter(description = "状态:1-启用,0-禁用")
|
||||
@RequestParam(required = false) Integer status,
|
||||
@Parameter(description = "联系人姓名(模糊查询)")
|
||||
@RequestParam(required = false) String contactName,
|
||||
@Parameter(description = "联系人电话(模糊查询)")
|
||||
@RequestParam(required = false) String contactPhone,
|
||||
@Parameter(description = "过期时间开始(格式:yyyy-MM-dd HH:mm:ss)")
|
||||
@RequestParam(required = false) String expireStartTime,
|
||||
@Parameter(description = "过期时间结束(格式:yyyy-MM-dd HH:mm:ss)")
|
||||
@RequestParam(required = false) String expireEndTime) {
|
||||
Map<String, Object> result = tenantService.getTenantListWithoutPage(tenantCode, tenantName,
|
||||
status, contactName, contactPhone,
|
||||
expireStartTime, expireEndTime);
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user