提交 | 用户 | 时间
|
a6de49
|
1 |
package com.iailab.module.data.http.controller.admin; |
H |
2 |
|
|
3 |
import com.iailab.framework.common.page.PageData; |
|
4 |
import com.iailab.module.data.common.utils.R; |
|
5 |
import com.iailab.framework.common.pojo.CommonResult; |
|
6 |
import com.iailab.module.data.http.entity.HttpTokenEntity; |
|
7 |
import com.iailab.module.data.http.service.HttpTokenService; |
|
8 |
import javax.annotation.Resource; |
|
9 |
import org.springframework.web.bind.annotation.*; |
|
10 |
|
|
11 |
import java.util.Map; |
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
/** |
|
15 |
* @author PanZhibao |
|
16 |
* @Description |
|
17 |
* @createTime 2023年12月22日 10:52:00 |
|
18 |
*/ |
|
19 |
@RestController |
|
20 |
@RequestMapping("/data/http/token") |
|
21 |
public class HttpTokenController { |
|
22 |
|
|
23 |
@Resource |
|
24 |
private HttpTokenService httpTokenService; |
|
25 |
|
|
26 |
/** |
|
27 |
* 分页 |
|
28 |
* |
|
29 |
* @param params |
|
30 |
* @return |
|
31 |
*/ |
|
32 |
@GetMapping("page") |
|
33 |
public CommonResult<PageData<HttpTokenEntity>> page(@RequestParam Map<String, Object> params) { |
|
34 |
PageData<HttpTokenEntity> page = httpTokenService.page(params); |
|
35 |
|
|
36 |
return new CommonResult<PageData<HttpTokenEntity>>().setData(page); |
|
37 |
} |
|
38 |
|
|
39 |
/** |
|
40 |
* 详情 |
|
41 |
* |
|
42 |
* @param id |
|
43 |
*/ |
|
44 |
@GetMapping("/info/{id}") |
|
45 |
public R info(@PathVariable("id") String id) { |
|
46 |
HttpTokenEntity info = httpTokenService.selectById(id); |
|
47 |
return R.ok().put("data", info); |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* 详情 |
|
52 |
* |
|
53 |
* @param apiId |
|
54 |
*/ |
|
55 |
@GetMapping("/api-id/{apiId}") |
|
56 |
public R apiId(@PathVariable("apiId") String apiId) { |
|
57 |
HttpTokenEntity info = httpTokenService.getByApiId(apiId); |
|
58 |
return R.ok().put("data", info); |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* 添加 |
|
63 |
* |
|
64 |
* @param httpApiEntity |
|
65 |
*/ |
|
66 |
@PostMapping("/add") |
|
67 |
public R add(@RequestBody HttpTokenEntity httpApiEntity) { |
|
68 |
String id = UUID.randomUUID().toString(); |
|
69 |
httpApiEntity.setId(id); |
|
70 |
httpTokenService.insert(httpApiEntity); |
|
71 |
return R.ok(); |
|
72 |
} |
|
73 |
|
|
74 |
/** |
|
75 |
* 修改 |
|
76 |
* |
|
77 |
* @param httpApiEntity |
|
78 |
*/ |
|
79 |
@PostMapping("/update") |
|
80 |
public R update(@RequestBody HttpTokenEntity httpApiEntity) { |
|
81 |
httpTokenService.updateById(httpApiEntity); |
|
82 |
return R.ok(); |
|
83 |
} |
|
84 |
|
|
85 |
/** |
|
86 |
* 删除 |
|
87 |
* |
|
88 |
* @param params |
|
89 |
*/ |
|
90 |
@PostMapping("/delete") |
|
91 |
public R delete(@RequestBody Map<String, Object> params) { |
|
92 |
String id = (String) params.get("id"); |
|
93 |
httpTokenService.deleteById(id); |
|
94 |
return R.ok(); |
|
95 |
} |
|
96 |
} |