!11 通过businessId查询tasktask中间表数据

Merge pull request !11 from new_new_new/feature/query_by_bussinessId
This commit is contained in:
new_new_new
2026-04-22 03:00:18 +00:00
committed by Gitee
3 changed files with 27 additions and 0 deletions
@@ -10,8 +10,10 @@ import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import liquibase.pro.packaged.E;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.flowable.task.api.Task;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.query.QueryRuleEnum;
@@ -37,6 +39,7 @@ import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@@ -192,6 +195,17 @@ public class TaskTaskController extends JeecgController<TaskTask, ITaskTaskServi
return Result.OK(taskTask);
}
//@AutoLog(value = "事项任务计划表(发起流程)-通过id查询")
@Operation(summary = "事项任务计划表(发起流程)-通过businessId查询")
@GetMapping(value = "/queryByBusinessId")
public Result<List<TaskTask>> queryByBusinessId(@RequestParam(name = "businessId", required = true) String businessId) throws Exception {
List<TaskTask> taskTaskList = taskTaskService.getTaskTaskListByBusinessId(businessId);
if (CollectionUtils.isEmpty(taskTaskList)) {
return Result.error("未找到对应数据");
}
return Result.OK(taskTaskList);
}
/**
* 导出excel
*
@@ -4,6 +4,8 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.tasktask.entity.TaskTask;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* @Description: 事项任务计划表(发起流程)
* @Author: jeecg-boot
@@ -14,4 +16,5 @@ public interface ITaskTaskService extends IService<TaskTask> {
boolean singleFlowStart(TaskTask taskTask,String userName) throws Exception;
boolean multiFlowStart(TaskTask taskTask,String userName,Integer intervalType, Integer startCount) throws Exception;
Result<?> handleFlowStart(TaskTask taskTask, String username, Integer intervalType, Integer startCount)throws Exception;
List<TaskTask> getTaskTaskListByBusinessId(String businessId) throws Exception;
}
@@ -1,6 +1,7 @@
package org.jeecg.modules.tasktask.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.util.Assert;
import org.jeecg.common.api.vo.Result;
@@ -121,4 +122,13 @@ public class TaskTaskServiceImpl extends ServiceImpl<TaskTaskMapper, TaskTask> i
return Result.ok();
}
public List<TaskTask> getTaskTaskListByBusinessId(String businessId) throws Exception{
if (StringUtils.isBlank(businessId)) {
return Collections.emptyList();
}
LambdaQueryWrapper<TaskTask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TaskTask::getBusinessId, businessId);
// 2. 查询不到数据 → MP 本身会返回空集合,不是 null
return this.list(queryWrapper);
}
}