2025-04-23 17:21:25 +08:00
|
|
|
<?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="pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionMapper">
|
|
|
|
|
|
|
|
<resultMap type="ExamQuestion" id="ExamQuestionResult">
|
|
|
|
<result property="quId" column="qu_id" />
|
|
|
|
<result property="quBankId" column="qu_bank_id" />
|
|
|
|
<result property="quBankName" column="qu_bank_name" />
|
|
|
|
<result property="chapteridDictText" column="chapterId_dict_text" />
|
|
|
|
<result property="subjectName" column="subject_name" />
|
|
|
|
<result property="quLevel" column="qu_level" />
|
|
|
|
<result property="content" column="content" />
|
|
|
|
<result property="contentText" column="content_text" />
|
|
|
|
<result property="analysis" column="analysis" />
|
|
|
|
<result property="pointNames" column="point_names" />
|
|
|
|
<result property="keywords" column="keywords" />
|
|
|
|
<result property="manual" column="manual" />
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
<result property="creator" column="creator" />
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
<result property="updater" column="updater" />
|
|
|
|
<result property="deleted" column="deleted" />
|
|
|
|
<result property="status" column="status" />
|
|
|
|
<result property="audit" column="audit" />
|
|
|
|
<result property="courseName" column="course_name" />
|
|
|
|
<result property="specialtyName" column="specialty_name" />
|
|
|
|
<result property="tenantId" column="tenant_id" />
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 嵌套答案列表 -->
|
|
|
|
<collection property="answerList" ofType="pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer">
|
|
|
|
<id property="answerId" column="answer_id"/>
|
|
|
|
<result property="quId" column="a_qu_id"/>
|
|
|
|
<result property="isRight" column="is_right"/>
|
|
|
|
<result property="image" column="image"/>
|
|
|
|
<result property="content" column="a_content"/>
|
|
|
|
<result property="contentIn" column="a_content_in"/>
|
|
|
|
<result property="scoreRate" column="score_rate"/>
|
|
|
|
<result property="sort" column="sort"/>
|
|
|
|
</collection>
|
|
|
|
</resultMap>
|
2025-05-16 15:32:38 +08:00
|
|
|
<resultMap type="pc.exam.pp.module.exam.controller.admin.question.vo.TenantVo" id="TenantVoResult">
|
|
|
|
<result property="id" column="id" />
|
|
|
|
<result property="name" column="name" />
|
|
|
|
<result property="ququeName" column="queue_name" />
|
|
|
|
</resultMap>
|
2025-04-23 17:21:25 +08:00
|
|
|
<sql id="selectExamQuestionVo">
|
|
|
|
select qu_id, qu_bank_id, qu_bank_name, chapterId_dict_text,subject_name, qu_level,
|
|
|
|
content, content_text, analysis, point_names, keywords, manual, create_time, creator, update_time, updater, deleted ,status,audit ,course_name, specialty_name from exam_question
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectExamQuestionByQuId" parameterType="String" resultMap="ExamQuestionResult">
|
|
|
|
<include refid="selectExamQuestionVo"/>
|
|
|
|
where qu_id = #{quId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectExamQuestionListByQuIds" resultMap="ExamQuestionResult">
|
|
|
|
SELECT
|
|
|
|
q.*, -- exam_question 表字段
|
|
|
|
a.answer_id,
|
|
|
|
a.qu_id AS a_qu_id,
|
|
|
|
a.is_right,
|
|
|
|
a.image,
|
|
|
|
a.content AS a_content,
|
|
|
|
a.contentIn AS a_content_in,
|
|
|
|
a.score_rate,
|
|
|
|
a.sort
|
|
|
|
FROM exam_question q
|
|
|
|
LEFT JOIN exam_question_answer a ON q.qu_id = a.qu_id
|
|
|
|
WHERE q.qu_id IN
|
|
|
|
<foreach collection="list" item="id" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
ORDER BY
|
|
|
|
CASE WHEN a.sort IS NOT NULL THEN 0 ELSE 1 END,
|
|
|
|
a.sort ASC
|
|
|
|
</select>
|
2025-05-16 15:32:38 +08:00
|
|
|
<select id="getSchoolName" resultMap="TenantVoResult">
|
|
|
|
SELECT id, name, queue_name
|
|
|
|
FROM system_tenant
|
|
|
|
WHERE deleted = 0
|
|
|
|
<if test="name != null and name != ''">
|
|
|
|
AND name LIKE CONCAT('%', #{name}, '%')
|
|
|
|
</if>
|
|
|
|
LIMIT #{pageSize} OFFSET #{offset}
|
|
|
|
</select>
|
|
|
|
<select id="getSchoolNameTotal" resultType="java.lang.Long">
|
|
|
|
SELECT count(*)
|
|
|
|
FROM system_tenant
|
|
|
|
WHERE id != 1 AND deleted = 0
|
|
|
|
<if test="name != null and name != ''">
|
|
|
|
AND name LIKE CONCAT('%', #{name}, '%')
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="selectExamQuestionByQuIdAndTenantId"
|
|
|
|
resultMap="ExamQuestionResult">
|
|
|
|
<include refid="selectExamQuestionVo"/>
|
|
|
|
where qu_id = #{quId} and tenant_id= #{source}
|
|
|
|
|
|
|
|
</select>
|
|
|
|
<select id="seleAllQueueName" resultType="java.lang.String">
|
|
|
|
SELECT queue_name
|
|
|
|
FROM system_tenant
|
|
|
|
WHERE deleted = 0
|
|
|
|
</select>
|
2025-05-16 17:05:18 +08:00
|
|
|
<select id="selectExamQuestionCountByQuId" resultType="java.lang.Integer">
|
|
|
|
select count(*) from exam_question where qu_id=#{quId}
|
|
|
|
</select>
|
|
|
|
<select id="getSchoolNameNaPage" resultMap="TenantVoResult">
|
|
|
|
SELECT id, name, queue_name
|
|
|
|
FROM system_tenant
|
|
|
|
WHERE deleted = 0
|
|
|
|
</select>
|
2025-05-18 00:00:49 +08:00
|
|
|
<select id="selectTenantId" resultType="java.lang.Long">
|
|
|
|
select tenant_id from system_users limit 1
|
|
|
|
</select>
|
2025-05-19 22:00:57 +08:00
|
|
|
<select id="selectByTypes" resultMap="ExamQuestionResult">
|
|
|
|
select * from exam_question where specialty_name =#{specialtyName}
|
|
|
|
and course_name=#{courseName}
|
|
|
|
and subject_name =#{subjectName}
|
|
|
|
and content =#{content}
|
|
|
|
limit 1;
|
|
|
|
</select>
|
|
|
|
<select id="selectSchoolnameBytId" resultType="java.lang.String">
|
|
|
|
select name from system_tenant where id =#{loginTenantId}
|
|
|
|
</select>
|
2025-04-23 17:21:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertExamQuestion" parameterType="ExamQuestion">
|
|
|
|
insert into exam_question
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="quId != null">qu_id,</if>
|
|
|
|
<if test="quBankId != null">qu_bank_id,</if>
|
|
|
|
<if test="quBankName != null">qu_bank_name,</if>
|
|
|
|
<if test="chapteridDictText != null">chapterId_dict_text,</if>
|
|
|
|
<if test="subjectName != null">subject_name,</if>
|
|
|
|
<if test="quLevel != null">qu_level,</if>
|
|
|
|
<if test="content != null">content,</if>
|
|
|
|
<if test="contentText != null">content_text,</if>
|
|
|
|
<if test="analysis != null">analysis,</if>
|
|
|
|
<if test="pointNames != null">point_names,</if>
|
|
|
|
<if test="keywords != null">keywords,</if>
|
|
|
|
<if test="manual != null">manual,</if>
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
<if test="creator != null">creator,</if>
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
<if test="updater != null">updater,</if>
|
|
|
|
<if test="deleted != null">deleted,</if>
|
|
|
|
<if test="status != null">status,</if>
|
|
|
|
<if test="audit != null">audit,</if>
|
|
|
|
<if test="courseName != null">course_name,</if>
|
|
|
|
<if test="specialtyName != null">specialty_name,</if>
|
|
|
|
<if test="tenantId != null">tenant_id,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="quId != null">#{quId},</if>
|
|
|
|
<if test="quBankId != null">#{quBankId},</if>
|
|
|
|
<if test="quBankName != null">#{quBankName},</if>
|
|
|
|
<if test="chapteridDictText != null">#{chapteridDictText},</if>
|
|
|
|
<if test="subjectName != null">#{subjectName},</if>
|
|
|
|
<if test="quLevel != null">#{quLevel},</if>
|
|
|
|
<if test="content != null">#{content},</if>
|
|
|
|
<if test="contentText != null">#{contentText},</if>
|
|
|
|
<if test="analysis != null">#{analysis},</if>
|
|
|
|
<if test="pointNames != null">#{pointNames},</if>
|
|
|
|
<if test="keywords != null">#{keywords},</if>
|
|
|
|
<if test="manual != null">#{manual},</if>
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
<if test="creator != null">#{creator},</if>
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
<if test="updater != null">#{updater},</if>
|
|
|
|
<if test="deleted != null">#{deleted},</if>
|
|
|
|
<if test="status != null">#{status},</if>
|
|
|
|
<if test="audit != null">#{audit},</if>
|
|
|
|
<if test="courseName != null">#{courseName},</if>
|
|
|
|
<if test="specialtyName != null">#{specialtyName},</if>
|
|
|
|
<if test="tenantId != null">#{tenantId},</if>
|
|
|
|
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateExamQuestion" parameterType="ExamQuestion">
|
|
|
|
update exam_question
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="quBankId != null">qu_bank_id = #{quBankId},</if>
|
|
|
|
<if test="quBankName != null">qu_bank_name = #{quBankName},</if>
|
|
|
|
<if test="chapteridDictText != null">chapterId_dict_text = #{chapteridDictText},</if>
|
|
|
|
<if test="subjectName != null">subject_name = #{subjectName},</if>
|
|
|
|
<if test="quLevel != null">qu_level = #{quLevel},</if>
|
|
|
|
<if test="content != null">content = #{content},</if>
|
|
|
|
<if test="contentText != null">content_text = #{contentText},</if>
|
|
|
|
<if test="analysis != null">analysis = #{analysis},</if>
|
|
|
|
<if test="pointNames != null">point_names = #{pointNames},</if>
|
|
|
|
<if test="keywords != null">keywords = #{keywords},</if>
|
|
|
|
<if test="manual != null">manual = #{manual},</if>
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
<if test="creator != null">creator = #{creator},</if>
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
<if test="updater != null">updater = #{updater},</if>
|
|
|
|
<if test="deleted != null">deleted = #{deleted},</if>
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
<if test="audit != null">audit = #{audit},</if>
|
|
|
|
<if test="courseName != null">course_name = #{courseName},</if>
|
|
|
|
<if test="specialtyName != null">specialty_name = #{specialtyName},</if>
|
|
|
|
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
|
|
|
</trim>
|
|
|
|
where qu_id = #{quId}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteExamQuestionByQuId" parameterType="String">
|
|
|
|
UPDATE exam_question set deleted ='2' where qu_id = #{quId}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<update id="deleteExamQuestionByQuIds" parameterType="String">
|
|
|
|
UPDATE exam_question
|
|
|
|
SET deleted = '2'
|
|
|
|
WHERE qu_id IN
|
|
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
2025-05-16 15:32:38 +08:00
|
|
|
<update id="setQuestionAuditByids">
|
|
|
|
UPDATE exam_question
|
|
|
|
SET audit = '2'
|
|
|
|
WHERE qu_id IN
|
|
|
|
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
<update id="auditQueByIds">
|
|
|
|
UPDATE exam_question
|
|
|
|
SET audit = '0'
|
|
|
|
WHERE qu_id IN
|
|
|
|
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
<update id="noAuditQue">
|
|
|
|
|
|
|
|
UPDATE exam_question
|
|
|
|
SET audit = '3'
|
|
|
|
WHERE qu_id IN
|
|
|
|
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
2025-05-16 17:05:18 +08:00
|
|
|
<update id="updateExamQuestionByIds">
|
2025-05-21 19:12:51 +08:00
|
|
|
UPDATE education_question_examine
|
2025-05-16 17:05:18 +08:00
|
|
|
SET updater = #{updater},
|
|
|
|
update_time = now()
|
|
|
|
WHERE qu_id IN
|
|
|
|
<foreach collection="quIds" item="id" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</update>
|
2025-04-23 17:21:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|