From d1a361b8b702079d4c3d8cb5dd26fe5bbb79cf6d Mon Sep 17 00:00:00 2001 From: xlsea Date: Mon, 15 Jan 2024 11:55:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BA=94=E7=94=A8=E8=B4=A6?= =?UTF-8?q?=E6=88=B7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openapi/constant/OpenApiV1Constants.java | 5 ++ .../endpoint/app/AppAccountController.java | 86 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/app/AppAccountController.java diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/constant/OpenApiV1Constants.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/constant/OpenApiV1Constants.java index e6c02277..b02b8ab6 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/constant/OpenApiV1Constants.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/constant/OpenApiV1Constants.java @@ -57,4 +57,9 @@ public class OpenApiV1Constants { * 组织 */ public final static String ORGANIZATION_PATH = ACCOUNT_PATH + "/organization"; + + /** + * 组织 + */ + public final static String APP_ACCOUNT_PATH = ACCOUNT_PATH + "/app/account"; } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/app/AppAccountController.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/app/AppAccountController.java new file mode 100644 index 00000000..ef87f35c --- /dev/null +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/app/AppAccountController.java @@ -0,0 +1,86 @@ +package cn.topiam.employee.openapi.endpoint.app; + +import cn.topiam.employee.audit.annotation.Audit; +import cn.topiam.employee.audit.event.type.EventType; +import cn.topiam.employee.common.entity.app.query.AppAccountQuery; +import cn.topiam.employee.openapi.common.OpenApiResponse; +import cn.topiam.employee.openapi.pojo.result.app.AppAccountListResult; +import cn.topiam.employee.openapi.pojo.save.app.AppAccountCreateParam; +import cn.topiam.employee.openapi.service.app.AppAccountService; +import cn.topiam.employee.support.lock.Lock; +import cn.topiam.employee.support.preview.Preview; +import cn.topiam.employee.support.repository.page.domain.Page; +import cn.topiam.employee.support.repository.page.domain.PageModel; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import static cn.topiam.employee.openapi.constant.OpenApiV1Constants.APP_ACCOUNT_PATH; + +/** + * 应用账户 + * + * @author xlsea + * @since 2024-01-15 + */ +@Validated +@Tag(name = "应用账户") +@RestController +@RequiredArgsConstructor +@RequestMapping(value = APP_ACCOUNT_PATH, produces = MediaType.APPLICATION_JSON_VALUE) +public class AppAccountController { + + /** + * 获取应用账户列表 + * + * @param page {@link PageModel} + * @param query {@link AppAccountQuery} + * @return {@link AppAccountListResult} + */ + @Operation(summary = "获取应用账户列表") + @GetMapping(value = "/list") + public OpenApiResponse> getAppAccountList(PageModel page, + @Validated AppAccountQuery query) { + return OpenApiResponse.success((appAccountService.getAppAccountList(page, query))); + } + + /** + * 创建应用账户 + * + * @param param {@link AppAccountCreateParam} + * @return {@link Boolean} + */ + @Lock + @Preview + @PostMapping(value = "/create") + @Audit(type = EventType.ADD_APP_ACCOUNT) + @Operation(summary = "创建应用账户") + public OpenApiResponse createAppAccount(@RequestBody @Validated AppAccountCreateParam param) { + appAccountService.createAppAccount(param); + return OpenApiResponse.success(); + } + + /** + * 删除应用账户 + * + * @param id {@link String} + * @return {@link Boolean} + */ + @Lock + @Preview + @Operation(summary = "删除应用账户") + @Audit(type = EventType.DELETE_APP_ACCOUNT) + @DeleteMapping(value = "/delete/{id}") + public OpenApiResponse deleteAppAccount(@PathVariable(value = "id") String id) { + appAccountService.deleteAppAccount(id); + return OpenApiResponse.success(); + } + + /** + * 应用账户服务类 + */ + private final AppAccountService appAccountService; +}