当前使用版本(必填,否则不予处理)

3.4.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

多线程使用同一个wrapper查询,可能获取不到参数

重现步骤(如果有就写完整)

LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper().apply(StrUtil.isNotBlank(processId), "oper.process_id = {0}", processId) .apply(StrUtil.isNotBlank(nodeId), "oper.node_id = {0}", nodeId) .apply(StrUtil.isNotBlank(categoryId), "oper.category_id = {0}", categoryId) .apply("oper.tenant_id = {0}", UserSessionUtils.getRealm());

    Future<Integer> todayMustInprocessCountFuture = completionService.submit(() -> taskNodeOperationMapper.countByTodayMustInprocess(queryWrapper));
    Future<Integer> todayNewCountFuture = completionService.submit(() -> taskNodeOperationMapper.countNewByToday(queryWrapper));
    Future<Integer> todayMustCountFuture = completionService.submit(() -> taskNodeOperationMapper.countByTodayMustTotal(queryWrapper));
    Future<Integer> futureInprocessCountFuture = completionService.submit(() -> taskNodeOperationMapper.countByFutureInprocess(queryWrapper));
    Future<Integer> futureCountFuture = completionService.submit(() -> taskNodeOperationMapper.countByFutureTotal(queryWrapper));
    todayMustStatisticBO.setTotal(todayMustCountFuture.get());
    todayMustStatisticBO.setLeft(todayMustInprocessCountFuture.get());
    todayMustStatisticBO.setTodayAdd(todayNewCountFuture.get());

    futureStatisticBO.setTotal(futureCountFuture.get());
    futureStatisticBO.setLeft(futureInprocessCountFuture.get());
    futureStatisticBO.setTodayAdd(todayNewCountFuture.get());

报错信息

没有报错,但是有些查询通过${ew.customSqlSegment}拿不到参数: ==> Preparing: select count(0) from task_instance base inner join task_node_operation oper on base.id = oper.task_instance_id and base.sla_end_time is not null and base.sla_end_time <= date_format(NOW(),'%Y-%m-%d 24:00:00') and (oper.date_end is null or oper.date_end > date_format(NOW(),'%Y-%m-%d 00:00:00')) ==> Preparing: select count(0) from task_instance base inner join task_node_operation oper on base.id = oper.task_instance_id WHERE (oper.process_id = ? AND oper.node_id = ? AND oper.tenant_id = ?) and (base.sla_end_time is not null and base.sla_end_time > date_format(NOW(),'%Y-%m-%d 24:00:00')) and (oper.date_end is null or oper.date_end > date_format(NOW(),'%Y-%m-%d 00:00:00')) ==> Preparing: select count(0) from task_instance base inner join task_node_operation oper on base.id = oper.task_instance_id and base.sla_end_time is not null and base.sla_end_time <= date_format(NOW(),'%Y-%m-%d 24:00:00') and oper.status in (0,1,2,3) and (oper.date_end is null or oper.date_end > date_format(NOW(),'%Y-%m-%d 00:00:00')) ==> Preparing: select count(0) from task_instance base inner join task_node_operation oper on base.id = oper.task_instance_id and (base.sla_end_time is not null and base.sla_end_time > date_format(NOW(),'%Y-%m-%d 24:00:00')) and oper.status in (0,1,2,3) and (oper.date_end is null or oper.date_end > date_format(NOW(),'%Y-%m-%d 00:00:00')) ==> Preparing: select count(0) from task_instance base inner join task_node_operation oper on base.id = oper.task_instance_id and oper.date_create >= date_format(NOW(),'%Y-%m-%d 00:00:00') and oper.date_create < date_format(NOW(),'%Y-%m-%d 24:00:00') ==> Parameters: ==> Parameters: ==> Parameters: ==> Parameters: ==> Parameters: 526399838904909824(String), 526403514797129728(String), brs(String) <== Columns: count(0) <== Row: 7 <== Total: 1 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5b4c30dc] <== Columns: count(0) <== Row: 1 <== Total: 1 Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@527395c4] <== Columns: count(0) <== Columns: count(0) <== Columns: count(0) <== Row: 135210 <== Row: 71010 <== Row: 62302 <== Total: 1 <== Total: 1 <== Total: 1

Comment From: miemieYaho

不建议多线程使用