mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-10-20 07:01:31 +08:00
refactor: 重构内部 API 依赖模式(降低耦合,公众号投票结论),在 common 模块新增 api 包,在对应 biz 模块增加实现
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.api.system;
|
||||
|
||||
import top.continew.starter.extension.crud.model.resp.LabelValueResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典业务 API
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2025/7/26 10:16
|
||||
*/
|
||||
public interface DictApi {
|
||||
|
||||
/**
|
||||
* 查询字典列表
|
||||
*
|
||||
* @return 字典列表(包含枚举字典列表)
|
||||
*/
|
||||
List<LabelValueResp> listAll();
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.api.system;
|
||||
|
||||
import top.continew.starter.extension.crud.model.resp.LabelValueResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典项业务 API
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2025/4/9 20:17
|
||||
*/
|
||||
public interface DictItemApi {
|
||||
|
||||
/**
|
||||
* 根据字典编码查询
|
||||
*
|
||||
* @param dictCode 字典编码
|
||||
* @return 字典项列表
|
||||
*/
|
||||
List<LabelValueResp> listByDictCode(String dictCode);
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.api.system;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单业务 API
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2025/7/26 9:53
|
||||
*/
|
||||
public interface MenuApi {
|
||||
|
||||
/**
|
||||
* 查询树结构列表
|
||||
*
|
||||
* @param excludeMenuIds 排除的菜单 ID 列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
List<Tree<Long>> listTree(List<Long> excludeMenuIds);
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.api.system;
|
||||
|
||||
/**
|
||||
* 角色业务 API
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2025/7/26 9:39
|
||||
*/
|
||||
public interface RoleApi {
|
||||
|
||||
/**
|
||||
* 根据编码查询 ID
|
||||
*
|
||||
* @param code 编码
|
||||
* @return 角色 ID
|
||||
*/
|
||||
Long getIdByCode(String code);
|
||||
|
||||
/**
|
||||
* 更新用户上下文
|
||||
*
|
||||
* @param roleId 角色 ID
|
||||
*/
|
||||
void updateUserContext(Long roleId);
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.api.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色和菜单关联业务 API
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2025/7/26 9:39
|
||||
*/
|
||||
public interface RoleMenuApi {
|
||||
|
||||
/**
|
||||
* 根据菜单 ID 列表查询角色 ID 列表
|
||||
*
|
||||
* @param menuIds 菜单 ID 列表(Not In)
|
||||
* @return 角色 ID 列表
|
||||
*/
|
||||
Set<Long> listRoleIdByNotInMenuIds(List<Long> menuIds);
|
||||
|
||||
/**
|
||||
* 根据角色 ID 列表查询菜单 ID 列表
|
||||
*
|
||||
* @param roleIds 角色 ID 列表
|
||||
* @return 菜单 ID 列表
|
||||
*/
|
||||
List<Long> listMenuIdByRoleIds(List<Long> roleIds);
|
||||
|
||||
/**
|
||||
* 根据菜单 ID 列表删除
|
||||
*
|
||||
* @param menuIds 菜单 ID 列表(Not In)
|
||||
*/
|
||||
void deleteByNotInMenuIds(List<Long> menuIds);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param menuIds 菜单 ID 列表
|
||||
* @param roleId 角色 ID
|
||||
* @return 是否新增成功(true:成功;false:无变更/失败)
|
||||
*/
|
||||
boolean add(List<Long> menuIds, Long roleId);
|
||||
}
|
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.api.system;
|
||||
|
||||
import cn.crane4j.annotation.ContainerMethod;
|
||||
import cn.crane4j.annotation.MappingType;
|
||||
import top.continew.admin.common.constant.ContainerConstants;
|
||||
|
||||
/**
|
||||
* 用户业务 API
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2025/1/9 20:17
|
||||
*/
|
||||
public interface UserApi {
|
||||
|
||||
/**
|
||||
* 根据 ID 查询昵称
|
||||
*
|
||||
* <p>
|
||||
* 数据填充容器 {@link ContainerConstants#USER_NICKNAME}
|
||||
* </p>
|
||||
*
|
||||
* @param id ID
|
||||
* @return 昵称
|
||||
*/
|
||||
@ContainerMethod(namespace = ContainerConstants.USER_NICKNAME, type = MappingType.ORDER_OF_KEYS)
|
||||
String getNicknameById(Long id);
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
* @param newPassword 新密码
|
||||
* @param id ID
|
||||
*/
|
||||
void resetPassword(String newPassword, Long id);
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.api.tenant;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 套餐和菜单关联业务 API
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2025/7/23 21:13
|
||||
*/
|
||||
public interface PackageMenuApi {
|
||||
|
||||
/**
|
||||
* 根据套餐 ID 查询
|
||||
*
|
||||
* @param packageId 套餐 ID
|
||||
* @return 菜单 ID 列表
|
||||
*/
|
||||
List<Long> listMenuIdsByPackageId(Long packageId);
|
||||
}
|
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.api.tenant;
|
||||
|
||||
/**
|
||||
* 租户业务 API
|
||||
*
|
||||
* @author Charles7c
|
||||
* @since 2025/7/23 21:13
|
||||
*/
|
||||
public interface TenantApi {
|
||||
|
||||
/**
|
||||
* 绑定租户管理员用户
|
||||
*
|
||||
* @param tenantId 租户 ID
|
||||
* @param userId 用户 ID
|
||||
*/
|
||||
void bindAdminUser(Long tenantId, Long userId);
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package top.continew.admin.common.api.tenant;
|
||||
|
||||
import top.continew.admin.common.model.dto.TenantDTO;
|
||||
|
||||
/**
|
||||
* 租户数据 API
|
||||
*
|
||||
* @author 小熊
|
||||
* @author Charles7c
|
||||
* @since 2024/12/2 20:08
|
||||
*/
|
||||
public interface TenantDataApi {
|
||||
|
||||
/**
|
||||
* 初始化数据
|
||||
*
|
||||
* @param tenant 租户信息
|
||||
*/
|
||||
void init(TenantDTO tenant);
|
||||
|
||||
/**
|
||||
* 清除数据
|
||||
*/
|
||||
void clear();
|
||||
}
|
Reference in New Issue
Block a user