forked from opentiny/tiny-engine-backend-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelDataController.java
More file actions
116 lines (101 loc) · 3.78 KB
/
ModelDataController.java
File metadata and controls
116 lines (101 loc) · 3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package com.tinyengine.it.dynamic.controller;
import com.tinyengine.it.common.base.Result;
import com.tinyengine.it.common.log.SystemControllerLog;
import com.tinyengine.it.dynamic.dto.DynamicDelete;
import com.tinyengine.it.dynamic.dto.DynamicInsert;
import com.tinyengine.it.dynamic.dto.DynamicQuery;
import com.tinyengine.it.dynamic.dto.DynamicUpdate;
import com.tinyengine.it.dynamic.service.DynamicService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Validated
@RestController
@RequestMapping("/platform-center/api")
@Tag(name = "模型数据")
public class ModelDataController {
@Autowired
private DynamicService dynamicService;
/**
* 模型数据查询
*
* @return 返回值 all
*/
@Operation(summary = "模型数据查询", description = "模型数据查询", responses = {
@ApiResponse(responseCode = "200", description = "返回信息",
content = @Content(mediaType = "application/json",schema = @Schema(implementation = Map.class))),
@ApiResponse(responseCode = "400", description = "请求失败")
})
@SystemControllerLog(description = "模型数据查询")
@PostMapping("/queryApi")
public Result<Map<String, Object>> query(@RequestBody DynamicQuery dto) {
try {
return Result.success(dynamicService.queryWithPage(dto));
} catch (Exception e) {
return Result.failed(e.getMessage());
}
}
/**
* 新增模型数据
*
* @return 返回值 map
*/
@Operation(summary = "新增模型数据", description = "新增模型数据", responses = {
@ApiResponse(responseCode = "200", description = "返回信息",
content = @Content(mediaType = "application/json",schema = @Schema(implementation = Map.class))),
@ApiResponse(responseCode = "400", description = "请求失败")
})
@SystemControllerLog(description = "新增模型数据")
@PostMapping("/insertApi")
public Result<Map<String, Object> > insert(@RequestBody DynamicInsert dto) {
try {
return Result.success(dynamicService.insert(dto));
} catch (Exception e) {
return Result.failed(e.getMessage());
}
}
/**
* 更新模型数据
*
* @return 返回值 map
*/
@Operation(summary = "更新模型数据", description = "更新模型数据", responses = {
@ApiResponse(responseCode = "200", description = "返回信息",
content = @Content(mediaType = "application/json",schema = @Schema(implementation = Map.class))),
@ApiResponse(responseCode = "400", description = "请求失败")
})
@SystemControllerLog(description = "更新模型数据")
@PostMapping("/updateApi")
public Result<Map<String, Object> > update(@RequestBody DynamicUpdate dto) {
try {
return Result.success(dynamicService.update(dto));
} catch (Exception e) {
return Result.failed(e.getMessage());
}
}
/**
* 刪除模型数据
*
* @return 返回值 map
*/
@Operation(summary = "刪除模型数据", description = "刪除模型数据", responses = {
@ApiResponse(responseCode = "200", description = "返回信息",
content = @Content(mediaType = "application/json",schema = @Schema(implementation = Map.class))),
@ApiResponse(responseCode = "400", description = "请求失败")
})
@SystemControllerLog(description = "刪除模型数据")
@PostMapping("/deleteApi")
public Result<Map<String, Object> > delete(@RequestBody DynamicDelete dto) {
try {
return Result.success(dynamicService.delete(dto));
} catch (Exception e) {
return Result.failed(e.getMessage());
}
}
}