| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <?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.zhongzheng.modules.bank.mapper.QuestionMapper">
- <resultMap type="com.zhongzheng.modules.bank.domain.Question" id="QuestionResult">
- <result property="questionId" column="question_id"/>
- <result property="content" column="content"/>
- <result property="type" column="type"/>
- <result property="answerQuestion" column="answer_question"/>
- <result property="status" column="status"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="analysisContent" column="analysis_content"/>
- <result property="imgUrl" column="img_url"/>
- <result property="jsonStr" column="json_str"/>
- <result property="prefixName" column="prefix_name"/>
- <result property="knowledgeIds" column="knowledge_ids"/>
- <result property="publishStatus" column="publish_status"/>
- <result property="code" column="code"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.bank.vo.QuestionVo" id="QuestionResultVo">
- <result property="questionId" column="question_id"/>
- <result property="content" column="content"/>
- <result property="type" column="type"/>
- <result property="answerQuestion" column="answer_question"/>
- <result property="status" column="status"/>
- <result property="analysisContent" column="analysis_content"/>
- <result property="imgUrl" column="img_url"/>
- <result property="jsonStr" column="json_str"/>
- <result property="prefixName" column="prefix_name"/>
- <result property="knowledgeIds" column="knowledge_ids"/>
- <result property="publishStatus" column="publish_status"/>
- <result property="code" column="code"/>
- <collection property="businessList" column="question_id" select="findBusinessList" />
- <collection property="knowledgeList" column="knowledge_ids" select="findKnowledge"/>
- </resultMap>
- <select id="findKnowledge" resultMap="ExamKnowledge">
- SELECT
- ek.knowledge_name,
- ek.knowledge_id
- FROM
- exam_knowledge ek
- WHERE
- FIND_IN_SET( ek.knowledge_id, #{knowledge_ids} )
- </select>
- <select id="findBusinessList" resultMap="QuestionBusiness">
- SELECT
- qb.education_type_id,
- qb.business_id,
- qb.project_id,
- qb.subject_id,
- qb.type as business_type,
- 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=#{question_id} and qb.type = 1
- </select>
- <resultMap type="com.zhongzheng.modules.bank.domain.QuestionBusiness" id="QuestionBusiness">
- <result property="id" column="id"/>
- <result property="subjectId" column="subject_id"/>
- <result property="educationTypeId" column="education_type_id"/>
- <result property="businessId" column="business_id"/>
- <result property="projectId" column="project_id"/>
- <result property="educationName" column="education_name"/>
- <result property="projectName" column="project_name"/>
- <result property="businessName" column="business_name"/>
- <result property="subjectName" column="subject_name"/>
- <result property="type" column="business_type"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.exam.domain.ExamKnowledge" id="ExamKnowledge">
- <result property="knowledgeId" column="knowledge_id"/>
- <result property="knowledgeName" column="knowledge_name"/>
- </resultMap>
- <select id="selectList" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="QuestionResultVo">
- SELECT DISTINCT
- q.*
- FROM
- question q
- LEFT JOIN question_business qb ON q.question_id = qb.major_id
- AND qb.type = 1
- WHERE
- 1 = 1
- <if test="status != null and status.size()!=0 ">
- AND q.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND qb.education_type_id = #{educationTypeId}
- </if>
- <if test="subjectId != null and subjectId != ''">
- AND qb.subject_id = #{subjectId}
- </if>
- <if test="businessId != null and businessId != ''">
- AND qb.business_id = #{businessId}
- </if>
- <if test="prefixName != null and prefixName != ''">
- AND q.prefix_name like concat('%', #{prefixName}, '%')
- </if>
- <if test="pageSizeSelf != null and pageSizeSelf != ''">
- LIMIT #{currIndex} , #{pageSizeSelf}
- </if>
- GROUP BY
- q.question_id
- ORDER BY q.question_id DESC
- </select>
- <select id="selectList_COUNT" resultType="Long">
- SELECT
- count(distinct q.question_id)
- FROM
- question q
- LEFT JOIN question_business qb ON q.question_id = qb.major_id and qb.type = 1
- WHERE
- 1 = 1
- <if test="status != null and status.size()!=0 ">
- AND q.status in
- <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="educationTypeId != null and educationTypeId != ''">
- AND qb.education_type_id = #{educationTypeId}
- </if>
- <if test="subjectId != null and subjectId != ''">
- AND qb.subject_id = #{subjectId}
- </if>
- <if test="businessId != null and businessId != ''">
- AND qb.business_id = #{businessId}
- </if>
- <if test="prefixName != null and prefixName != ''">
- AND q.prefix_name like concat('%', #{prefixName}, '%')
- </if>
-
- </select>
- </mapper>
|