/* * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * Neither the name of the dreamlu.net developer nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * Author: Chill 庄骞 (smallchill@163.com) */ package com.blade.check.controller; import com.alibaba.cloud.commons.lang.StringUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.blade.check.entity.AuditPathsLevels; import com.blade.check.service.IAuditPathsLevelsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import lombok.AllArgsConstructor; import javax.validation.Valid; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.metadata.IPage; import com.blade.check.entity.AuditPaths; import com.blade.check.vo.AuditPathsVO; import com.blade.check.service.IAuditPathsService; import org.springblade.core.boot.ctrl.BladeController; import java.util.List; /** * 审批流配置主表 控制器 * * @author BladeX * @since 2021-12-07 */ @RestController @AllArgsConstructor @RequestMapping("/auditpaths") @Api(value = "审批流配置主表", tags = "审批流配置主表接口") public class AuditPathsController extends BladeController { private final IAuditPathsService auditPathsService; private final IAuditPathsLevelsService auditPathsLevelsService; /** * 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情-审批流配置主表", notes = "传入auditPaths") public R detail(AuditPaths auditPaths) { AuditPaths detail = auditPathsService.getOne(Condition.getQueryWrapper(auditPaths)); List pathsLevelsList = auditPathsLevelsService.list(new LambdaQueryWrapper().eq(AuditPathsLevels::getPathId, detail.getId())); detail.setAuditPathsLevels(pathsLevelsList); return R.data(detail); } /** * 列表-审批流配置主表 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "列表-审批流配置主表", notes = "传入auditPaths") public R> list(AuditPaths auditPaths, Query query) { LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); lambdaQueryWrapper.like(StringUtils.isNotBlank(auditPaths.getPathName()),AuditPaths::getPathName,auditPaths.getPathName()) .orderByDesc(AuditPaths::getOpDate); IPage pages = auditPathsService.page(Condition.getPage(query),lambdaQueryWrapper); return R.data(pages); } /** * 新增或编辑审批流配置 * */ @PostMapping("/modify") @ApiOperationSupport(order = 3) @ApiOperation(value = "新增或编辑审批流配置", notes = "传入auditPaths") public R modify(@Valid @RequestBody AuditPaths auditPaths) { return R.data(auditPathsService.modify(auditPaths)); } /** * 删除 审批流配置主表 */ @PostMapping("/remove") @ApiOperationSupport(order = 4) @ApiOperation(value = "删除-审批流配置主表", notes = "传入ids") public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { return R.status(auditPathsService.removeByIds(Func.toLongList(ids))); } }