12 private const STEP_ROWS_LIMIT = 100;
17 $lastId = (int)($option[
'lastId'] ?? 0);
18 $limit = self::STEP_ROWS_LIMIT;
22 $idCondition = $lastId > 0 ?
" AND tu.ID < {$lastId} " :
'';
23 $queryRows = $connection->query(
25 select tu.ID from b_bp_task_user tu
26 where tu.USER_ID = {$userId} {$idCondition} order by tu.ID DESC LIMIT {$limit}
30 $ids = array_column($queryRows,
'ID');
37 $option[
'lastId'] = end($ids);
38 $idsSql = implode(
',', $ids);
42 INSERT INTO b_bp_workflow_user
43 (USER_ID, WORKFLOW_ID, IS_AUTHOR, WORKFLOW_STATUS, TASK_STATUS, MODIFIED)
45 select tu.USER_ID, t.WORKFLOW_ID, 0,
case when wi.id is
null then 1
else 0 end,
46 case when tu.STATUS =
'0' then 2
else 1 end,
47 case when tu.DATE_UPDATE is
null then now()
else tu.DATE_UPDATE end
48 from b_bp_task_user tu
49 inner join b_bp_task t on (t.ID = tu.TASK_ID)
50 left join b_bp_workflow_instance wi on (t.WORKFLOW_ID = wi.ID)
51 where tu.ID IN ({$idsSql})
53 ON DUPLICATE KEY UPDATE WORKFLOW_STATUS = VALUES(WORKFLOW_STATUS), TASK_STATUS = VALUES(TASK_STATUS), MODIFIED = VALUES(MODIFIED)
60 public static function bindUser(
int $userId): void
62 static::bind(0, [$userId]);
static getConnection($name="")