package shop.alien.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import shop.alien.entity.store.LifeUserLearningRecord;
import shop.alien.entity.store.vo.LifeUserLearningVideoVo;

import java.util.List;

public interface LifeUserLearningRecordMapper extends BaseMapper<LifeUserLearningRecord> {

    @Select("select video.name, video.profile, video.score, video.video_url, if(record.id is null, 0, 1) isWatch from life_user_learning_video video\n" +
            "left join life_user_learning_record record on record.learning_id = video.id and user_id = #{userId}")
    List<LifeUserLearningVideoVo> getListByUserId(@Param("userId") Integer userId);
}

