优化前
SELECT
user_id,
user_name,
real_name,
PASSWORD,
real_org_id,
real_org_name,
real_dept_id,
real_dept_name,
STATUS
FROM
sys_user
WHERE
is_del = 0
AND find_in_set( 'lilong', login_user_account )
优化后
SELECT
user_id,
user_name,
real_name,
PASSWORD,
real_org_id,
real_org_name,
real_dept_id,
real_dept_name,
STATUS
FROM
sys_user
WHERE
user_id =(
SELECT
user_id
FROM
sys_user
WHERE
is_del = 0
AND FIND_IN_SET( 'lilong', login_user_account )
LIMIT 0,1
)
优化后,将查询改为子查询速度快了不少(数据量越大,效果越明显)