|
|
@@ -0,0 +1,94 @@
|
|
|
+package cn.iocoder.yudao.server.controller.admin;
|
|
|
+
|
|
|
+import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
+import cn.iocoder.yudao.server.controller.admin.vo.FlowGroupPageReqVO;
|
|
|
+import cn.iocoder.yudao.server.controller.admin.vo.FlowGroupRespVO;
|
|
|
+import cn.iocoder.yudao.server.controller.admin.vo.FlowGroupSaveReqVO;
|
|
|
+import cn.iocoder.yudao.server.dal.dataobject.FlowGroupDO;
|
|
|
+import cn.iocoder.yudao.server.service.FlowGroupService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 门户流程分组信息")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/portal/flow-group")
|
|
|
+@Validated
|
|
|
+public class FlowGroupController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private FlowGroupService flowGroupService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建门户流程分组信息")
|
|
|
+ @PreAuthorize("@ss.hasPermission('portal:flow-group:create')")
|
|
|
+ public CommonResult<Long> createFlowGroup(@Valid @RequestBody FlowGroupSaveReqVO createReqVO) {
|
|
|
+ return success(flowGroupService.createFlowGroup(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新门户流程分组信息")
|
|
|
+ @PreAuthorize("@ss.hasPermission('portal:flow-group:update')")
|
|
|
+ public CommonResult<Boolean> updateFlowGroup(@Valid @RequestBody FlowGroupSaveReqVO updateReqVO) {
|
|
|
+ flowGroupService.updateFlowGroup(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除门户流程分组信息")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('portal:flow-group:delete')")
|
|
|
+ public CommonResult<Boolean> deleteFlowGroup(@RequestParam("id") Long id) {
|
|
|
+ flowGroupService.deleteFlowGroup(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得门户流程分组信息")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('portal:flow-group:query')")
|
|
|
+ public CommonResult<FlowGroupRespVO> getFlowGroup(@RequestParam("id") Long id) {
|
|
|
+ FlowGroupDO flowGroup = flowGroupService.getFlowGroup(id);
|
|
|
+ return success(BeanUtils.toBean(flowGroup, FlowGroupRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得门户流程分组信息分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('portal:flow-group:query')")
|
|
|
+ public CommonResult<PageResult<FlowGroupRespVO>> getFlowGroupPage(@Valid FlowGroupPageReqVO pageReqVO) {
|
|
|
+ PageResult<FlowGroupDO> pageResult = flowGroupService.getFlowGroupPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, FlowGroupRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出门户流程分组信息 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('portal:flow-group:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportFlowGroupExcel(@Valid FlowGroupPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<FlowGroupDO> list = flowGroupService.getFlowGroupPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "门户流程分组信息.xls", "数据", FlowGroupRespVO.class,
|
|
|
+ BeanUtils.toBean(list, FlowGroupRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|