Skip to content

Commit 3438b96

Browse files
committed
feat: Add inspection file
1 parent 091ed5e commit 3438b96

File tree

7 files changed

+56
-6
lines changed

7 files changed

+56
-6
lines changed

base/src/main/java/com/tinyengine/it/controller/PlatformController.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import io.swagger.v3.oas.annotations.tags.Tag;
2525
import org.springframework.beans.factory.annotation.Autowired;
2626
import org.springframework.validation.annotation.Validated;
27+
import org.springframework.web.bind.annotation.DeleteMapping;
2728
import org.springframework.web.bind.annotation.GetMapping;
2829
import org.springframework.web.bind.annotation.PathVariable;
2930
import org.springframework.web.bind.annotation.PostMapping;
@@ -143,6 +144,23 @@ public Result<Platform> updatePlatform(@PathVariable Integer id, @RequestBody Pl
143144
* @param id the id
144145
* @return platform信息 result
145146
*/
147+
@Operation(summary = "删除platform信息,与js同路由",
148+
description = "删除platform信息,与js同路由",
149+
parameters = {
150+
@Parameter(name = "id", description = "Platform主键id")
151+
},
152+
responses = {
153+
@ApiResponse(responseCode = "200", description = "返回信息",
154+
content = @Content(mediaType = "application/json",
155+
schema = @Schema(implementation = Platform.class))),
156+
@ApiResponse(responseCode = "400", description = "请求失败")}
157+
)
158+
@SystemControllerLog(description = "删除platform信息,与js同路由")
159+
@GetMapping("/platform/delete/{id}")
160+
public Result<Platform> delete(@PathVariable Integer id) {
161+
return platformService.deletePlatformById(id);
162+
}
163+
146164
@Operation(summary = "删除platform信息",
147165
description = "删除platform信息",
148166
parameters = {
@@ -155,7 +173,7 @@ public Result<Platform> updatePlatform(@PathVariable Integer id, @RequestBody Pl
155173
@ApiResponse(responseCode = "400", description = "请求失败")}
156174
)
157175
@SystemControllerLog(description = "删除platform信息")
158-
@GetMapping("/platform/delete/{id}")
176+
@DeleteMapping("/platform/delete/{id}")
159177
public Result<Platform> deletePlatform(@PathVariable Integer id) {
160178
return platformService.deletePlatformById(id);
161179
}

base/src/main/java/com/tinyengine/it/controller/PlatformHistoryController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import io.swagger.v3.oas.annotations.tags.Tag;
2525
import org.springframework.beans.factory.annotation.Autowired;
2626
import org.springframework.validation.annotation.Validated;
27+
import org.springframework.web.bind.annotation.DeleteMapping;
2728
import org.springframework.web.bind.annotation.GetMapping;
2829
import org.springframework.web.bind.annotation.PathVariable;
2930
import org.springframework.web.bind.annotation.PostMapping;
@@ -155,7 +156,7 @@ public Result<PlatformHistory> updatePlatformHistory(@PathVariable Integer id, @
155156
@ApiResponse(responseCode = "400", description = "请求失败")}
156157
)
157158
@SystemControllerLog(description = "删除platformHistory信息")
158-
@GetMapping("/platform-history/delete/{id}")
159+
@DeleteMapping("/platform-history/delete/{id}")
159160
public Result<PlatformHistory> deletePlatformHistory(@PathVariable Integer id) {
160161
return platformHistoryService.deletePlatformHistoryById(id);
161162
}

base/src/main/java/com/tinyengine/it/service/material/impl/ComponentServiceImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,10 @@ public Integer createComponent(Component component) {
141141
@SystemServiceLog(description = "readFileAndBulkCreate 创建组件库及组件实现方法")
142142
@Override
143143
public Result<FileResult> readFileAndBulkCreate(MultipartFile file) {
144-
List<Component> componentList = this.bundleSplit(file).getData().getComponentList();
145-
List<ComponentLibrary> packageList = this.bundleSplit(file).getData().getPackageList();
144+
Result<BundleResultDto> bundleResultDtoResult = this.bundleSplit(file);
145+
BundleResultDto data = bundleResultDtoResult.getData();
146+
List<Component> componentList = data.getComponentList();
147+
List<ComponentLibrary> packageList = data.getPackageList();
146148
if (null == packageList || packageList.isEmpty()) {
147149
return bulkCreate(componentList);
148150
}
@@ -181,6 +183,7 @@ public Result<FileResult> readFileAndBulkCreate(MultipartFile file) {
181183
@Override
182184
@SystemServiceLog(description = "bundleSplit 拆分bundle.json实现方法")
183185
public Result<BundleResultDto> bundleSplit(MultipartFile file) {
186+
// 检验文件
184187
boolean isFileCheck = this.checkFile(file);
185188
if (!isFileCheck){
186189
return Result.failed(ExceptionEnum.CM325);

base/src/main/java/com/tinyengine/it/service/platform/impl/PlatformHistorySrviceImpl.java renamed to base/src/main/java/com/tinyengine/it/service/platform/impl/PlatformHistoryServiceImpl.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
@Service
3232
@Slf4j
33-
public class PlatformHistorySrviceImpl implements PlatformHistoryService {
33+
public class PlatformHistoryServiceImpl implements PlatformHistoryService {
3434
@Autowired
3535
private PlatformHistoryMapper platformHistoryMapper;
3636

@@ -93,6 +93,9 @@ public Result<PlatformHistory> deletePlatformHistoryById(Integer id) {
9393
*/
9494
@Override
9595
public Result<PlatformHistory> updatePlatformHistoryById(PlatformHistory platformHistory) {
96+
if (platformHistory == null || platformHistory.getId() == null) {
97+
return Result.failed(ExceptionEnum.CM002);
98+
}
9699
int updateResult = platformHistoryMapper.updatePlatformHistoryById(platformHistory);
97100
if (updateResult != 1) {
98101
return Result.failed(ExceptionEnum.CM008);
@@ -109,6 +112,21 @@ public Result<PlatformHistory> updatePlatformHistoryById(PlatformHistory platfor
109112
*/
110113
@Override
111114
public Result<PlatformHistory> createPlatformHistory(PlatformHistory platformHistory) {
115+
if (platformHistory == null) {
116+
return Result.failed(ExceptionEnum.CM002);
117+
}
118+
if (platformHistory.getRefId() == null) {
119+
return Result.failed(ExceptionEnum.CM002);
120+
}
121+
if (platformHistory.getName() == null || platformHistory.getName().isEmpty()) {
122+
return Result.failed(ExceptionEnum.CM002);
123+
}
124+
if (platformHistory.getVersion() == null || platformHistory.getVersion().isEmpty()) {
125+
return Result.failed(ExceptionEnum.CM002);
126+
}
127+
if (platformHistory.getMaterialHistoryId() == null) {
128+
return Result.failed(ExceptionEnum.CM002);
129+
}
112130
int createResult = platformHistoryMapper.createPlatformHistory(platformHistory);
113131
if (createResult != 1) {
114132
return Result.failed(ExceptionEnum.CM008);

base/src/main/java/com/tinyengine/it/service/platform/impl/PlatformServiceImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ public Result<Platform> deletePlatformById(@Param("id") Integer id) {
9696
*/
9797
@Override
9898
public Result<Platform> updatePlatformById(Platform platform) {
99+
if (platform == null || platform.getId() == null) {
100+
return Result.failed(ExceptionEnum.CM002);
101+
}
99102
int updateResult = platformMapper.updatePlatformById(platform);
100103
if (updateResult != 1) {
101104
return Result.failed(ExceptionEnum.CM008);
@@ -112,6 +115,12 @@ public Result<Platform> updatePlatformById(Platform platform) {
112115
*/
113116
@Override
114117
public Result<Platform> createPlatform(Platform platform) {
118+
if (platform == null) {
119+
return Result.failed(ExceptionEnum.CM002);
120+
}
121+
if (platform.getName() == null || platform.getName().isEmpty()) {
122+
return Result.failed(ExceptionEnum.CM002);
123+
}
115124
int createResult = platformMapper.createPlatform(platform);
116125
if (createResult != 1) {
117126
return Result.failed(ExceptionEnum.CM008);

base/src/main/resources/mappers/PlatformHistoryMapper.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
<select id="queryAllPlatformHistory" resultMap="PlatformHistoryMap">
156156
SELECT
157157
<include refid="Base_Column_List"/>
158-
FROM t_platform_history_history
158+
FROM t_platform_history
159159
</select>
160160

161161
<!-- 根据主键id查询表t_platform_history信息 -->

base/src/test/java/com/tinyengine/it/service/platform/impl/PlatformServiceImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ void testUpdatePlatformById() {
9797
@Test
9898
void testCreatePlatform() {
9999
Platform param = new Platform();
100+
param.setName("testPlatform");
100101
when(platformMapper.createPlatform(param)).thenReturn(1);
101102

102103
Result<Platform> result = platformServiceImpl.createPlatform(param);

0 commit comments

Comments
 (0)