|
| 1 | +/** |
| 2 | + * Copyright (c) 2023 - present TinyEngine Authors. |
| 3 | + * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd. |
| 4 | + * |
| 5 | + * Use of this source code is governed by an MIT-style license. |
| 6 | + * |
| 7 | + * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, |
| 8 | + * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR |
| 9 | + * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS. |
| 10 | + * |
| 11 | + */ |
| 12 | + |
| 13 | +package com.tinyengine.it.controller; |
| 14 | + |
| 15 | +import com.tinyengine.it.common.base.Result; |
| 16 | +import com.tinyengine.it.common.log.SystemControllerLog; |
| 17 | +import com.tinyengine.it.model.entity.ComponentLibrary; |
| 18 | +import com.tinyengine.it.service.material.ComponentLibraryService; |
| 19 | +import io.swagger.v3.oas.annotations.Operation; |
| 20 | +import io.swagger.v3.oas.annotations.Parameter; |
| 21 | +import io.swagger.v3.oas.annotations.media.Content; |
| 22 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 23 | +import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| 24 | +import io.swagger.v3.oas.annotations.tags.Tag; |
| 25 | +import org.springframework.beans.factory.annotation.Autowired; |
| 26 | +import org.springframework.validation.annotation.Validated; |
| 27 | +import org.springframework.web.bind.annotation.DeleteMapping; |
| 28 | +import org.springframework.web.bind.annotation.GetMapping; |
| 29 | +import org.springframework.web.bind.annotation.PathVariable; |
| 30 | +import org.springframework.web.bind.annotation.PostMapping; |
| 31 | +import org.springframework.web.bind.annotation.RequestBody; |
| 32 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 33 | +import org.springframework.web.bind.annotation.RestController; |
| 34 | + |
| 35 | +import javax.validation.Valid; |
| 36 | +import java.util.List; |
| 37 | + |
| 38 | +/** |
| 39 | + * 组件库API |
| 40 | + * |
| 41 | + * @since 2025-4-02 |
| 42 | + */ |
| 43 | +@Validated |
| 44 | +@RestController |
| 45 | +@RequestMapping("/material-center/api") |
| 46 | +@Tag(name = "组件库") |
| 47 | +public class ComponentLibraryController { |
| 48 | + /** |
| 49 | + * The ComponentLibrary service. |
| 50 | + */ |
| 51 | + @Autowired |
| 52 | + private ComponentLibraryService componentLibraryService; |
| 53 | + |
| 54 | + /** |
| 55 | + * 查询表ComponentLibrary信息列表 |
| 56 | + * |
| 57 | + * @return ComponentLibrary信息 all componentLibrary |
| 58 | + */ |
| 59 | + @Operation(summary = "查询表ComponentLibrary信息列表", |
| 60 | + description = "查询表ComponentLibrary信息列表", |
| 61 | + responses = { |
| 62 | + @ApiResponse(responseCode = "200", description = "返回信息", |
| 63 | + content = @Content(mediaType = "application/json", |
| 64 | + schema = @Schema(implementation = ComponentLibrary.class))), |
| 65 | + @ApiResponse(responseCode = "400", description = "请求失败")}) |
| 66 | + @SystemControllerLog(description = "查询表ComponentLibrary信息列表") |
| 67 | + @GetMapping("/component-library/list") |
| 68 | + public Result<List<ComponentLibrary>> getAllComponentLibrary() { |
| 69 | + List<ComponentLibrary> componentLibraryHistoryList = componentLibraryService.queryAllComponentLibrary(); |
| 70 | + return Result.success(componentLibraryHistoryList); |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * 创建ComponentLibrary |
| 75 | + * |
| 76 | + * @param componentLibrary the componentLibrary |
| 77 | + * @return ComponentLibrary信息 result |
| 78 | + */ |
| 79 | + @Operation(summary = "创建ComponentLibrary", |
| 80 | + description = "创建ComponentLibrary", |
| 81 | + parameters = { |
| 82 | + @Parameter(name = "ComponentLibrary", description = "ComponentLibrary入参对象") |
| 83 | + }, |
| 84 | + responses = { |
| 85 | + @ApiResponse(responseCode = "200", description = "返回信息", |
| 86 | + content = @Content(mediaType = "application/json", |
| 87 | + schema = @Schema(implementation = ComponentLibrary.class))), |
| 88 | + @ApiResponse(responseCode = "400", description = "请求失败")} |
| 89 | + ) |
| 90 | + @SystemControllerLog(description = "创建ComponentLibrary") |
| 91 | + @PostMapping("/component-library/create") |
| 92 | + public Result<ComponentLibrary> createComponentLibrary(@Valid @RequestBody ComponentLibrary componentLibrary) { |
| 93 | + return componentLibraryService.createComponentLibrary(componentLibrary); |
| 94 | + } |
| 95 | + |
| 96 | + /** |
| 97 | + * 修改ComponentLibrary信息 |
| 98 | + * |
| 99 | + * @param id the id |
| 100 | + * @param componentLibrary the componentLibrary |
| 101 | + * @return ComponentLibrary信息 result |
| 102 | + */ |
| 103 | + @Operation(summary = "修改单个ComponentLibrary信息", description = "修改单个ComponentLibrary信息", parameters = { |
| 104 | + @Parameter(name = "id", description = "appId"), |
| 105 | + @Parameter(name = "ComponentLibrary", description = "入参对象")}, responses = { |
| 106 | + @ApiResponse(responseCode = "200", description = "返回信息", |
| 107 | + content = @Content(mediaType = "application/json", |
| 108 | + schema = @Schema(implementation = ComponentLibrary.class))), |
| 109 | + @ApiResponse(responseCode = "400", description = "请求失败")}) |
| 110 | + @SystemControllerLog(description = "修改单个ComponentLibrary信息") |
| 111 | + @PostMapping("/component-library/update/{id}") |
| 112 | + public Result<ComponentLibrary> updateComponentLibrary(@PathVariable Integer id, @RequestBody ComponentLibrary componentLibrary) { |
| 113 | + componentLibrary.setId(id); |
| 114 | + return componentLibraryService.updateComponentLibraryById(componentLibrary); |
| 115 | + } |
| 116 | + |
| 117 | + /** |
| 118 | + * 删除ComponentLibrary信息 |
| 119 | + * |
| 120 | + * @param id the id |
| 121 | + * @return ComponentLibrary信息 result |
| 122 | + */ |
| 123 | + @Operation(summary = "删除ComponentLibrary信息", |
| 124 | + description = "删除ComponentLibrary信息", |
| 125 | + parameters = { |
| 126 | + @Parameter(name = "id", description = "ComponentLibrary主键id") |
| 127 | + }, |
| 128 | + responses = { |
| 129 | + @ApiResponse(responseCode = "200", description = "返回信息", |
| 130 | + content = @Content(mediaType = "application/json", |
| 131 | + schema = @Schema(implementation = ComponentLibrary.class))), |
| 132 | + @ApiResponse(responseCode = "400", description = "请求失败")} |
| 133 | + ) |
| 134 | + @SystemControllerLog(description = "删除ComponentLibrary信息") |
| 135 | + @DeleteMapping("/component-library/delete/{id}") |
| 136 | + public Result<ComponentLibrary> deleteComponentLibrary(@PathVariable Integer id) { |
| 137 | + return componentLibraryService.deleteComponentLibraryById(id); |
| 138 | + } |
| 139 | + |
| 140 | + /** |
| 141 | + * 获取ComponentLibrary信息详情 |
| 142 | + * |
| 143 | + * @param id the id |
| 144 | + * @return the result |
| 145 | + */ |
| 146 | + @Operation(summary = "获取ComponentLibrary信息详情", description = "获取ComponentLibrary信息详情", parameters = { |
| 147 | + @Parameter(name = "id", description = "appId")}, responses = { |
| 148 | + @ApiResponse(responseCode = "200", description = "返回信息", |
| 149 | + content = @Content(mediaType = "application/json", |
| 150 | + schema = @Schema(implementation = ComponentLibrary.class))), |
| 151 | + @ApiResponse(responseCode = "400", description = "请求失败")}) |
| 152 | + @SystemControllerLog(description = "获取ComponentLibrary信息详情") |
| 153 | + @GetMapping("/component-library/detail/{id}") |
| 154 | + public Result<ComponentLibrary> detail(@PathVariable Integer id) { |
| 155 | + return componentLibraryService.queryComponentLibraryById(id); |
| 156 | + } |
| 157 | +} |
0 commit comments