package com.qmth.distributed.print.business.service.impl;

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.distributed.print.business.entity.ExamCardDetail;
import com.qmth.distributed.print.business.mapper.ExamCardDetailMapper;
import com.qmth.distributed.print.business.service.ExamCardDetailService;
import org.springframework.stereotype.Service;

import javax.management.Query;

/**
 * <p>
 * 题卡详情 服务实现类
 * </p>
 *
 * @author xf
 * @since 2021-03-23
 */
@Service
public class ExamCardDetailServiceImpl extends ServiceImpl<ExamCardDetailMapper, ExamCardDetail> implements ExamCardDetailService {

    @Override
    public ExamCardDetail getByCardId(Long cardId) {
        QueryWrapper<ExamCardDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(ExamCardDetail::getCardId, cardId);
        return this.getOne(queryWrapper);
    }

    @Override
    public void removeByCardId(Long id) {
        UpdateWrapper<ExamCardDetail> updateWrapper = new UpdateWrapper<>();
        updateWrapper.lambda().eq(ExamCardDetail::getCardId, id);
        this.remove(updateWrapper);
    }
}
