|
@@ -1,7 +1,7 @@
|
|
|
<?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">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.zhongzheng.modules.bank.mapper.ExamMapper">
|
|
|
|
|
|
<resultMap type="com.zhongzheng.modules.bank.domain.Exam" id="ExamResult">
|
|
@@ -62,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="paperName" column="paper_name"/>
|
|
|
<result property="examLimitClient" column="exam_limit_client"/>
|
|
|
<collection property="goodsList" column="exam_id" select="findGoodsList"/>
|
|
|
+ <collection property="businessList" column="exam_id" select="findBusinessList"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="findGoodsList" resultMap="GoodsListResult">
|
|
@@ -75,6 +76,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
ga.major_id =#{exam_id} AND ga.type = 3
|
|
|
</select>
|
|
|
|
|
|
+ <select id="findBusinessList" resultType="com.zhongzheng.modules.bank.bo.QuestionBusinessAddBo">
|
|
|
+ SELECT
|
|
|
+ qb.education_type_id,
|
|
|
+ qb.business_id,
|
|
|
+ qb.project_id,
|
|
|
+ qb.subject_id,
|
|
|
+ cet.education_name,
|
|
|
+ cpt.project_name,
|
|
|
+ cb.business_name,
|
|
|
+ cs.subject_name
|
|
|
+ FROM
|
|
|
+ question_business qb
|
|
|
+ LEFT JOIN course_education_type cet ON qb.education_type_id = cet.id
|
|
|
+ LEFT JOIN course_project_type cpt ON qb.project_id = cpt.id
|
|
|
+ LEFT JOIN course_business cb ON qb.business_id = cb.id
|
|
|
+ LEFT JOIN course_subject cs ON cs.id = qb.subject_id
|
|
|
+ WHERE
|
|
|
+ qb.major_id =#{exam_id} AND qb.type = 2
|
|
|
+ </select>
|
|
|
+
|
|
|
<resultMap type="com.zhongzheng.modules.bank.vo.ExamGoodsVo" id="GoodsListResult">
|
|
|
<result property="goodsName" column="goods_name"/>
|
|
|
<result property="goodsId" column="goods_id"/>
|
|
@@ -82,26 +103,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="getList" parameterType="com.zhongzheng.modules.bank.bo.ExamQueryBo" resultMap="ExamVoResult">
|
|
|
SELECT
|
|
|
- e.*,
|
|
|
- qb.education_type_id,
|
|
|
- qb.business_id,
|
|
|
- qb.project_id,
|
|
|
- qb.subject_id,
|
|
|
- cet.education_name,
|
|
|
- cpt.project_name,
|
|
|
- cb.business_name,
|
|
|
- cs.subject_name,
|
|
|
+ e.*,
|
|
|
(SELECT count(*) FROM exam_question WHERE exam_id = e.exam_id)as question_num,
|
|
|
ep.paper_name
|
|
|
FROM
|
|
|
- exam e
|
|
|
- LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
|
|
|
- LEFT JOIN question_business qb ON e.exam_id = qb.major_id
|
|
|
- AND qb.type = 2
|
|
|
- LEFT JOIN course_education_type cet ON qb.education_type_id = cet.id
|
|
|
- LEFT JOIN course_project_type cpt ON qb.project_id = cpt.id
|
|
|
- LEFT JOIN course_business cb ON qb.business_id = cb.id
|
|
|
- LEFT JOIN course_subject cs ON cs.id = qb.subject_id
|
|
|
+ exam e
|
|
|
+ LEFT JOIN exam_paper ep ON e.exam_paper_id = ep.paper_id
|
|
|
+
|
|
|
where 1=1
|
|
|
<if test="status != null and status.size()!=0 ">
|
|
|
AND e.status in
|
|
@@ -119,19 +127,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
AND ep.paper_name like concat('%', #{paperName}, '%')
|
|
|
</if>
|
|
|
<if test="educationTypeId != null and educationTypeId != ''">
|
|
|
- AND cet.id = #{educationTypeId}
|
|
|
+ AND (select count(*) from question_business qb
|
|
|
+ where qb.major_id =e.exam_id AND qb.type = 2 and qb.education_type_id = #{educationTypeId})>0
|
|
|
</if>
|
|
|
<if test="examId != null and examId != ''">
|
|
|
AND e.exam_id = #{examId}
|
|
|
</if>
|
|
|
<if test="subjectId != null and subjectId != ''">
|
|
|
- AND cs.id = #{subjectId}
|
|
|
+ AND (select count(*) from question_business qb
|
|
|
+ where qb.major_id =e.exam_id AND qb.type = 2 and qb.subject_id = #{subjectId})>0
|
|
|
</if>
|
|
|
<if test="businessId != null and businessId != ''">
|
|
|
- AND cb.id = #{businessId}
|
|
|
+ AND (select count(*) from question_business qb
|
|
|
+ where qb.major_id =e.exam_id AND qb.type = 2 and qb.business_id = #{businessId})>0
|
|
|
</if>
|
|
|
<if test="projectId != null and projectId != ''">
|
|
|
- AND cpt.id = #{projectId}
|
|
|
+ AND (select count(*) from question_business qb
|
|
|
+ where qb.major_id =e.exam_id AND qb.type = 2 and qb.project_id = #{projectId})>0
|
|
|
</if>
|
|
|
<if test="examPaperId != null and examPaperId != ''">
|
|
|
AND e.exam_paper_id = #{examPaperId}
|