mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-13 14:57:16 +08:00
refactor: 优化删除过期历史密码 SQL
This commit is contained in:
@@ -2,15 +2,14 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="top.continew.admin.system.mapper.UserPasswordHistoryMapper">
|
<mapper namespace="top.continew.admin.system.mapper.UserPasswordHistoryMapper">
|
||||||
<delete id="deleteExpired">
|
<delete id="deleteExpired">
|
||||||
DELETE FROM sys_user_password_history
|
DELETE t1 FROM sys_user_password_history t1
|
||||||
WHERE id NOT IN (
|
LEFT JOIN (
|
||||||
SELECT * FROM (
|
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM sys_user_password_history
|
FROM sys_user_password_history
|
||||||
WHERE user_id = #{userId}
|
WHERE user_id = #{userId}
|
||||||
ORDER BY create_time DESC
|
ORDER BY create_time DESC
|
||||||
LIMIT #{count}
|
LIMIT #{count}
|
||||||
) t1
|
) t2 ON t2.id = t1.id
|
||||||
)
|
WHERE t2.id IS NULL
|
||||||
</delete>
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
Reference in New Issue
Block a user