package com.qmth.teachcloud.mark.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qmth.teachcloud.mark.entity.MarkSpecialTag;
import com.qmth.teachcloud.mark.mapper.MarkSpecialTagMapper;
import com.qmth.teachcloud.mark.service.MarkSpecialTagService;

/**
 * <p>
 * 特殊标记表 服务实现类
 * </p>
 *
 * @author xf
 * @since 2023-11-01
 */
@Service
public class MarkSpecialTagServiceImpl extends ServiceImpl<MarkSpecialTagMapper, MarkSpecialTag>
		implements MarkSpecialTagService {

	@Override
	public void deleteByTaskId(Long taskId) {
		UpdateWrapper<MarkSpecialTag> updateWrapper = new UpdateWrapper<>();
		updateWrapper.lambda().eq(MarkSpecialTag::getTaskId, taskId);
		this.remove(updateWrapper);
	}

	@Override
	public void deleteByStudentId(Long studentId) {
		this.baseMapper.deleteByStudentId(studentId);
	}

	@Override
	public void deleteByExamIdAndPaperNumberAndGroupNumber(Long examId, String paperNumber, Integer groupNumber) {
		this.baseMapper.deleteByExamIdAndPaperNumberAndGroupNumber(examId, paperNumber, groupNumber);
	}

	@Override
	public List<MarkSpecialTag> findByTaskId(Long taskId) {
		QueryWrapper<MarkSpecialTag> queryWrapper = new QueryWrapper<>();
		queryWrapper.lambda().eq(MarkSpecialTag::getTaskId, taskId);
		return this.list(queryWrapper);
	}
}
