kongzy
2024-09-14 f0f00e9ba8a755e4317e029d73b69a92ad9f9df1
exam-system/src/main/resources/mapper/system/ExPhaseStudentMapper.xml
@@ -11,7 +11,6 @@
        <result property="studentPhone"     column="student_phone"     />
        <result property="phaseName"     column="phase_name"     />
        <result property="createName"     column="create_name"     />
        <result property="period"     column="period"     />
        <association property="course" javaType="com.gkhy.exam.system.domain.ExCourse" resultMap="courseResult" />
        <collection property="totalProgress" ofType="java.math.BigDecimal" select="getTotalProgress" column="{phaseId=phase_id,studentId=student_id}"/>
        <collection property="startTime" ofType="java.time.LocalDateTime" select="getStartTime" column="{phaseId=phase_id,studentId=student_id}"/>
@@ -21,20 +20,21 @@
        <id     property="id"       column="course_id"        />
        <result property="name"     column="course_name"      />
        <result property="logo"     column="course_logo"      />
        <association property="period" javaType="java.lang.Long"  select="getCoursePeriod" column="{courseId=course_id}"/>
    </resultMap>
    <insert id="batchInsert" parameterType="java.util.List">
        insert into ex_phase_student(phase_id,student_id) values
        insert into ex_phase_student(phase_id,student_id,create_id) values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.phaseId},#{item.studentId})
            (#{item.phaseId},#{item.studentId},#{item.createId})
        </foreach>
    </insert>
    <select id="countByPhaseId" resultType="java.lang.Integer">
        select count(1) from ex_phase_student where phase_id#{phaseId}
        select count(1) from ex_phase_student where phase_id=#{phaseId}
    </select>
    <select id="selectPhaseStudentById" resultMap="ExPhaseStudentResult">
    <select id="selectPhaseStudentById" resultType="com.gkhy.exam.system.domain.ExPhaseStudent">
        select a.*,b.phone as student_phone,b.name as student_name from ex_phase_student a
        left join ex_student b on a.student_id=b.id
        where a.id=#{phaseStudentId}
@@ -49,7 +49,7 @@
    </select>
    <select id="selectPhaseStudentList" resultMap="ExPhaseStudentResult">
        select a.*,b.phone as student_phone,b.name as student_name,c.name as phase_name,d.period,e.name as create_name,d.id as course_id,d.logo as course_logo,d.name as course_name from ex_phase_student a
        select a.*,b.phone as student_phone,b.name as student_name,c.name as phase_name,e.name as create_name,d.id as course_id,d.logo as course_logo,d.name as course_name from ex_phase_student a
        left join ex_student b on a.student_id=b.id
        left join ex_course_phase c on c.id=a.phase_id
        left join ex_course d on d.id=c.course_id
@@ -77,4 +77,19 @@
    </select>
    <select id="getCoursePeriod" resultType="java.lang.Long">
        select sum(b.resource_length) from ex_course_chapter_period a
        inner join ex_resource b on a.resource_id=b.id
        where a.course_id=#{courseId}
    </select>
    <select id="selectPhaseStudentByStudentId" resultType="com.gkhy.exam.system.domain.ExPhaseStudent"
            parameterType="java.lang.Long">
        select a.*,b.name as phase_name,c.id as company_id,c.name as company_name from ex_phase_student a
        left join ex_course_phase b on b.id=a.phase_id
        left join sys_company c on c.id=b.company_id
        where a.student_id=#{studentId}
    </select>
</mapper>