feat: 添加模糊查询链接编号的方法以协助调试,优化用户链接状态查询逻辑,确保线程安全并避免重复数据库查询

This commit is contained in:
yahaozhang
2025-10-10 21:34:16 +08:00
parent 96e95cbb90
commit 2056ad71b5
3 changed files with 198 additions and 44 deletions

View File

@@ -278,6 +278,15 @@
WHERE status = #{status}
ORDER BY created_at ASC
</select>
<!-- 调试用:模糊查询链接编号 -->
<select id="findByCodeNoLike" resultMap="LinkTaskMap">
SELECT id, batch_id, agent_id, code_no, token_hash, expire_at, status, region, machine_id, login_at, refund_at, revoked_at, created_at, updated_at, need_refresh, refresh_time, qr_created_at, qr_expire_at, first_region_select_at, completed_points, completion_images, reason
FROM link_task
WHERE UPPER(code_no) LIKE UPPER(CONCAT('%', #{codeNo}, '%'))
ORDER BY created_at DESC
LIMIT 10
</select>
<!-- 原子占用设备,避免并发下同一设备被多个链接占用 -->
<update id="reserveDeviceIfFree">