“djh”
2024-11-11 8458e64aab474c0fc2f49ae4ff22fb11ce5cf6e2
exam-system/src/main/resources/mapper/system/SysCompanyMapper.xml
@@ -9,7 +9,6 @@
        <result property="phone"         column="phone"          />
        <result property="delFlag"         column="del_flag"          />
        <result property="remainPeriod"         column="remain_period"          />
        <result property="spendPeriod"         column="spend_period"          />
        <result property="totalPeriod"         column="total_period"          />
        <result property="version"         column="version"          />
        <result property="createBy"       column="create_by"       />
@@ -20,7 +19,7 @@
    </resultMap>
    <sql id="selectCompanyVo">
        select id, name, credit_code, major, phone,remain_period,spend_period,total_period,version, create_by, create_time, update_by, update_time, remark
        select id, name, credit_code, major, phone,remain_period,total_period,version, create_by, create_time, update_by, update_time, remark
        from sys_company
    </sql>
@@ -34,8 +33,11 @@
            <if test="creditCode != null and creditCode != ''">
                AND credit_code like concat('%', #{creditCode}, '%')
            </if>
            <if test="id!=null">
                AND id=#{id}
            </if>
        </where>
        order by create_time desc
        order by id desc
    </select>
    <select id="selectCompanyById" resultMap="SysCompanyResult">
@@ -52,4 +54,101 @@
    <select id="checkNameUnique" resultMap="SysCompanyResult">
        select id,name from sys_company where name=#{name} and del_flag=0 limit 1
    </select>
    <select id="getOnlineCompanyPhaseCount" resultType="com.gkhy.exam.system.domain.vo.CompanyPhaseVO">
        select count(a.id) as phase_count,a.level,a.company_id from ex_course_phase a
        inner join sys_company b on b.id=a.company_id
        where a.del_flag=0 and b.del_flag=0 and a.company_id in
        <foreach collection="companyIds" item="companyId" open="(" separator="," close=")">
            #{companyId}
        </foreach>
        <if test="startTime!=null and startTime!=''">
            and a.create_time &gt;= #{startTime}
        </if>
        <if test="endTime!=null and endTime!=''">
            and a.create_time &lt;= #{endTime}
        </if>
        group by a.company_id,a.level
    </select>
    <select id="getOnlineCompanyPhaseStudentCount" resultType="com.gkhy.exam.system.domain.vo.CompanyPhaseStudentVO">
        select count(1) as phase_student_count,b.company_id,b.level from ex_phase_student a
        inner join ex_course_phase b on b.id=a.phase_id
        where b.del_flag=0 and b.company_id in
        <foreach collection="companyIds" item="companyId" open="(" separator="," close=")">
            #{companyId}
        </foreach>
        <if test="startTime!=null and startTime!=''">
            and b.create_time &gt;= #{startTime}
        </if>
        <if test="endTime!=null and endTime!=''">
            and b.create_time &lt;= #{endTime}
        </if>
        group by b.company_id,b.level
    </select>
    <select id="getOnlineCompanyPaperStudentCount" resultType="com.gkhy.exam.system.domain.vo.CompanyPaperStudentVO">
        select count(a.id) as paper_student_count,sum(a.passed) as pass_student_count,b.company_id from ex_paper_student a
        inner join ex_exam_paper b on b.id=a.paper_id
        where b.del_flag=0 and b.company_id in
        <foreach collection="companyIds" item="companyId" open="(" separator="," close=")">
            #{companyId}
        </foreach>
        <if test="startTime!=null and startTime!=''">
            and b.create_time &gt;= #{startTime}
        </if>
        <if test="endTime!=null and endTime!=''">
            and b.create_time &lt;= #{endTime}
        </if>
        group by b.company_id
    </select>
    <select id="getOfflineCompanyPhaseCount" resultType="com.gkhy.exam.system.domain.vo.CompanyPhaseVO">
        select count(f.plan_name)as phase_count,f.company_id,f.level  from (
        select a.plan_name,a.company_id,a.level from ex_exam_record a
        inner join sys_company b on b.id=a.company_id
        where b.del_flag=0 and a.company_id in
        <foreach collection="companyIds" item="companyId" open="(" separator="," close=")">
            #{companyId}
        </foreach>
        <if test="startTime!=null and startTime!=''">
            and a.create_time &gt;= #{startTime}
        </if>
        <if test="endTime!=null and endTime!=''">
            and a.create_time &lt;= #{endTime}
        </if>
        group by a.company_id,a.level,a.plan_name
        ) as f group by f.company_id,f.level
    </select>
    <select id="getOfflineCompanyPhaseStudentCount" resultType="com.gkhy.exam.system.domain.vo.CompanyPhaseStudentVO">
        select count(1) as phase_student_count,b.company_id,b.level from ex_exam_record a
        inner join sys_company b on b.id=a.company_id
        where b.del_flag=0 and a.company_id in
        <foreach collection="companyIds" item="companyId" open="(" separator="," close=")">
            #{companyId}
        </foreach>
        <if test="startTime!=null and startTime!=''">
            and a.create_time &gt;= #{startTime}
        </if>
        <if test="endTime!=null and endTime!=''">
            and a.create_time &lt;= #{endTime}
        </if>
        group by a.company_id,a.level
    </select>
    <select id="getOfflineCompanyPaperStudentCount" resultType="com.gkhy.exam.system.domain.vo.CompanyPaperStudentVO">
        select count(a.id) as paper_student_count,sum(a.passed) as pass_student_count,a.company_id from ex_exam_record a
        inner join sys_company b on b.id=a.paper_id
        where b.del_flag=0 and score is not null and a.company_id in
        <foreach collection="companyIds" item="companyId" open="(" separator="," close=")">
            #{companyId}
        </foreach>
        <if test="startTime!=null and startTime!=''">
            and a.create_time &gt;= #{startTime}
        </if>
        <if test="endTime!=null and endTime!=''">
            and a.create_time &lt;= #{endTime}
        </if>
        group by a.company_id
    </select>
</mapper>