智慧保安后台管理-外网
src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml
@@ -290,30 +290,35 @@
        exam.*,
        user.jurisdiction,
        user.real_name securityName,
        ke.exam_name examName
        ke.exam_name examName,sis.enterpriseName trainingUnitName,ke.start_time examStartTime
        FROM
        exam_score exam
        LEFT JOIN blade_user user
        ON exam.user_id = user.id
        left join
        sys_information si
        on
        si.departmentid = user.dept_id
        left join
        sys_jurisdiction sj
        on
        sj.id = si.jurisdiction
        left join
        ksxt_exam ke
        on
        exam.exam_id = ke.id
        left join blade_user user on exam.user_id = user.id
        left join sys_information si on si.departmentid = user.dept_id
        left join sys_jurisdiction sj on sj.id = si.jurisdiction
        left join ksxt_exam ke on exam.exam_id = ke.id
        left join sys_training_registration str on str.id = exam.apply_id
        left join sys_information sis on sis.departmentid = str.training_unit_id
        WHERE
        1 = 1
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
        and ke.exam_type = 2
        <if test="examScore.jurisdiction!=null and examScore.jurisdiction!='' and examScore.jurisdiction!='1372091709474910209'">
            and (sj.id = #{examScore.jurisdiction} or sj.parent_id = #{examScore.jurisdiction})
        </if>
        <if test="deptid!=null and deptid!=''">
            AND user.dept_id = #{deptid}
        <if test="examScore.securityName!=null and examScore.securityName!=''">
            AND user.real_name like concat('%',#{examScore.securityName},'%')
        </if>
        <if test="examScore.trainingUnitName!=null and examScore.trainingUnitName!=''">
            AND sis.enterpriseName like concat('%',#{examScore.trainingUnitName},'%')
        </if>
        <if test="examScore.deptId!=null and examScore.deptId!=''">
            AND user.dept_id = #{examScore.deptId}
        </if>
        <if test="examScore.month!=null and examScore.month!=''">
            AND date_format(ke.start_time,'%Y-%m') = #{examScore.month}
        </if>
        <if test="examScore.qualified!=null">
            AND exam.qualified = #{examScore.qualified}
        </if>
    </select>
@@ -425,5 +430,78 @@
        order by es.id desc
    </select>
    <!--导出-按条件查询成绩数据-模拟考试-->
    <select id="getExamStatisInfo" resultType="org.springblade.modules.exam.vo.ExamSocreStatis">
        select m.id name, IFNULL(b,0) hgnum,IFNULL(c,0) bhgnum from
        (
          select 1 as id union
            select 2 union
            select 3 union
            select 4 union
            select 5 union
            select 6 union
            select 7 union
            select 8 union
            select 9 union
            select 10 union
            select 11 union
            select 12
        ) m
        left join
         (
            SELECT MONTH
                ( ke.start_time ) a,
                count(*) b
            FROM
                exam_score es
                left join sys_training_registration str on str.id = es.apply_id
                left join ksxt_exam ke on ke.id = es.exam_id
                left join blade_user bu on bu.id = es.user_id
                left join blade_dept bd on bd.id = bu.dept_id
                left join sys_information si on bd.id = si.departmentid
                left join sys_jurisdiction sj on si.jurisdiction = sj.id
            WHERE
                qualified = 0
                and training_unit_id = #{information.departmentid}
                and YEAR ( ke.start_time ) = YEAR ( now() )
                <if test="information.deptid!=null and information.deptid!=''">
                    and bu.dept_id = #{information.deptid}
                </if>
                <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
                    and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction})
                </if>
            GROUP BY
                MONTH ( ke.start_time )
            ) n ON m.id = n.a
            left join
         (
            SELECT MONTH
                ( ke.start_time ) a,
                count(*) c
            FROM
                exam_score es
                left join sys_training_registration str on str.id = es.apply_id
                left join ksxt_exam ke on ke.id = es.exam_id
                left join blade_user bu on bu.id = es.user_id
                left join blade_dept bd on bd.id = bu.dept_id
                left join sys_information si on bd.id = si.departmentid
                left join sys_jurisdiction sj on si.jurisdiction = sj.id
            WHERE
                qualified = 1
                and training_unit_id = #{information.departmentid}
                and YEAR ( ke.start_time ) = YEAR ( now() )
                <if test="information.deptid!=null and information.deptid!=''">
                    and bu.dept_id = #{information.deptid}
                </if>
                <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
                    and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction})
                </if>
            GROUP BY
                MONTH ( ke.start_time )
            ) i ON m.id = i.a
        ORDER BY
            id
    </select>
</mapper>