<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qmth.teachcloud.mark.mapper.MarkSpecialTagMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.qmth.teachcloud.mark.entity.MarkSpecialTag">
        <id column="id" property="id" />
        <result column="task_id" property="taskId" />
        <result column="tag_name" property="tagName" />
        <result column="position_x" property="positionX" />
        <result column="position_y" property="positionY" />
        <result column="offset_index" property="offsetIndex" />
        <result column="offset_x" property="offsetX" />
        <result column="offset_y" property="offsetY" />
    </resultMap>
    <delete id="deleteByStudentId" parameterType="java.lang.Long">
        DELETE FROM mark_special_tag
        WHERE
            EXISTS (SELECT
                        1
                    FROM
                        mark_task mt
                    WHERE
                        mt.student_id = #{studentId} AND task_id = mt.id)
    </delete>
    <delete id="deleteByExamIdAndPaperNumberAndGroupNumber">
        DELETE FROM mark_special_tag
        WHERE
                task_id IN (SELECT
                                mt.id
                            FROM
                                mark_task mt
                            WHERE
                                mt.exam_id = #{examId}
                              AND mt.paper_number = #{paperNumber}
                              AND mt.group_number = #{groupNumber})
    </delete>

</mapper>
