diff --git a/continew-admin-system/src/main/resources/mapper/UserPasswordHistoryMapper.xml b/continew-admin-system/src/main/resources/mapper/UserPasswordHistoryMapper.xml index 0ee5e385..283b6d11 100644 --- a/continew-admin-system/src/main/resources/mapper/UserPasswordHistoryMapper.xml +++ b/continew-admin-system/src/main/resources/mapper/UserPasswordHistoryMapper.xml @@ -2,15 +2,14 @@ - DELETE FROM sys_user_password_history - WHERE id NOT IN ( - SELECT * FROM ( - SELECT id - FROM sys_user_password_history - WHERE user_id = #{userId} - ORDER BY create_time DESC - LIMIT #{count} - ) t1 - ) + DELETE t1 FROM sys_user_password_history t1 + LEFT JOIN ( + SELECT id + FROM sys_user_password_history + WHERE user_id = #{userId} + ORDER BY create_time DESC + LIMIT #{count} + ) t2 ON t2.id = t1.id + WHERE t2.id IS NULL \ No newline at end of file