refactor: 增加租户查询条件 (#181)

This commit is contained in:
luoqiz
2025-08-06 09:49:57 +08:00
committed by GitHub
parent df6e294cbd
commit 2bb2f96857
4 changed files with 21 additions and 5 deletions

View File

@@ -32,7 +32,8 @@ public interface MenuApi {
* 查询树结构列表
*
* @param excludeMenuIds 排除的菜单 ID 列表
* @param isSimple 是否是简单树结构
* @return 树结构列表
*/
List<Tree<Long>> listTree(List<Long> excludeMenuIds);
List<Tree<Long>> listTree(List<Long> excludeMenuIds, boolean isSimple);
}

View File

@@ -22,6 +22,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import top.continew.admin.common.api.system.MenuApi;
import top.continew.admin.common.base.controller.BaseController;
@@ -56,7 +57,7 @@ public class PackageController extends BaseController<PackageService, PackageRes
@Operation(summary = "查询租户套餐菜单", description = "查询租户套餐菜单树列表")
@SaCheckPermission("tenant:package:list")
@GetMapping("/menu/tree")
public List<Tree<Long>> listMenuTree() {
return menuApi.listTree(tenantExtensionProperties.getIgnoreMenus());
public List<Tree<Long>> listMenuTree(@RequestParam(required = false, defaultValue = "true") Boolean isSimple) {
return menuApi.listTree(tenantExtensionProperties.getIgnoreMenus(), isSimple);
}
}

View File

@@ -45,6 +45,20 @@ public class TenantQuery implements Serializable {
@Query(columns = {"name", "description"}, type = QueryType.LIKE)
private String description;
/**
* 编码
*/
@Schema(description = "编码", example = "T0stxiJK6RMH")
@Query(type = QueryType.EQ)
private String code;
/**
* 域名
*/
@Schema(description = "域名", example = "admin.continew.top")
@Query(type = QueryType.LIKE)
private String domain;
/**
* 套餐 ID
*/

View File

@@ -39,11 +39,11 @@ public class MenuApiImpl implements MenuApi {
private final MenuService baseService;
@Override
public List<Tree<Long>> listTree(List<Long> excludeMenuIds) {
public List<Tree<Long>> listTree(List<Long> excludeMenuIds, boolean isSimple) {
MenuQuery query = new MenuQuery();
query.setStatus(DisEnableStatusEnum.ENABLE);
// 过滤掉租户不能使用的菜单
query.setExcludeMenuIdList(excludeMenuIds);
return baseService.tree(query, null, true);
return baseService.tree(query, null, isSimple);
}
}