提交 | 用户 | 时间
|
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; |
7c3e09
|
10 |
import org.springframework.security.access.prepost.PreAuthorize; |
c7f709
|
11 |
import org.springframework.web.bind.annotation.*; |
L |
12 |
|
|
13 |
import javax.annotation.Resource; |
|
14 |
import javax.validation.Valid; |
336bd2
|
15 |
import java.util.Date; |
c7f709
|
16 |
import java.util.List; |
L |
17 |
import java.util.UUID; |
|
18 |
|
|
19 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
20 |
|
|
21 |
/** |
|
22 |
* @author lirm |
|
23 |
* @Description |
|
24 |
* @createTime 2024年08月27日 |
|
25 |
*/ |
|
26 |
@RestController |
7c3e09
|
27 |
@RequestMapping("/data/channel/http/token") |
c7f709
|
28 |
public class HttpTokenController { |
L |
29 |
|
|
30 |
@Resource |
|
31 |
private HttpTokenService httpTokenService; |
|
32 |
|
7c3e09
|
33 |
@PreAuthorize("@ss.hasPermission('data:channel-http:query')") |
c7f709
|
34 |
@GetMapping("page") |
L |
35 |
public CommonResult<PageResult<HttpTokenRespVO>> page(@Valid HttpTokenPageReqVO reqVO) { |
|
36 |
PageResult<HttpTokenEntity> page = httpTokenService.queryPage(reqVO); |
|
37 |
return success(BeanUtils.toBean(page, HttpTokenRespVO.class)); |
|
38 |
} |
|
39 |
|
7c3e09
|
40 |
@PreAuthorize("@ss.hasPermission('data:channel-http:query')") |
c7f709
|
41 |
@GetMapping("list") |
L |
42 |
public CommonResult<List<HttpTokenEntity>> list(){ |
|
43 |
List<HttpTokenEntity> list = httpTokenService.list(); |
|
44 |
return new CommonResult<List<HttpTokenEntity>>().setData(list); |
|
45 |
} |
|
46 |
|
7c3e09
|
47 |
@PreAuthorize("@ss.hasPermission('data:channel-http:query')") |
c7f709
|
48 |
@GetMapping("/info/{id}") |
L |
49 |
public CommonResult<HttpTokenEntity> info(@PathVariable("id") String id){ |
|
50 |
HttpTokenEntity info= httpTokenService.info(id); |
|
51 |
return success(info); |
|
52 |
} |
|
53 |
|
7c3e09
|
54 |
@PreAuthorize("@ss.hasPermission('data:channel-http:create')") |
潘 |
55 |
@PostMapping("/create") |
|
56 |
public CommonResult<Boolean> create(@RequestBody HttpTokenEntity HttpTokenEntity){ |
336bd2
|
57 |
HttpTokenEntity.setId(UUID.randomUUID().toString()); |
潘 |
58 |
HttpTokenEntity.setUpdateTime(new Date()); |
c7f709
|
59 |
httpTokenService.add(HttpTokenEntity); |
L |
60 |
return success(true); |
|
61 |
} |
|
62 |
|
7c3e09
|
63 |
@PreAuthorize("@ss.hasPermission('data:channel-http:update')") |
c7f709
|
64 |
@PutMapping("/update") |
L |
65 |
public CommonResult<Boolean> update(@RequestBody HttpTokenEntity HttpTokenEntity) { |
|
66 |
httpTokenService.update(HttpTokenEntity); |
|
67 |
return success(true); |
|
68 |
} |
|
69 |
|
7c3e09
|
70 |
@PreAuthorize("@ss.hasPermission('data:channel-http:delete')") |
c7f709
|
71 |
@DeleteMapping("/delete") |
L |
72 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
|
73 |
httpTokenService.delete(id); |
|
74 |
return success(true); |
|
75 |
} |
|
76 |
|
7c3e09
|
77 |
@PreAuthorize("@ss.hasPermission('data:channel-http:query')") |
潘 |
78 |
@GetMapping("/api-id") |
|
79 |
public CommonResult<HttpTokenEntity> apiId(@RequestParam("apiId") String apiId) { |
c7f709
|
80 |
HttpTokenEntity info = httpTokenService.getByApiId(apiId); |
L |
81 |
return success(info); |
|
82 |
} |
|
83 |
} |