提交 | 用户 | 时间
|
c7f709
|
1 |
package com.iailab.module.data.channel.http.controller.admin; |
L |
2 |
|
|
3 |
import com.iailab.framework.common.pojo.CommonResult; |
|
4 |
import com.iailab.framework.common.pojo.PageResult; |
|
5 |
import com.iailab.framework.common.util.object.BeanUtils; |
|
6 |
import com.iailab.module.data.channel.http.entity.HttpTokenEntity; |
|
7 |
import com.iailab.module.data.channel.http.service.HttpTokenService; |
|
8 |
import com.iailab.module.data.channel.http.vo.HttpTokenPageReqVO; |
|
9 |
import com.iailab.module.data.channel.http.vo.HttpTokenRespVO; |
|
10 |
import org.springframework.web.bind.annotation.*; |
|
11 |
|
|
12 |
import javax.annotation.Resource; |
|
13 |
import javax.validation.Valid; |
|
14 |
import java.util.List; |
|
15 |
import java.util.UUID; |
|
16 |
|
|
17 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
18 |
|
|
19 |
/** |
|
20 |
* @author lirm |
|
21 |
* @Description |
|
22 |
* @createTime 2024年08月27日 |
|
23 |
*/ |
|
24 |
@RestController |
|
25 |
@RequestMapping("/data/http/token") |
|
26 |
public class HttpTokenController { |
|
27 |
|
|
28 |
@Resource |
|
29 |
private HttpTokenService httpTokenService; |
|
30 |
|
|
31 |
@GetMapping("page") |
|
32 |
public CommonResult<PageResult<HttpTokenRespVO>> page(@Valid HttpTokenPageReqVO reqVO) { |
|
33 |
PageResult<HttpTokenEntity> page = httpTokenService.queryPage(reqVO); |
|
34 |
return success(BeanUtils.toBean(page, HttpTokenRespVO.class)); |
|
35 |
} |
|
36 |
|
|
37 |
@GetMapping("list") |
|
38 |
public CommonResult<List<HttpTokenEntity>> list(){ |
|
39 |
List<HttpTokenEntity> list = httpTokenService.list(); |
|
40 |
return new CommonResult<List<HttpTokenEntity>>().setData(list); |
|
41 |
} |
|
42 |
|
|
43 |
@GetMapping("/info/{id}") |
|
44 |
public CommonResult<HttpTokenEntity> info(@PathVariable("id") String id){ |
|
45 |
HttpTokenEntity info= httpTokenService.info(id); |
|
46 |
return success(info); |
|
47 |
} |
|
48 |
|
|
49 |
@PostMapping("/add") |
|
50 |
public CommonResult<Boolean> add(@RequestBody HttpTokenEntity HttpTokenEntity){ |
|
51 |
String id = UUID.randomUUID().toString(); |
|
52 |
HttpTokenEntity.setId(id); |
|
53 |
httpTokenService.add(HttpTokenEntity); |
|
54 |
return success(true); |
|
55 |
} |
|
56 |
|
|
57 |
@PutMapping("/update") |
|
58 |
public CommonResult<Boolean> update(@RequestBody HttpTokenEntity HttpTokenEntity) { |
|
59 |
httpTokenService.update(HttpTokenEntity); |
|
60 |
return success(true); |
|
61 |
} |
|
62 |
|
|
63 |
@DeleteMapping("/delete") |
|
64 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
|
65 |
httpTokenService.delete(id); |
|
66 |
return success(true); |
|
67 |
} |
|
68 |
|
|
69 |
@GetMapping("/api-id/{apiId}") |
|
70 |
public CommonResult<HttpTokenEntity> apiId(@PathVariable("apiId") String apiId) { |
|
71 |
HttpTokenEntity info = httpTokenService.getByApiId(apiId); |
|
72 |
return success(info); |
|
73 |
} |
|
74 |
} |