package com.xjrsoft.module.assessment.mapper;

import com.github.yulichang.base.MPJBaseMapper;
import com.xjrsoft.module.assessment.dto.AssessmentTemplatePlanSureDto;
import com.xjrsoft.module.assessment.entity.AssessmentPlanAnswerClass;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

/**
* @title: 考核计划答题参与班级
* @Author dzx
* @Date: 2024-04-01
* @Version 1.0
*/
@Mapper
public interface AssessmentPlanAnswerClassMapper extends MPJBaseMapper<AssessmentPlanAnswerClass> {

    @Update("update assessment_plan_answer_class set delete_mark = 1,modify_date = now(),modify_user_id = #{loginId} WHERE assessment_template_plan_id = #{planId}")
    Boolean deleteByPlanId(Long planId, Long loginId);

    @Update("UPDATE assessment_plan_answer_class t1" +
            " LEFT JOIN base_class t2 ON t1.class_id = t2.id" +
            " SET t1.is_confirm = 1, t1.modify_date = NOW(), t1.modify_user_id = #{loginId}" +
            " WHERE assessment_template_plan_id = #{dto.id} and t2.id = #{dto.classId}")
    Boolean sure(AssessmentTemplatePlanSureDto dto, Long loginId);
}
