dengzedong
2024-12-24 76743b009ca5ea67557fcab597b332f8d1947813
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.system.controller.admin.socail;
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.socail.vo.client.SocialClientPageReqVO;
7 import com.iailab.module.system.controller.admin.socail.vo.client.SocialClientRespVO;
8 import com.iailab.module.system.controller.admin.socail.vo.client.SocialClientSaveReqVO;
9 import com.iailab.module.system.dal.dataobject.social.SocialClientDO;
10 import com.iailab.module.system.service.social.SocialClientService;
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 = "管理后台 - 社交客户端")
24 @RestController
25 @RequestMapping("/system/social-client")
26 @Validated
27 public class SocialClientController {
28
29     @Resource
30     private SocialClientService socialClientService;
31
32     @PostMapping("/create")
33     @Operation(summary = "创建社交客户端")
34     @PreAuthorize("@ss.hasPermission('system:social-client:create')")
35     public CommonResult<Long> createSocialClient(@Valid @RequestBody SocialClientSaveReqVO createReqVO) {
36         return success(socialClientService.createSocialClient(createReqVO));
37     }
38
39     @PutMapping("/update")
40     @Operation(summary = "更新社交客户端")
41     @PreAuthorize("@ss.hasPermission('system:social-client:update')")
42     public CommonResult<Boolean> updateSocialClient(@Valid @RequestBody SocialClientSaveReqVO updateReqVO) {
43         socialClientService.updateSocialClient(updateReqVO);
44         return success(true);
45     }
46
47     @DeleteMapping("/delete")
48     @Operation(summary = "删除社交客户端")
49     @Parameter(name = "id", description = "编号", required = true)
50     @PreAuthorize("@ss.hasPermission('system:social-client:delete')")
51     public CommonResult<Boolean> deleteSocialClient(@RequestParam("id") Long id) {
52         socialClientService.deleteSocialClient(id);
53         return success(true);
54     }
55
56     @GetMapping("/get")
57     @Operation(summary = "获得社交客户端")
58     @Parameter(name = "id", description = "编号", required = true, example = "1024")
59     @PreAuthorize("@ss.hasPermission('system:social-client:query')")
60     public CommonResult<SocialClientRespVO> getSocialClient(@RequestParam("id") Long id) {
61         SocialClientDO client = socialClientService.getSocialClient(id);
62         return success(BeanUtils.toBean(client, SocialClientRespVO.class));
63     }
64
65     @GetMapping("/page")
66     @Operation(summary = "获得社交客户端分页")
67     @PreAuthorize("@ss.hasPermission('system:social-client:query')")
68     public CommonResult<PageResult<SocialClientRespVO>> getSocialClientPage(@Valid SocialClientPageReqVO pageVO) {
69         PageResult<SocialClientDO> pageResult = socialClientService.getSocialClientPage(pageVO);
70         return success(BeanUtils.toBean(pageResult, SocialClientRespVO.class));
71     }
72
73 }