jl-jjsp-service/securityControl-modules/securityControl-proteam/target/classes/mapper/studyExam/ItemBankMapper.xml

87 lines
3.6 KiB
XML

<?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.sercurityControl.proteam.studyExam.mapper.IItemBankMapper">
<insert id="operData">
<if test="operType == 1">
INSERT INTO ex_topic
(topic, topic_type, topic_answer, topic_option, create_time,create_user_name)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.topic}, #{item.topicType}, #{item.topicAnswer},
#{item.topicOption},NOW(), #{item.createUserName}
)
</foreach>
</if>
<if test="operType == 2">
<foreach collection="list" item="item" separator=";">
UPDATE ex_topic
SET
topic = #{item.topic},
topic_type = #{item.topicType},
topic_answer = #{item.topicAnswer},
topic_option = #{item.topicOption}
WHERE id = #{item.id}
</foreach>
</if>
<if test="operType == 3">
DELETE FROM ex_topic
WHERE id IN (
<foreach item="item" collection="list" separator=",">
#{item.id}
</foreach>
)
</if>
</insert>
<!--获取试题库列表-->
<select id="getItemBanks" resultType="com.sercurityControl.proteam.studyExam.domain.ItemBankVo">
SELECT id,
topic,
topic_type AS topicType,
CASE topic_type WHEN 1 THEN '单选题' WHEN 2 THEN '多选题' WHEN 3 THEN '简答题' ELSE '' END AS topicTypeName,
topic_answer AS topicAnswer,
topic_option AS topicOption
FROM ex_topic
<where>
<if test="topicType!=null">
AND topic_type = #{topicType}
</if>
<if test="topic!=null and topic!=''">
AND INSTR(topic,#{topic}) > 0
</if>
AND topic_type IN (1,2)
AND del_flag = 0
</where>
ORDER BY create_time DESC
</select>
<!--获取每日考试记录列表-->
<select id="getDayExamRecord" resultType="com.sercurityControl.proteam.studyExam.domain.DayExamRecordVo">
SELECT edeu.id,
IFNULL(edeu.band_user_name,edeu.assign_account_name) AS bindUserName,
edeu.score,
edeu.total_score AS totalScore,
IF(edeu.hand_paper_status = 1,'已交卷','未交卷') AS handPaperStatus,
edeu.assign_date AS assignDate,
su.login_name AS loginName,
so.org_name AS orgName
FROM ex_day_exam_user edeu
LEFT JOIN sys_user su ON edeu.assign_account_id = su.id
LEFT JOIN sys_org so ON su.org_id = so.org_id
<where>
<if test="startDay!=null and startDay!='' and endDay!=null and endDay!=''">
AND edeu.assign_date BETWEEN #{startDay} AND #{endDay}
</if>
<if test="bindUserName!=null and bindUserName!=''">
AND INSTR(IFNULL(edeu.band_user_name,edeu.assign_account_name),#{bindUserName}) > 0
</if>
<if test="assignAccountName!=null and assignAccountName!=''">
AND INSTR(su.login_name,#{assignAccountName}) > 0
</if>
<if test="roleType == 2 or roleType == 3">
AND edeu.assign_account_id = #{userId}
</if>
</where>
ORDER BY edeu.assign_date DESC
</select>
</mapper>