# `sp_get_unTodo` (procedure)

> 待办事项


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sLoginId` | `varchar(50)` |
| 2 | IN | `sBrId` | `varchar(50)` |
| 3 | IN | `sSuId` | `varchar(50)` |
| 4 | IN | `isHandle` | `int` |
| 5 | IN | `bFilter` | `longtext` |
| 6 | IN | `pageNum` | `int` |
| 7 | IN | `pageSize` | `int` |
| 8 | OUT | `totalCount` | `int` |
| 9 | IN | `countCloumn` | `longtext` |
| 10 | OUT | `countMapJson` | `longtext` |
| 11 | IN | `sFilterOrderBy` | `longtext` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `sp_get_unTodo`'`._

## Narrative

**Business context:** 待办事项 (To-do list) — drives the in-app to-do widget that lists workflow tasks waiting on the current user. Reads from `biz_todo_item`, the table the workflow engine writes when a `biz_flow` instance routes to a user. Standard report-pagination signature (`pageNum/pageSize/totalCount`).

**What it does:** Defaults `isHandle=0` (untouched/未处理). Uses `sLoginId` directly as `p_sLoginName` (the legacy `Fun_GetLoginUserName` call is commented out). Builds dynamic SQL `SELECT id AS sId, item_name AS sTeamName, item_content AS sContent, node_name AS sNodeName, IF(is_handle=0,'未处理','已处理') sHandleName, is_handle AS isHandle, handle_time AS tHandleTime, handle_user_id AS sHandleUserId, todo_user_id AS sTodoUserId, todo_time AS todoTime, task_id AS sTaskId, instance_id AS sInstanceId FROM biz_todo_item WHERE todo_user_id = p_sLoginName AND is_handle = isHandle ORDER BY is_view ASC, todo_time DESC LIMIT (pageNum-1)*pageSize, pageSize`. Runs a parallel COUNT(1) into `@totalCount`. Then `UPDATE biz_todo_item SET is_view = 1 WHERE todo_user_id = sLoginId AND is_view = 0` — i.e., clears unread flags on open.

**Invocation:** Status: appears orphaned via static scan. No `gdsmodule` hook, no `gdsconfigformmaster` reference, no other proc CALLs it, no xly-src grep hit. The proc is almost certainly bound dynamically by the front-end Todo widget through a non-`gdsconfigformmaster` registration path (the to-do panel UI predates the `gdsconfigformmaster` framework). Sibling `sp_get_unTodo_history` does call this proc.
