dengzedong
2024-12-24 aa0382e44311f9f7e62a688c8fcaa9c69a512e0f
提交 | 用户 | 时间
e7c126 1 package com.iailab.module.bpm.controller.admin.oa;
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.oa.vo.BpmOALeaveCreateReqVO;
7 import com.iailab.module.bpm.controller.admin.oa.vo.BpmOALeavePageReqVO;
8 import com.iailab.module.bpm.controller.admin.oa.vo.BpmOALeaveRespVO;
9 import com.iailab.module.bpm.dal.dataobject.oa.BpmOALeaveDO;
10 import com.iailab.module.bpm.service.oa.BpmOALeaveService;
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 import static com.iailab.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
23
24 /**
25  * OA 请假申请 Controller,用于演示自己存储数据,接入工作流的例子
26  *
27  * @author jason
28  * @author iailab
29  */
30 @Tag(name = "管理后台 - OA 请假申请")
31 @RestController
32 @RequestMapping("/bpm/oa/leave")
33 @Validated
34 public class BpmOALeaveController {
35
36     @Resource
37     private BpmOALeaveService leaveService;
38
39     @PostMapping("/create")
40     @PreAuthorize("@ss.hasPermission('bpm:oa-leave:create')")
41     @Operation(summary = "创建请求申请")
42     public CommonResult<Long> createLeave(@Valid @RequestBody BpmOALeaveCreateReqVO createReqVO) {
43         return success(leaveService.createLeave(getLoginUserId(), createReqVO));
44     }
45
46     @GetMapping("/get")
47     @PreAuthorize("@ss.hasPermission('bpm:oa-leave:query')")
48     @Operation(summary = "获得请假申请")
49     @Parameter(name = "id", description = "编号", required = true, example = "1024")
50     public CommonResult<BpmOALeaveRespVO> getLeave(@RequestParam("id") Long id) {
51         BpmOALeaveDO leave = leaveService.getLeave(id);
52         return success(BeanUtils.toBean(leave, BpmOALeaveRespVO.class));
53     }
54
55     @GetMapping("/page")
56     @PreAuthorize("@ss.hasPermission('bpm:oa-leave:query')")
57     @Operation(summary = "获得请假申请分页")
58     public CommonResult<PageResult<BpmOALeaveRespVO>> getLeavePage(@Valid BpmOALeavePageReqVO pageVO) {
59         PageResult<BpmOALeaveDO> pageResult = leaveService.getLeavePage(getLoginUserId(), pageVO);
60         return success(BeanUtils.toBean(pageResult, BpmOALeaveRespVO.class));
61     }
62
63 }