mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-23 07:31:51 +08:00
增强待办路由安全和查询索引
This commit is contained in:
20
docs/sql/sys_todo_performance_index.sql
Normal file
20
docs/sql/sys_todo_performance_index.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
-- 待办首页列表排序索引(用于已存在的 sys_todo_task 表)
|
||||
-- MySQL 5.7 兼容的幂等写法。
|
||||
|
||||
SET @todoIndexExists := (
|
||||
SELECT count(1)
|
||||
FROM information_schema.statistics
|
||||
WHERE table_schema = database()
|
||||
AND table_name = 'sys_todo_task'
|
||||
AND index_name = 'idx_todo_user_active_sort'
|
||||
);
|
||||
|
||||
SET @todoIndexSql := IF(
|
||||
@todoIndexExists = 0,
|
||||
'ALTER TABLE sys_todo_task ADD INDEX idx_todo_user_active_sort (assignee_user_id, del_flag, task_status, priority, create_time, todo_id)',
|
||||
'SELECT ''idx_todo_user_active_sort already exists'''
|
||||
);
|
||||
|
||||
PREPARE todoIndexStatement FROM @todoIndexSql;
|
||||
EXECUTE todoIndexStatement;
|
||||
DEALLOCATE PREPARE todoIndexStatement;
|
||||
@@ -33,6 +33,7 @@ CREATE TABLE `sys_todo_task` (
|
||||
PRIMARY KEY (`todo_id`) USING BTREE,
|
||||
UNIQUE KEY `uk_todo_active_idempotent` (`active_idempotent_key`) USING BTREE,
|
||||
KEY `idx_todo_user_status` (`assignee_user_id`, `task_status`, `read_status`, `priority`, `create_time`) USING BTREE,
|
||||
KEY `idx_todo_user_active_sort` (`assignee_user_id`, `del_flag`, `task_status`, `priority`, `create_time`, `todo_id`) USING BTREE,
|
||||
KEY `idx_todo_merchant_status` (`assignee_merchant_id`, `task_status`, `create_time`) USING BTREE,
|
||||
KEY `idx_todo_business` (`business_type`, `business_id`) USING BTREE,
|
||||
KEY `idx_todo_history_cleanup` (`del_flag`, `task_status`, `completed_time`) USING BTREE
|
||||
|
||||
Reference in New Issue
Block a user