<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xjrsoft.module.activity.mapper.ActivityEnrollMapper">
    <select id="getPage" parameterType="com.xjrsoft.module.activity.dto.ActivityEnrollPageDto" resultType="com.xjrsoft.module.activity.vo.ActivityEnrollPageVo">
        SELECT t1.id,t1.status,t2.name,t1.create_date,t2.user_name,t2.mobile,
        (select id from base_teacher where user_id = t1.user_id) as teacher_id,
        (select id from base_student where user_id = t1.user_id) as student_id FROM activity_enroll t1
        INNER JOIN xjr_user t2 ON t1.user_id = t2.id
        WHERE t1.delete_mark = 0 AND t1.activity_info_id = #{dto.activityInfoId}
        <if test="dto.status != null">
            and t1.status = #{dto.status}
        </if>
    </select>

    <select id="getList" parameterType="com.xjrsoft.module.activity.dto.ActivityEnrollExportDto" resultType="com.xjrsoft.module.activity.vo.ActivityEnrollPageVo">
        SELECT t1.id,t1.status,t2.name,t1.create_date,t2.user_name,t2.mobile,
        (select id from base_teacher where user_id = t1.user_id) as teacher_id,
        (select id from base_student where user_id = t1.user_id) as student_id FROM activity_enroll t1
        INNER JOIN xjr_user t2 ON t1.user_id = t2.id
        WHERE t1.delete_mark = 0 AND t1.activity_info_id = #{dto.activityInfoId}
        <if test="dto.status != null">
            and t1.status = #{dto.status}
        </if>
    </select>
</mapper>