提交 | 用户 | 时间
|
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.HttpApiEntity; |
|
7 |
import com.iailab.module.data.channel.http.service.HttpApiService; |
|
8 |
import com.iailab.module.data.channel.http.vo.HttpApiPageReqVO; |
|
9 |
import com.iailab.module.data.channel.http.vo.HttpApiRespVO; |
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 |
6bf63b
|
27 |
@RequestMapping("/data/channel/http/api") |
c7f709
|
28 |
public class HttpApiController { |
L |
29 |
|
|
30 |
@Resource |
|
31 |
private HttpApiService httpApiService; |
|
32 |
|
7c3e09
|
33 |
@PreAuthorize("@ss.hasPermission('data:channel-http:query')") |
c7f709
|
34 |
@GetMapping("page") |
L |
35 |
public CommonResult<PageResult<HttpApiRespVO>> page(@Valid HttpApiPageReqVO reqVO) { |
|
36 |
PageResult<HttpApiEntity> page = httpApiService.queryPage(reqVO); |
|
37 |
return success(BeanUtils.toBean(page, HttpApiRespVO.class)); |
|
38 |
} |
|
39 |
|
7c3e09
|
40 |
@PreAuthorize("@ss.hasPermission('data:channel-http:query')") |
c7f709
|
41 |
@GetMapping("list") |
L |
42 |
public CommonResult<List<HttpApiEntity>> list() { |
|
43 |
List<HttpApiEntity> list = httpApiService.list(); |
|
44 |
return success(list); |
|
45 |
} |
|
46 |
|
7c3e09
|
47 |
@PreAuthorize("@ss.hasPermission('data:channel-http:query')") |
c7f709
|
48 |
@GetMapping("/info/{id}") |
L |
49 |
public CommonResult<HttpApiEntity> info(@PathVariable("id") String id){ |
|
50 |
HttpApiEntity info= httpApiService.info(id); |
|
51 |
return success(info); |
|
52 |
} |
7c3e09
|
53 |
|
潘 |
54 |
@PreAuthorize("@ss.hasPermission('data:channel-http:create')") |
|
55 |
@PostMapping("/create") |
|
56 |
public CommonResult<Boolean> create(@RequestBody HttpApiEntity httpApiEntity){ |
336bd2
|
57 |
httpApiEntity.setId(UUID.randomUUID().toString()); |
潘 |
58 |
httpApiEntity.setCreateTime(new Date()); |
c7f709
|
59 |
httpApiService.add(httpApiEntity); |
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 HttpApiEntity httpApiEntity) { |
|
66 |
httpApiService.update(httpApiEntity); |
336bd2
|
67 |
httpApiEntity.setUpdateTime(new Date()); |
c7f709
|
68 |
return success(true); |
L |
69 |
} |
|
70 |
|
7c3e09
|
71 |
@PreAuthorize("@ss.hasPermission('data:channel-http:delete')") |
c7f709
|
72 |
@DeleteMapping("/delete") |
L |
73 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
|
74 |
httpApiService.delete(id); |
|
75 |
return success(true); |
|
76 |
} |
|
77 |
} |