mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2026-01-11 01:36:03 +08:00
update 优化删除业务ID的方法,支持字符串类型的业务ID
This commit is contained in:
@@ -20,7 +20,7 @@ public interface WorkflowService {
|
|||||||
* @param businessIds 业务id
|
* @param businessIds 业务id
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
boolean deleteInstance(List<Long> businessIds);
|
boolean deleteInstance(List<String> businessIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前流程状态
|
* 获取当前流程状态
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package org.dromara.workflow.controller;
|
package org.dromara.workflow.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.core.utils.StreamUtils;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
import org.dromara.common.log.annotation.Log;
|
import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
@@ -76,7 +78,7 @@ public class FlwInstanceController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@DeleteMapping("/deleteByBusinessIds/{businessIds}")
|
@DeleteMapping("/deleteByBusinessIds/{businessIds}")
|
||||||
public R<Void> deleteByBusinessIds(@PathVariable List<Long> businessIds) {
|
public R<Void> deleteByBusinessIds(@PathVariable List<Long> businessIds) {
|
||||||
return toAjax(flwInstanceService.deleteByBusinessIds(businessIds));
|
return toAjax(flwInstanceService.deleteByBusinessIds(StreamUtils.toList(businessIds, Convert::toStr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public interface IFlwInstanceService {
|
|||||||
* @param businessIds 业务id
|
* @param businessIds 业务id
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
boolean deleteByBusinessIds(List<Long> businessIds);
|
boolean deleteByBusinessIds(List<String> businessIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按照实例id删除流程实例
|
* 按照实例id删除流程实例
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean deleteByBusinessIds(List<Long> businessIds) {
|
public boolean deleteByBusinessIds(List<String> businessIds) {
|
||||||
List<FlowInstance> flowInstances = flowInstanceMapper.selectList(new LambdaQueryWrapper<FlowInstance>().in(FlowInstance::getBusinessId, StreamUtils.toList(businessIds, Convert::toStr)));
|
List<FlowInstance> flowInstances = flowInstanceMapper.selectList(new LambdaQueryWrapper<FlowInstance>().in(FlowInstance::getBusinessId, businessIds));
|
||||||
if (CollUtil.isEmpty(flowInstances)) {
|
if (CollUtil.isEmpty(flowInstances)) {
|
||||||
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
log.warn("未找到对应的流程实例信息,无法执行删除操作。");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import org.dromara.common.core.enums.BusinessStatusEnum;
|
|||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.service.WorkflowService;
|
import org.dromara.common.core.service.WorkflowService;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
|
import org.dromara.common.core.utils.StreamUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
@@ -167,7 +168,7 @@ public class TestLeaveServiceImpl implements ITestLeaveService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean deleteWithValidByIds(List<Long> ids) {
|
public Boolean deleteWithValidByIds(List<Long> ids) {
|
||||||
workflowService.deleteInstance(ids);
|
workflowService.deleteInstance(StreamUtils.toList(ids, Convert::toStr));
|
||||||
return baseMapper.deleteByIds(ids) > 0;
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class WorkflowServiceImpl implements WorkflowService {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteInstance(List<Long> businessIds) {
|
public boolean deleteInstance(List<String> businessIds) {
|
||||||
return flwInstanceService.deleteByBusinessIds(businessIds);
|
return flwInstanceService.deleteByBusinessIds(businessIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user