Skip to content

Commit 59c6ddc

Browse files
committed
feat: component library api
1 parent 9ee1ef1 commit 59c6ddc

File tree

5 files changed

+5
-11
lines changed

5 files changed

+5
-11
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@
3131
import org.springframework.beans.factory.annotation.Autowired;
3232
import org.springframework.validation.annotation.Validated;
3333
import org.springframework.web.bind.annotation.PostMapping;
34+
import org.springframework.web.bind.annotation.RequestBody;
3435
import org.springframework.web.bind.annotation.RequestMapping;
3536
import org.springframework.web.bind.annotation.RequestParam;
3637
import org.springframework.web.bind.annotation.RestController;
3738
import org.springframework.web.multipart.MultipartFile;
3839

40+
import javax.validation.Valid;
3941
import java.util.List;
4042

4143
/**
@@ -108,7 +110,7 @@ public Result<BundleResultDto> bundleSplit(@RequestParam MultipartFile file) {
108110
@ApiResponse(responseCode = "400", description = "请求失败")})
109111
@SystemControllerLog(description = "批量创建自定义组件")
110112
@PostMapping("/component/batch/create")
111-
public Result<FileResult> createCustComponent(@RequestParam CustComponentDto custComponentDto) {
113+
public Result<FileResult> createCustComponent(@Valid @RequestBody CustComponentDto custComponentDto) {
112114
// 返回插入和更新的条数
113115
return componentService.custComponentBatchCreate(custComponentDto);
114116
}

base/src/main/java/com/tinyengine/it/controller/ComponentLibraryController.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;
@@ -131,7 +132,7 @@ public Result<ComponentLibrary> updateComponentLibrary(@PathVariable Integer id,
131132
@ApiResponse(responseCode = "400", description = "请求失败")}
132133
)
133134
@SystemControllerLog(description = "删除ComponentLibrary信息")
134-
@GetMapping("/component-library/delete/{id}")
135+
@DeleteMapping("/component-library/delete/{id}")
135136
public Result<ComponentLibrary> deleteComponentLibrary(@PathVariable Integer id) {
136137
return componentLibraryService.deleteComponentLibraryById(id);
137138
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ public List<ComponentLibrary> queryAllComponentLibrary() {
5656
@Override
5757
public Result<ComponentLibrary> queryComponentLibraryById(@Param("id") Integer id) {
5858
ComponentLibrary material = componentLibraryMapper.queryComponentLibraryById(id);
59-
if(null == material.getId()){
60-
return Result.failed(ExceptionEnum.CM009);
61-
}
6259
return Result.success(material);
6360
}
6461

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ public List<MaterialHistory> findAllMaterialHistory() {
6060
@Override
6161
public Result<MaterialHistory> findMaterialHistoryById(@Param("id") Integer id) {
6262
MaterialHistory materialHistory = materialHistoryMapper.queryMaterialHistoryById(id);
63-
if (null == materialHistory.getId()) {
64-
return Result.failed(ExceptionEnum.CM009);
65-
}
6663
return Result.success(materialHistory);
6764
}
6865

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ public List<Material> queryAllMaterial() {
5757
@Override
5858
public Result<Material> queryMaterialById(@Param("id") Integer id) {
5959
Material material = materialMapper.queryMaterialById(id);
60-
if(null == material.getId()){
61-
return Result.failed(ExceptionEnum.CM009);
62-
}
6360
return Result.success(material);
6461
}
6562

0 commit comments

Comments
 (0)