潘志宝
2024-12-13 6b13839488edcd06046e26a41fe897358176689c
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.bpm.controller.admin.definition;
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.bpm.controller.admin.definition.vo.listener.BpmProcessListenerPageReqVO;
7 import com.iailab.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerRespVO;
8 import com.iailab.module.bpm.controller.admin.definition.vo.listener.BpmProcessListenerSaveReqVO;
9 import com.iailab.module.bpm.dal.dataobject.definition.BpmProcessListenerDO;
10 import com.iailab.module.bpm.service.definition.BpmProcessListenerService;
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 = "管理后台 - BPM 流程监听器")
24 @RestController
25 @RequestMapping("/bpm/process-listener")
26 @Validated
27 public class BpmProcessListenerController {
28
29     @Resource
30     private BpmProcessListenerService processListenerService;
31
32     @PostMapping("/create")
33     @Operation(summary = "创建流程监听器")
34     @PreAuthorize("@ss.hasPermission('bpm:process-listener:create')")
35     public CommonResult<Long> createProcessListener(@Valid @RequestBody BpmProcessListenerSaveReqVO createReqVO) {
36         return success(processListenerService.createProcessListener(createReqVO));
37     }
38
39     @PutMapping("/update")
40     @Operation(summary = "更新流程监听器")
41     @PreAuthorize("@ss.hasPermission('bpm:process-listener:update')")
42     public CommonResult<Boolean> updateProcessListener(@Valid @RequestBody BpmProcessListenerSaveReqVO updateReqVO) {
43         processListenerService.updateProcessListener(updateReqVO);
44         return success(true);
45     }
46
47     @DeleteMapping("/delete")
48     @Operation(summary = "删除流程监听器")
49     @Parameter(name = "id", description = "编号", required = true)
50     @PreAuthorize("@ss.hasPermission('bpm:process-listener:delete')")
51     public CommonResult<Boolean> deleteProcessListener(@RequestParam("id") Long id) {
52         processListenerService.deleteProcessListener(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('bpm:process-listener:query')")
60     public CommonResult<BpmProcessListenerRespVO> getProcessListener(@RequestParam("id") Long id) {
61         BpmProcessListenerDO processListener = processListenerService.getProcessListener(id);
62         return success(BeanUtils.toBean(processListener, BpmProcessListenerRespVO.class));
63     }
64
65     @GetMapping("/page")
66     @Operation(summary = "获得流程监听器分页")
67     @PreAuthorize("@ss.hasPermission('bpm:process-listener:query')")
68     public CommonResult<PageResult<BpmProcessListenerRespVO>> getProcessListenerPage(
69             @Valid BpmProcessListenerPageReqVO pageReqVO) {
70         PageResult<BpmProcessListenerDO> pageResult = processListenerService.getProcessListenerPage(pageReqVO);
71         return success(BeanUtils.toBean(pageResult, BpmProcessListenerRespVO.class));
72     }
73
74 }