qirong
2023-08-17 81dfe248054eaa3c2751ba32576f48598adcd04f
src/main/resources/mapper/ExamTemplatesUserCountMapper.xml
@@ -61,12 +61,13 @@
    </select>
    <select id="getByExamTemplates" resultType="com.mindskip.xzs.domain.vo.UserCountExcelVO" parameterType="java.lang.Integer">
        SELECT t.`name`as name,u.real_name as userName,a.user_score as userScore,a.paper_score as paperScore,ee.count as count,a.do_time as doTime
        SELECT t.`name`as name,d.`name` as departmentName,u.real_name as userName,SUBSTRING_INDEX(a.user_score/10,".",1) as userScore,SUBSTRING_INDEX(a.paper_score/10,".",1) as paperScore,ee.count as count,a.do_time as doTime
        from t_exam_templates_user_count c
        LEFT JOIN (select user_id as id,count(*) as count from t_exam_templates_user_count GROUP BY user_id) ee on ee.id = c.user_id
        LEFT JOIN t_exam_templates t on c.exam_templates_id = t.id
        INNER JOIN t_exam_paper_answer a on (c.exam_paper_id = a.exam_paper_id and c.user_id = a.create_user)
        LEFT JOIN t_user u on a.create_user = u.id
            LEFT JOIN (select user_id as id,exam_templates_id,count(*) as count from t_exam_templates_user_count GROUP BY exam_templates_id,user_id) ee on ee.exam_templates_id = c.exam_templates_id and ee.id = c.user_id
            LEFT JOIN t_exam_templates t on c.exam_templates_id = t.id
            INNER JOIN t_exam_paper_answer a on (c.exam_paper_id = a.exam_paper_id and c.user_id = a.create_user)
            LEFT JOIN t_user u on a.create_user = u.id
            LEFT JOIN t_department d on d.id = u.user_level
        where c.exam_templates_id = #{id}
    </select>