Commit cd112ea9 authored by wujipeng's avatar wujipeng
Browse files

init

parents
Pipeline #346 canceled with stages
<?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.platform.business.mapper.ExamMapper">
<select id="queryList" resultType="com.platform.business.model.vo.ExamVO">
select
e.id,
e.name,
e.exam_time,
(select count(*) from exam_student where exam_id = e.id) studentNum,
c.name className,
sys_level.name level,
e.class_id,
e.type
from
exam e
left join
class c
on
e.class_id = c.id
left join sys_level on c.level = sys_level.id
<where>
<if test="level != null and level != ''">
and c.level = #{level}
</if>
<if test="classId != null">
and e.class_id = #{classId}
</if>
<if test="name != null">
and e.name like concat('%',#{name},'%')
</if>
<if test="type != null and type != ''">
and e.type = #{type}
</if>
</where>
ORDER BY
STR_TO_DATE(SUBSTRING_INDEX(exam_time, '-', 1), '%Y.%m.%d %H:%i:%s') DESC
</select>
<select id="getInfoById" resultType="com.platform.business.model.vo.ExamVO">
select e.id,
e.name,
e.exam_time,
e.class_id,
c.name className,
c.level,
tp.name paperName,
u.nick_name chiefName,
e.invigilation_id,
e.chief_id,
e.paper_id,
e.type,
e.duration,
e.forbid
from
exam e
left join
class c
on
e.class_id = c.id
left join
theoretical_paper tp
on
e.paper_id = tp.id
left join
user u
on
e.chief_id = u.id
where
e.id = #{id}
</select>
<select id="queryListGroupByClass" resultType="com.platform.business.model.vo.ExamVO">
select
e.class_id,
c.name className,
c.level level,
COUNT(DISTINCT cs.user_id) as studentNum
from
exam e
left join
class c
on
e.class_id = c.id
left join
class_student cs
on
cs.class_id = e.class_id
<where>
<if test="level != null and level != ''">
and c.level = #{level}
</if>
<if test="name != null and name != ''">
and c.name like concat('%',#{name},'%')
</if>
and STR_TO_DATE(SUBSTRING_INDEX(exam_time, '-', -1), '%Y.%m.%d %H:%i:%s') &lt; NOW()
</where>
GROUP BY
e.class_id, c.name, c.level
ORDER BY
MAX(e.exam_time) DESC
</select>
<select id="queryByClassId" resultType="com.platform.business.model.vo.ExamVO">
select
e.id,
e.name,
e.exam_time,
e.class_id,
e.mark_flag
from exam e
where e.class_id = #{classId}
</select>
<select id="unfinished" resultType="com.platform.business.model.vo.ExamVO">
select
e.id,
e.name,
exam_time as examTime,
c.name className
from
exam e
left join
class c
on
e.class_id = c.id
left join
sys_level on c.level = sys_level.id
where
CONVERT_TZ(NOW(), 'UTC', '+08:00') &lt; STR_TO_DATE(SUBSTRING_INDEX(e.exam_time, '-', -1), '%Y.%m.%d %H:%i:%s')
and
e.id in (select exam_id
from
exam_student
where
student_id = #{id}
and
exam_student.submit = false)
</select>
<select id="paperOverview" resultType="com.platform.business.model.vo.TheoreticalPaperStudentDetailVO">
SELECT
id,
IF(actual_choice IS NULL, FALSE, TRUE) AS isAnswer,
result
FROM
theoretical_paper_student_detail
WHERE
student_id = #{studentId}
AND
exam_id = #{examId}
and
type = #{type}
</select>
<select id="numberAndScore" resultType="com.platform.business.model.vo.TheoreticalPaperStudentDetailVO">
select
type,
score,
count(*) as num
from
theoretical_paper_student_detail
where
exam_id = #{examId}
and
student_id = #{studentId}
group by
type, score
</select>
<select id="gradesDetail" resultType="com.platform.business.model.vo.ExamStudentVO">
select
u.nick_name as studentName,
c.name as className,
tp.lev,
e.exam_time as examTime,
es.answer_time as answerTime,
es.duration,
es.score
from
exam_student es
left join user u on es.student_id = u.id
left join class c on es.class_id = c.id
left join exam e on es.exam_id = e.id
left join theoretical_paper tp on e.paper_id = tp.id
where es.id = #{id}
</select>
<select id="same" resultType="com.platform.business.model.vo.TheoreticalPaperStudentDetailVO">
select
count(*) as sameRightNum,
ifnull(sum(score), 0) as sameScore
from
theoretical_paper_student_detail
where
student_id = #{studentId}
and exam_id = #{examId}
and type = #{type}
and result = true
</select>
</mapper>
<?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.platform.business.mapper.ExamStudentMapper">
<select id="queryByExamId" resultType="com.platform.business.model.vo.ExamStudentVO">
select
es.id,
u.nick_name studentName,
u.id_card,
u.phone_number,
u.factory,
c.name className,
e.name examName,
es.score score,
e.exam_time examTime,
es.class_id classId,
es.student_id studentId
from
exam_student es
left join
user u
on
es.student_id = u.id
left join
class c
on
es.class_id = c.id
left join
exam e
on
es.exam_id = e.id
where
es.exam_id = #{id}
</select>
<select id="queryByClassIdAndExamId" resultType="com.platform.business.model.vo.ExamStudentVO">
select
es.score score,
es.class_id classId,
es.student_id studentId
from
exam_student es
where
es.class_id = #{classId} and es.exam_id = #{examId}
and es.mark_flag = 0
</select>
<select id="queryByStudentId" resultType="com.platform.business.model.vo.ExamStudentVO">
select
es.id,
es.score score,
es.class_id classId,
es.student_id studentId,
c.name className,
e.name examName,
e.exam_time examTime
from
exam_student es
left join
class c
on
es.class_id = c.id
left join
exam e
on
es.exam_id = e.id
where
es.student_id = #{studentId}
ORDER BY
STR_TO_DATE(SUBSTRING_INDEX(e.exam_time, '-', 1), '%Y.%m.%d %H:%i:%s') DESC
</select>
<select id="paperDetail" resultType="com.platform.business.model.vo.ExamStudentVO">
select es.id,
es.class_id,
es.exam_id,
es.student_id,
u.nick_name as studentName,
es.end_time
from
exam_student es
left join
user u
on
es.student_id = u.id
where
es.id = #{id}
</select>
<select id="queryOneself" resultType="com.platform.business.model.vo.ExamStudentVO">
select
e.name as examName,
c.name as className,
e.exam_time as examTime
from exam_student es
left join exam e on es.exam_id = e.id
left join class c on c.id = e.class_id
where es.student_id = #{userId}
and es.submit = false
</select>
<select id="queryOneselfTeacher" resultType="com.platform.business.model.vo.ExamStudentVO">
select
distinct
e.name as examName,
c.name as className,
e.exam_time as examTime
from exam_student es
left join exam e on es.exam_id = e.id
left join class c on c.id = e.class_id
where es.submit = false and (
e.chief_id = #{userId} or e.invigilation_id like concat('%',#{userId},'%')
);
</select>
</mapper>
<?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.platform.business.mapper.ExaminerMapper">
</mapper>
<?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.platform.business.mapper.QuestionBankMapper">
<select id="queryList" resultType="com.platform.business.model.vo.QuestionBankVO">
select
qb.id,
qb.no,
qb.type,
qb.name,
qb.scene,
qb.level
from
question_bank qb
<where>
<if test="word != null and word != ''">
qb.level like concat('%',#{word},'%')
or qb.scene like concat('%',#{word},'%')
or qb.type like concat('%',#{word},'%')
or qb.name like concat('%',#{word},'%')
or qb.no like concat('%',#{word},'%')
</if>
<if test="type != null and type != ''">
and qb.type = #{type}
</if>
</where>
</select>
</mapper>
<?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.platform.business.mapper.QuestionThirdMapper">
<select id="selectListInQuestionNo" resultType="com.platform.business.model.entity.QuestionThirdEntity">
select
id,
no,
question_id,
question_second_id,
title,
answer,
score,
nature
from
question_third
where
no
in
<foreach item="item" collection="questionNos" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
<?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.platform.business.mapper.StudentLevelCertMapper">
<select id="queryList" resultType="com.platform.business.model.vo.StudentLevelCertVO">
select
student_level_cert.id,
student_level_cert.work_type,
student_level_cert.occupation,
student_level_cert.level,
student_level_cert.date,
student_level_cert.name,
student_level_cert.cert_no,
student_level_cert.issue_date,
student_level_cert.id_card,
student_level_cert.user_name,
student_level_cert.no,
student_level_cert.factory,
student_level_cert.issue_dept,
student_level_cert.cert_image
from
student_level_cert
left join
sys_level
on
student_level_cert.level = sys_level.name
<where>
<if test="level != null and level != ''">
and sys_level.id = #{level}
</if>
<if test="factory != null and factory != ''">
and student_level_cert.factory = #{factory}
</if>
<if test="name != null and name != ''">
and student_level_cert.user_name like concat('%',#{name},'%')
</if>
</where>
</select>
</mapper>
<?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.platform.business.mapper.SysLevelMapper">
<select id="queryList" resultType="com.platform.business.model.vo.SysLevelVO">
select
id,
name,
description
from
sys_level
<where>
<if test="hiddeFlag != null">
hidde_flag = #{hiddeFlag}
</if>
</where>
</select>
</mapper>
<?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.platform.business.mapper.SysPhoneRoleMapper">
<select id="queryByPhone" resultType="com.platform.business.model.entity.SysPhoneRoleEntity">
select
phone,
role_name
from phone_role
where phone = #{phone}
</select>
</mapper>
<?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.platform.business.mapper.SysRoleAndMenuMapper">
<select id="queryByRoleId" resultType="com.platform.business.model.vo.SysRoleAndMenuVO">
select
sram.id,
sram.role_id,
sram.menu_id,
sm.name menuName,
sm.url menuUrl
from
sys_role_and_menu sram
left join
sys_menu sm
on
sram.menu_id = sm.id
where
sram.role_id = #{id}
</select>
</mapper>
<?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.platform.business.mapper.TheoreticalLibraryMapper">
<delete id="removeDirtyData">
delete from
theoretical_library
where
is_problem = true and (problem is null or problem = '');
</delete>
<select id="randomData" resultType="com.platform.business.model.entity.TheoreticalLibraryEntity">
SELECT id,
scope,
is_problem,
lev,
sequence,
code,
first_level_name,
second_level_name,
third_level_name,
fourth_level_name,
type,
problem,
answer,
option_a,
option_b,
option_c,
option_d
FROM theoretical_library
WHERE scope = #{scope}
AND is_problem = TRUE
AND type = #{type}
AND first_level_name = #{firstLevelName}
AND second_level_name = #{secondLevelName}
AND participate = true
ORDER BY RAND()
LIMIT #{count}
</select>
<select id="randomQuestions" resultType="com.platform.business.model.entity.TheoreticalPaperDetailEntity">
SELECT scope,
is_problem,
lev,
sequence,
code,
first_level_name,
second_level_name,
third_level_name,
fourth_level_name,
type,
problem,
answer,
option_a,
option_b,
option_c,
option_d,
option_e
FROM theoretical_library
WHERE scope = #{scope}
AND is_problem = TRUE
AND type = #{type}
AND first_level_name = #{firstLevelName}
AND second_level_name = #{secondLevelName}
AND participate = true
ORDER BY RAND()
LIMIT #{count}
</select>
<select id="pageData" resultType="com.platform.business.model.vo.TheoreticalLibraryVO">
SELECT
id,
scope,
first_level_name,
second_level_name,
third_level_name,
fourth_level_name,
type,
code,
CASE WHEN
option_a IS NULL
AND
option_b IS NULL
AND
option_c IS NULL
AND
option_d IS NULL
AND
option_e IS NULL
THEN problem
ELSE
CONCAT(problem, '\n',
CASE WHEN
option_a IS NOT NULL THEN CONCAT('A.', option_a, '\n') ELSE '' END,
CASE WHEN
option_b IS NOT NULL THEN CONCAT('B.', option_b, '\n') ELSE '' END,
CASE WHEN
option_c IS NOT NULL THEN CONCAT('C.', option_c, '\n') ELSE '' END,
CASE WHEN
option_d IS NOT NULL THEN CONCAT('D.', option_d, '\n') ELSE '' END,
CASE WHEN
option_e IS NOT NULL THEN CONCAT('E.', option_e, '\n') ELSE '' END)
END as problem,
answer,
participate
FROM
theoretical_library
WHERE
is_problem = true
<if test="scope != null and scope != ''">
and scope = #{scope}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="search != null and search != ''">
and (code like concat('%', #{search}, '%') or problem like concat('%', #{search}, '%'))
</if>
</select>
<select id="randomQuestionsSimulation"
resultType="com.platform.business.model.entity.TheoreticalPracticeStudentSimulationDetailEntity">
SELECT scope,
is_problem,
lev,
sequence,
code,
first_level_name,
second_level_name,
third_level_name,
fourth_level_name,
type,
problem,
answer,
option_a,
option_b,
option_c,
option_d,
option_e
FROM theoretical_library
WHERE scope = #{scope}
AND is_problem = TRUE
AND type = #{type}
AND first_level_name = #{firstLevelName}
AND second_level_name = #{secondLevelName}
AND participate = true
ORDER BY RAND()
LIMIT #{count}
</select>
<select id="groupByChapter" resultType="com.platform.business.model.entity.TheoreticalLibraryEntity">
SELECT *
FROM theoretical_library
WHERE sequence IS NOT NULL
AND CHAR_LENGTH(sequence) = 2
and scope = #{level}
</select>
</mapper>
<?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.platform.business.mapper.TheoreticalPaperDetailMapper">
<select id="selectDisorderly" resultType="com.platform.business.model.entity.TheoreticalPaperDetailEntity">
SELECT id,
paper_id,
scope,
is_problem,
lev,
sequence,
code,
first_level_name,
second_level_name,
third_level_name,
fourth_level_name,
type,
problem,
answer,
option_a,
option_b,
option_c,
option_d,
option_e,
score
FROM theoretical_paper_detail
WHERE paper_id = #{paperId}
ORDER BY CASE type
WHEN '判断题' THEN 1
WHEN '单选题' THEN 2
WHEN '多选题' THEN 3
ELSE 4
END, RAND()
</select>
</mapper>
<?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.platform.business.mapper.TheoreticalPaperMapper">
<select id="pageData" resultType="com.platform.business.model.vo.TheoreticalPaperVO">
select
id,
lev,
name,
num,
sum,
create_type,
create_user,
create_time,
sequence
from
theoretical_paper
<where>
<if test="lev != null and lev != ''">
and lev = #{lev}
</if>
<if test="createType != null and createType != ''">
and create_type like concat('%',#{createType},'%')
</if>
<if test="search != null and search != ''">
and (name like concat('%',#{search},'%') or create_user like concat('%',#{search},'%'))
</if>
</where>
order by
create_time desc
</select>
</mapper>
<?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.platform.business.mapper.TheoreticalPaperStudentDetailMapper">
<select id="process" resultType="com.platform.business.model.vo.TheoreticalPaperStudentDetailVO">
select
id,
actual_choice
from
theoretical_paper_student_detail
where
student_id = #{studentId}
and
exam_id = #{examId}
</select>
<select id="questionDetail" resultType="com.platform.business.model.vo.TheoreticalPaperStudentDetailVO">
select id,
paper_id,
student_id,
exam_id,
type,
problem,
actual_choice,
option_a,
option_b,
option_c,
option_d,
option_e,
score
from
theoretical_paper_student_detail
where
id = #{id}
</select>
<select id="gradesQuestionDetail"
resultType="com.platform.business.model.vo.TheoreticalPaperStudentDetailVO">
select id,
paper_id,
student_id,
exam_id,
type,
problem,
actual_choice,
answer,
result,
option_a,
option_b,
option_c,
option_d,
option_e,
score
from
theoretical_paper_student_detail
where
id = #{id}
</select>
<update id="leaveBlank">
update
theoretical_paper_student_detail
set
actual_choice = null
where
id = #{id}
</update>
</mapper>
<?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.platform.business.mapper.TheoreticalPracticeMapper">
<select id="page" resultType="com.platform.business.model.vo.TheoreticalPracticeVO">
SELECT
tp.id,
tp.lev,
tp.class_id,
c.name AS className,
tp.start_time,
tp.end_time,
tp.creator,
tp.creator_id,
tp.create_time,
tp.is_close,
CONCAT(
COUNT(DISTINCT tps.student_id),
'/',
COUNT(DISTINCT cs.user_id)
) AS studentCount
FROM
theoretical_practice tp
LEFT JOIN
class c
ON
tp.class_id = c.id
LEFT JOIN
theoretical_practice_student tps
ON
tps.practice_id = tp.id
LEFT JOIN
class_student cs
ON
cs.class_id = tp.class_id
<where>
<if test="lev != null and lev != ''">
and tp.lev = #{lev}
</if>
</where>
GROUP BY
tp.id, tp.lev, tp.class_id, c.name, tp.start_time, tp.end_time, tp.creator, tp.creator_id, tp.create_time, tp.is_close
order by tp.create_time desc
</select>
<select id="detail" resultType="com.platform.business.model.vo.TheoreticalPracticeVO">
select
id,
lev,
class_id,
start_time,
end_time,
creator,
create_time,
is_close
from
theoretical_practice
where
id = #{id}
</select>
</mapper>
<?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.platform.business.mapper.TheoreticalPracticeStudentMapper">
<select id="selectStudentListByPracticeId"
resultType="com.platform.business.model.vo.TheoreticalPracticeStudentVO">
select
tps.id,
tps.practice_id,
tps.student_id,
u.phone_number as phone,
u.id_card as idCard,
u.company_name1 as workPlace
from
theoretical_practice_student tps
left join
user u
on
tps.student_id = u.id
where
tps.practice_id = #{id}
</select>
</mapper>
<?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.platform.business.mapper.TheoreticalPracticeStudentQuestionBankMapper">
<select id="groupByStudentId" resultType="java.lang.String">
select
student_id
from
theoretical_practice_student_question_bank
group by
student_id
</select>
<select id="onePage" resultType="com.platform.business.model.vo.TheoreticalPracticeStudentQuestionBankVO">
SELECT first_level_name,
chapter,
COUNT(*) AS total,
COUNT(CASE WHEN result IS NOT NULL THEN 1 END) AS completed,
ROUND(
COUNT(CASE WHEN result = true THEN 1 END) * 100.0 / NULLIF(COUNT(*), 0), 2
) AS accuracyRate
FROM theoretical_practice_student_question_bank
WHERE student_id = #{studentId}
GROUP BY first_level_name,chapter
ORDER BY chapter
</select>
<select id="twoPage" resultType="com.platform.business.model.vo.TheoreticalPracticeStudentQuestionBankVO">
SELECT
first_level_name,
second_level_name,
section,
COUNT(*) AS total,
COUNT(CASE WHEN result IS NOT NULL THEN 1 END) AS completed,
ROUND(
COUNT(CASE WHEN result = true THEN 1 END) * 100.0 / NULLIF(COUNT(*), 0), 2
) AS accuracyRate
FROM theoretical_practice_student_question_bank
WHERE student_id = #{studentId}
and first_level_name = #{firstLevelName}
GROUP BY
first_level_name,second_level_name,section
ORDER BY
section
</select>
<select id="overview" resultType="com.platform.business.model.vo.TheoreticalPracticeStudentQuestionBankVO">
select
type,
count(*) as total
from
theoretical_practice_student_question_bank
where
student_id = #{studentId}
and
first_level_name = #{firstLevelName}
and
second_level_name = #{secondLevelName}
group by
type
</select>
<select id="paperOverview"
resultType="com.platform.business.model.vo.TheoreticalPracticeStudentQuestionBankVO">
select
id,
IF(actual_choice IS NULL, FALSE, TRUE) AS isAnswer,
result
from
theoretical_practice_student_question_bank
where
student_id = #{studentId}
and
first_level_name = #{firstLevelName}
and
second_level_name = #{secondLevelName}
and
type = #{type}
</select>
<select id="countdown" resultType="java.util.Date">
select
end_time
from
theoretical_practice
where
id
in (
select
practice_id
from
theoretical_practice_student
where
student_id = #{id}
)
and is_close = false
and end_time > #{date}
and start_time &lt; #{date}
order by
end_time
limit 1
</select>
<update id="reAnswer">
update
theoretical_practice_student_question_bank
set
actual_choice = null,
result = null
where
student_id = #{studentId}
and
first_level_name = #{firstLevelName}
and
second_level_name = #{secondLevelName}
</update>
</mapper>
<?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.platform.business.mapper.TheoreticalPracticeStudentSimulationDetailMapper">
<select id="numberAndScore"
resultType="com.platform.business.model.vo.TheoreticalPracticeStudentSimulationDetailVO">
select
type,
score,
count(*) as num
from
theoretical_practice_student_simulation_detail
where
simulation_id = #{id}
group by
type, score
</select>
<select id="paperOverview"
resultType="com.platform.business.model.vo.TheoreticalPracticeStudentSimulationDetailVO">
SELECT
id,
IF(actual_choice IS NULL, FALSE, TRUE) AS isAnswer,
result
FROM
theoretical_practice_student_simulation_detail
WHERE
simulation_id = #{id}
and
type = #{type}
</select>
<update id="reAnswer">
update
theoretical_practice_student_simulation_detail
set
actual_choice = null,
result = null
where simulation_id = #{id}
</update>
<select id="questionDetail"
resultType="com.platform.business.model.vo.TheoreticalPracticeStudentSimulationDetailVO">
select
id,
simulation_id,
type,
problem,
actual_choice,
option_a,
option_b,
option_c,
option_d,
option_e,
score
from
theoretical_practice_student_simulation_detail
where
id = #{id}
</select>
<select id="gradesQuestionDetail"
resultType="com.platform.business.model.vo.TheoreticalPracticeStudentSimulationDetailVO">
select
id,
simulation_id,
type,
problem,
actual_choice,
answer,
result,
option_a,
option_b,
option_c,
option_d,
option_e,
score
from
theoretical_practice_student_simulation_detail
where
id = #{id}
</select>
</mapper>
<?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.platform.business.mapper.TheoreticalPracticeStudentSimulationMapper">
<select id="pageData" resultType="com.platform.business.model.vo.TheoreticalPracticeStudentSimulationVO">
select
id,
student_id,
name,
create_time,
score,
total_score
from
theoretical_practice_student_simulation
where
student_id = #{studentId}
order by
create_time desc
</select>
<select id="same" resultType="com.platform.business.model.vo.TheoreticalPracticeStudentSimulationDetailVO">
select
count(*) as sameRightNum,
ifnull(sum(score), 0) as sameScore
from
theoretical_practice_student_simulation_detail
where
simulation_id = #{simulationId}
and
type = #{type}
and
result = true
</select>
<update id="reAnswer">
update theoretical_practice_student_simulation
set start_time = null,
end_time = null,
answer_duration = null,
score = '待作答'
where id = #{id}
</update>
</mapper>
<?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.platform.business.mapper.UserMapper">
<select id="queryList" resultType="com.platform.business.model.vo.UserVO">
select
user.id,
user.username,
user.nick_name,
user.sex,
user.id_card,
user.phone_number,
user.del_flag,
user.home_address,
role.id as roleId,
role.name as roleName
from
user
left join
sys_user_and_role
on
sys_user_and_role.user_id = user.id
left join
role
on
sys_user_and_role.role_id = role.id
<where>
<if test="nickName != null and nickName != ''">
user.username like concat('%',#{nickName},'%')
or user.nick_name like concat('%',#{nickName},'%')
</if>
<if test="idType != null and idType != ''">
and id_type = #{idType}
</if>
<if test="roleId != null">
and role.id = #{roleId}
</if>
</where>
</select>
<select id="queryByUserName" resultType="com.platform.business.model.vo.UserVO">
select
user.id,
user.username,
user.nick_name,
user.sex,
user.id_card,
user.phone_number,
user.del_flag,
role.id as roleId,
role.name as roleName,
user.exam_flag,
user.exam_oneself_id,
user.level,
user.simulation_flag,
user.simulation_id
from
user
left join
sys_user_and_role
on
sys_user_and_role.user_id = user.id
left join
role
on
sys_user_and_role.role_id = role.id
where user.phone_number = #{userName}
</select>
<update id="closeExam">
update user
set exam_flag = false,
exam_oneself_id = null
where id = #{id}
</update>
<update id="closeSimulation">
update user
set simulation_flag = false,
simulation_id = null
where id = #{studentId}
</update>
</mapper>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment