提交 | 用户 | 时间
|
e7c126
|
1 |
package com.iailab.module.system.controller.admin.oauth2; |
H |
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.system.controller.admin.oauth2.vo.client.OAuth2ClientPageReqVO; |
|
7 |
import com.iailab.module.system.controller.admin.oauth2.vo.client.OAuth2ClientRespVO; |
|
8 |
import com.iailab.module.system.controller.admin.oauth2.vo.client.OAuth2ClientSaveReqVO; |
|
9 |
import com.iailab.module.system.dal.dataobject.oauth2.OAuth2ClientDO; |
|
10 |
import com.iailab.module.system.service.oauth2.OAuth2ClientService; |
|
11 |
import io.swagger.v3.oas.annotations.Operation; |
|
12 |
import io.swagger.v3.oas.annotations.Parameter; |
|
13 |
import io.swagger.v3.oas.annotations.tags.Tag; |
|
14 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
15 |
import org.springframework.validation.annotation.Validated; |
|
16 |
import org.springframework.web.bind.annotation.*; |
|
17 |
|
|
18 |
import javax.annotation.Resource; |
|
19 |
import javax.validation.Valid; |
|
20 |
|
|
21 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
22 |
|
|
23 |
@Tag(name = "管理后台 - OAuth2 客户端") |
|
24 |
@RestController |
|
25 |
@RequestMapping("/system/oauth2-client") |
|
26 |
@Validated |
|
27 |
public class OAuth2ClientController { |
|
28 |
|
|
29 |
@Resource |
|
30 |
private OAuth2ClientService oAuth2ClientService; |
|
31 |
|
|
32 |
@PostMapping("/create") |
|
33 |
@Operation(summary = "创建 OAuth2 客户端") |
|
34 |
@PreAuthorize("@ss.hasPermission('system:oauth2-client:create')") |
|
35 |
public CommonResult<Long> createOAuth2Client(@Valid @RequestBody OAuth2ClientSaveReqVO createReqVO) { |
|
36 |
return success(oAuth2ClientService.createOAuth2Client(createReqVO)); |
|
37 |
} |
|
38 |
|
|
39 |
@PutMapping("/update") |
|
40 |
@Operation(summary = "更新 OAuth2 客户端") |
|
41 |
@PreAuthorize("@ss.hasPermission('system:oauth2-client:update')") |
|
42 |
public CommonResult<Boolean> updateOAuth2Client(@Valid @RequestBody OAuth2ClientSaveReqVO updateReqVO) { |
|
43 |
oAuth2ClientService.updateOAuth2Client(updateReqVO); |
|
44 |
return success(true); |
|
45 |
} |
|
46 |
|
|
47 |
@DeleteMapping("/delete") |
|
48 |
@Operation(summary = "删除 OAuth2 客户端") |
|
49 |
@Parameter(name = "id", description = "编号", required = true) |
|
50 |
@PreAuthorize("@ss.hasPermission('system:oauth2-client:delete')") |
|
51 |
public CommonResult<Boolean> deleteOAuth2Client(@RequestParam("id") Long id) { |
|
52 |
oAuth2ClientService.deleteOAuth2Client(id); |
|
53 |
return success(true); |
|
54 |
} |
|
55 |
|
|
56 |
@GetMapping("/get") |
|
57 |
@Operation(summary = "获得 OAuth2 客户端") |
|
58 |
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|
59 |
@PreAuthorize("@ss.hasPermission('system:oauth2-client:query')") |
|
60 |
public CommonResult<OAuth2ClientRespVO> getOAuth2Client(@RequestParam("id") Long id) { |
|
61 |
OAuth2ClientDO client = oAuth2ClientService.getOAuth2Client(id); |
|
62 |
return success(BeanUtils.toBean(client, OAuth2ClientRespVO.class)); |
|
63 |
} |
|
64 |
|
|
65 |
@GetMapping("/page") |
|
66 |
@Operation(summary = "获得 OAuth2 客户端分页") |
|
67 |
@PreAuthorize("@ss.hasPermission('system:oauth2-client:query')") |
|
68 |
public CommonResult<PageResult<OAuth2ClientRespVO>> getOAuth2ClientPage(@Valid OAuth2ClientPageReqVO pageVO) { |
|
69 |
PageResult<OAuth2ClientDO> pageResult = oAuth2ClientService.getOAuth2ClientPage(pageVO); |
|
70 |
return success(BeanUtils.toBean(pageResult, OAuth2ClientRespVO.class)); |
|
71 |
} |
|
72 |
|
|
73 |
} |