<?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.gkhy.exam.system.mapper.SysCompanyMapper">
|
<resultMap type="com.gkhy.exam.system.domain.SysCompany" id="SysCompanyResult">
|
<result property="id" column="id" />
|
<result property="name" column="name" />
|
<result property="creditCode" column="credit_code" />
|
<result property="major" column="major" />
|
<result property="phone" column="phone" />
|
<result property="delFlag" column="del_flag" />
|
<result property="remainPeriod" column="remain_period" />
|
<result property="totalPeriod" column="total_period" />
|
<result property="version" column="version" />
|
<result property="createBy" column="create_by" />
|
<result property="createTime" column="create_time" />
|
<result property="updateBy" column="update_by" />
|
<result property="updateTime" column="update_time" />
|
<result property="remark" column="remark" />
|
</resultMap>
|
|
<sql id="selectCompanyVo">
|
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>
|
|
<select id="selectCompanyList" resultMap="SysCompanyResult">
|
<include refid="selectCompanyVo"/>
|
<where>
|
and del_flag=0
|
<if test="name != null and name != ''">
|
AND name like concat('%', #{name}, '%')
|
</if>
|
<if test="creditCode != null and creditCode != ''">
|
AND credit_code like concat('%', #{creditCode}, '%')
|
</if>
|
<if test="id!=null">
|
AND id=#{id}
|
</if>
|
</where>
|
order by id desc
|
</select>
|
|
<select id="selectCompanyById" resultMap="SysCompanyResult">
|
<include refid="selectCompanyVo"/>
|
where id=#{companyId}
|
</select>
|
|
|
<update id="delCompanyById">
|
update sys_company set del_flag=1 where id=#{companyId}
|
</update>
|
|
|
<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 >= #{startTime}
|
</if>
|
<if test="endTime!=null and endTime!=''">
|
and a.create_time <= #{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 >= #{startTime}
|
</if>
|
<if test="endTime!=null and endTime!=''">
|
and b.create_time <= #{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 >= #{startTime}
|
</if>
|
<if test="endTime!=null and endTime!=''">
|
and b.create_time <= #{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 >= #{startTime}
|
</if>
|
<if test="endTime!=null and endTime!=''">
|
and a.create_time <= #{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 >= #{startTime}
|
</if>
|
<if test="endTime!=null and endTime!=''">
|
and a.create_time <= #{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 >= #{startTime}
|
</if>
|
<if test="endTime!=null and endTime!=''">
|
and a.create_time <= #{endTime}
|
</if>
|
group by a.company_id
|
</select>
|
<select id="selectCompanyListS" resultType="com.gkhy.exam.system.domain.SysCompany">
|
select id, name, credit_code, major, phone,remain_period,total_period,version, create_by, create_time, update_by, update_time, remark
|
from sys_company where del_flag = 0
|
</select>
|
</mapper>
|