<?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.ExExamPaperMapper">
|
<resultMap type="com.gkhy.exam.system.domain.ExExamPaper" id="ExamPaperResult">
|
<result property="id" column="id" />
|
<result property="name" column="name" />
|
<result property="code" column="code" />
|
<result property="status" column="status" />
|
<result property="companyId" column="company_id" />
|
<result property="categoryId" column="category_id" />
|
<result property="limitTime" column="limit_time" />
|
<result property="limit" column="limit" />
|
<result property="singleNum" column="single_num" />
|
<result property="singleScore" column="single_score" />
|
<result property="singleBankId" column="single_bank_id" />
|
<result property="singleMethod" column="single_method" />
|
<result property="multiNum" column="multi_num" />
|
<result property="multiScore" column="multi_score" />
|
<result property="multiBankId" column="multi_bank_id" />
|
<result property="multiMethod" column="multi_method" />
|
<result property="judgeNum" column="judge_num" />
|
<result property="judgeScore" column="judge_score" />
|
<result property="judgeBankId" column="judge_bank_id" />
|
<result property="judgeMethod" column="judge_method" />
|
<result property="passScore" column="pass_score" />
|
<result property="version" column="version" />
|
<result property="delFlag" column="del_flag" />
|
<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" />
|
<result property="companyName" column="company_name" />
|
<collection property="singleQuestions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=id,questionType=1}"/>
|
<collection property="multiQuestions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=id,questionType=2}"/>
|
<collection property="judgeQuestions" ofType="com.gkhy.exam.system.domain.ExQuestion" select="getQuestionByPaperId" column="{paperId=id,questionType=3}"/>
|
</resultMap>
|
|
|
<sql id="selectExamPaperVo">
|
select a.id, a.name, a.code, a.status, a.company_id,a.category_id,a.limit_time,a.limit,a.single_num,a.single_score,a.single_bank_id,
|
a.single_method,a.multi_num,a.multi_score,
|
a.multi_bank_id,a.multi_method,a.judge_num,a.judge_score,a.judge_bank_id,a.judge_method,a.pass_score,
|
a.version, a.create_by, a.create_time, a.update_by, a.update_time, a.remark,b.name as company_name
|
from ex_exam_paper a
|
left join sys_company b on b.id=a.company_id
|
</sql>
|
|
<update id="deletePaperById">
|
update ex_exam_paper set del_flag=1 where id=#{paperId}
|
</update>
|
|
<select id="selectExamPaperList" resultMap="ExamPaperResult">
|
<include refid="selectExamPaperVo"/>
|
<where>
|
and a.del_flag=0
|
<if test="name != null and name != ''">
|
AND a.name like concat('%', #{name}, '%')
|
</if>
|
<if test="code != null and code != ''">
|
AND a.credit_code like concat('%', #{creditCode}, '%')
|
</if>
|
<if test="companyId != null and companyId != ''">
|
AND a.company_id= #{companyId}
|
</if>
|
</where>
|
order by a.id desc
|
</select>
|
|
<select id="selectExamPaperById" resultMap="ExamPaperResult">
|
<include refid="selectExamPaperVo"/>
|
where a.id=#{paperId}
|
</select>
|
|
<select id="selectCountBetweenDay" resultType="java.lang.Long">
|
select count(1) from ex_exam_paper where create_time >= #{startTime} and create_time <= #{endTime}
|
</select>
|
|
<select id="checkNameUnique" resultType="com.gkhy.exam.system.domain.ExExamPaper">
|
select id ,name from ex_exam_paper where name=#{name} limit 1
|
</select>
|
|
<select id="getQuestionByPaperId" resultType="com.gkhy.exam.system.domain.ExQuestion">
|
select a.* from ex_question a
|
inner join ex_paper_question b on a.id=b.question_id
|
where b.paper_id=#{paperId} and a.question_type=#{questionType}
|
order by a.id asc
|
</select>
|
|
|
|
|
|
|
</mapper>
|