package cn.com.ty.lift.ud.question.mapper;


import cn.com.ty.lift.ud.question.mapper.entity.QuestionOperateEntity;
import  com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 题库操作记录 -Repository
 * 
 * @author Xson
 * @date 2020-04-30
 */
public interface QuestionOperateMapper extends BaseMapper<QuestionOperateEntity> {

    /**
     * 查询是否操作过
     * @param qoEntity
     * @return
     */
    @Select("select * from question_operate where data_id = #{qoEntity.dataId} and user_id = #{qoEntity.userId} and" +
            " type = #{qoEntity.type}")
    List<QuestionOperateEntity> select(@Param("qoEntity") QuestionOperateEntity qoEntity);

    /**
     * 删除操作信息
     * @param operateEntity
     */
    @Delete("delete from question_operate where data_id = #{co.dataId} and type = #{co.type}" +
            "  and user_id = #{co.userId}")
    void deleteOne(@Param("co")QuestionOperateEntity operateEntity);
}
