feat: 新增按状态批量删除链接功能

主要修改:
1. 在LinkController中新增按状态批量删除链接的接口,允许用户根据指定状态批量删除自己创建的链接。
2. 在LinkStatusService中实现批量删除逻辑,确保用户只能删除自己的链接,并进行状态验证。
3. 更新LinkTaskMapper和对应的XML文件,增加查询和删除链接任务的相关方法。

技术细节:
- 通过新增的批量删除功能,提升了用户对链接的管理能力,确保操作的安全性和有效性,同时优化了数据库操作的灵活性。
This commit is contained in:
zyh
2025-08-28 12:41:44 +08:00
parent 080c55059a
commit 0801394999
7 changed files with 455 additions and 0 deletions

View File

@@ -218,4 +218,34 @@
FROM link_task
WHERE machine_id = #{machineId} AND status = #{status}
</select>
<select id="findByStatusListAndAgentId" 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
FROM link_task
WHERE agent_id = #{agentId}
AND status IN
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
ORDER BY created_at DESC
</select>
<select id="countByStatusListAndAgentId" resultType="long">
SELECT COUNT(1)
FROM link_task
WHERE agent_id = #{agentId}
AND status IN
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</select>
<delete id="batchDeleteByStatusListAndAgentId">
DELETE FROM link_task
WHERE agent_id = #{agentId}
AND status IN
<foreach collection="statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</delete>
</mapper>