472 lines
19 KiB
XML
Raw Permalink Normal View History

2026-03-10 14:30:24 +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="ExamPaper">
<insert id="insertExamPaper" parameterType="ExamPaper">
INSERT INTO ExamPaper ( examPaperId, authorType, teacherId, examLevel, title, isRecommend,
part1Text, part1Voice, part1OrigiScore, part2Text, part2Voice, part2Question, part2EachOrigiScore,
totalScore, status, areaId,
content,
machineScore, humanScore, usedArea, paperFile, md5Code ,isoral ,assigntime ) Values
( #{examPaperId}, #{authorType}, #{teacherId}, #{examLevel}, #{title}, #{isRecommend},
#{part1Text}, #{part1Voice}, #{part1OrigiScore}, #{part2Text}, #{part2Voice}, #{part2Question}, #{part2EachOrigiScore},
#{totalScore}, #{status}, #{areaId},
#{content},
#{machineScore}, #{humanScore}, #{usedArea}, #{paperFile}, #{md5Code} ,#{isOral} ,#{assigntime})
</insert>
<update id="updateExamPaper" parameterType="ExamPaper">
UPDATE ExamPaper SET
examPaperId = #{examPaperId}, authorType = #{authorType}, teacherId = #{teacherId}, examLevel = #{examLevel},
title = #{title}, isRecommend = #{isRecommend}, part1Text = #{part1Text}, part1Voice = #{part1Voice},
part1OrigiScore = #{part1OrigiScore}, part2Text = #{part2Text}, part2Voice = #{part2Voice},
part2Question = #{part2Question}, part2EachOrigiScore = #{part2EachOrigiScore}, totalScore = #{totalScore},
status = #{status}, areaId = #{areaId}, assigntime= #{assigntime},
content = #{content}, machineScore = #{machineScore}, humanScore = #{humanScore}, usedArea = #{usedArea}, paperFile = #{paperFile},
md5Code = #{md5Code},isoral=#{isOral}
where examPaperId=#{examPaperId}
</update>
<update id="updateExamPaperForAssignTime" parameterType="ExamPaper">
UPDATE ExamPaper SET
assigntime= #{assigntime}
where examPaperId=#{examPaperId}
</update>
<select id="getExamPaperByKey" parameterType="java.lang.Integer" resultType="ExamPaper">
SELECT examPaperId , authorType , teacherId , examLevel , title , isRecommend ,
part1Text , part1Voice , part1OrigiScore , part2Text , part2Voice , part2Question ,
part2EachOrigiScore , totalScore , status , areaId ,
content , assigntime,
machineScore , humanScore , usedArea , paperFile , md5Code ,isOral
FROM ExamPaper
WHERE examPaperId=#{examPaperId}
</select>
<!-- 获取模考单独试卷-->
<select id="getMockExamPapers" parameterType="java.util.Map" resultType="ExamPaper">
SELECT examPaperId , authorType , teacherId , examLevel , title , isRecommend ,
part1Text , part1Voice , part1OrigiScore , part2Text , part2Voice , part2Question ,
part2EachOrigiScore , totalScore , status , areaId ,
content ,
machineScore , humanScore , usedArea , paperFile , md5Code ,isOral,assigntime
FROM ExamPaper where isOral = #{isOral} and examPaperId in
<foreach collection="examPaperIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
order by examPaperId desc
LIMIT #{pageSize} OFFSET #{offset}
</select>
<!-- 获取模考单独试卷总数 -->
<select id="getMockExamPapersCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*)
FROM ExamPaper where isOral = #{isOral} and examPaperId in
<foreach collection="examPaperIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<select id="getSeqExamPaper" resultType="Integer" useCache="false" flushCache="true">
SELECT nextval('seq_examPaperId')
</select>
<select id="getExamPapersCountByTeacherId" parameterType="java.util.Map" resultType="Integer">
SELECT count(*) as howmuch from ExamPaper
WHERE teacherId=#{teacherId} and status = 1
and (exampaperid &gt; 112 or exampaperId &lt;0)
<if test="isNeedAssigntime != null ">
and assigntime = 0
</if>
<if test="isOral!=null">
and isOral = #{isOral}
</if>
<if test="title!=null">
and title like '%${title}%'
</if>
<if test="areaid!=null">
and areaid = #{areaid}
</if>
</select>
<select id="getExamPapersByKey" parameterType="java.util.List" resultType="ExamPaper">
SELECT examPaperId , authorType , teacherId , examLevel , title , isRecommend ,
part1Text , part1Voice , part1OrigiScore , part2Text , part2Voice , part2Question ,
part2EachOrigiScore , totalScore , status , areaId ,
content , assigntime,
machineScore , humanScore , usedArea , paperFile , md5Code ,isOral
FROM ExamPaper
WHERE examPaperId in
<foreach collection="list" item="examPaperId" index="index" separator="," open="(" close=")">
#{examPaperId}
</foreach>
</select>
<select id="getExamPapersByTeacherId" parameterType="java.util.Map" resultType="ExamPaper">
SELECT a.examPaperId , a.authorType , a.teacherId , a.examLevel , a.title , a.isRecommend ,
'' as part1Text , a.part1Voice , a.part1OrigiScore , '' as part2Text , a.part2Voice ,
'' as part2Question , a.part2EachOrigiScore , a.totalScore , a.status , a.areaid ,a.isOral,array_to_string( array_agg(c.valueStr),',') as examTags,array_to_string( array_agg(c.paraInt),',') as examTagsTypes,a.assigntime
FROM ExamPaper as a left join ExamPaperTag as b on a.examPaperId = b.examPaperId and b.status = 1 left join parameter as c
on c.paraId = b.tagId and c.status = 1 and c.paraType = 5
where a.status = 1
and a.teacherId=#{teacherId}
and (a.exampaperid &gt; 112 or a.exampaperId &lt;0)
<if test="isNeedAssigntime != null ">
and a.assigntime = 0
</if>
<if test="isOral!=null">
and a.isOral = #{isOral}
</if>
<if test="title!=null">
and a.title like '%${title}%'
</if>
<if test="areaid!=null">
and a.areaid = #{areaid}
</if>
GROUP BY a.examPaperId , a.authorType , a.teacherId , a.examLevel , a.title , a.isRecommend ,
a.part1Text , a.part1Voice , a.part1OrigiScore , a.part2Text , a.part2Voice , a.part2Question ,
a.part2EachOrigiScore , a.totalScore , a.status , a.areaId ,
a.isOral,a.assigntime
ORDER BY a.examPaperId desc
LIMIT #{pageSize} OFFSET #{offset}
</select>
<select id="getExamPapersCountByTeacherIdByAuth" parameterType="java.util.Map" resultType="Integer">
SELECT count(*) as howmuch from V_ExamPaper
WHERE teacherId=#{teacherId} and status = 1
and (exampaperid &gt; 112 or exampaperId &lt;0)
and isOral = #{isOral}
<if test="title!=null">
and title like '%${title}%'
</if>
<if test="paperIds!=null">
and examPaperId not in
<foreach collection="paperIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="getExamPapersByTeacherIdByAuth" parameterType="java.util.Map" resultType="ExamPaper">
SELECT examPaperId , authorType , teacherId , examLevel , title , isRecommend ,
'' as part1Text , part1Voice , part1OrigiScore , '' as part2Text , part2Voice ,
'' as part2Question , part2EachOrigiScore , totalScore , status , areaId ,
'' as content , machineScore , humanScore , usedArea , paperFile , md5Code,isOral
FROM V_ExamPaper
WHERE teacherId=#{teacherId} and status = 1
and (exampaperid &gt; 112 or exampaperid&lt;0 )
and isOral = #{isOral}
<if test="title!=null">
and title like '%${title}%'
</if>
<if test="paperIds!=null">
and examPaperId not in
<foreach collection="paperIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
ORDER BY examPaperId desc
LIMIT #{pageSize} OFFSET #{offset}
</select>
<update id="examPaperBatchUpdateByExamPaperId">
UPDATE ExamPaper SET status = 0
WHERE examPaperId in
<foreach collection="list" index="index" item="item" separator="," close=")" open="(">
#{item}
</foreach>
</update>
<select id="getExamPaperByName" parameterType="java.util.Map" resultType="ExamPaper">
SELECT a.examPaperId , authorType , teacherId , examLevel , title , isRecommend ,
'' as part1Text , part1Voice , part1OrigiScore , '' as part2Text , part2Voice ,
'' as part2Question , part2EachOrigiScore , totalScore , status , areaId ,isOral,assigntime
FROM ExamPaper a left join ExamPaperAuth b on a.exampaperid = b.exampaperid
WHERE status = 1 and title like '%${name}%' and isOral = #{isOral}
and (a.exampaperid &gt; 112 or a.exampaperid&lt;0 )
and ( teacherId=0 or teacherId = #{teacherId}
or (objectid = #{teacherId} and objecttype = 1)
or (objectid = #{schoolId} and objecttype = 2)
or (objectid = #{areaId} and objecttype = 3))
ORDER BY a.examPaperId desc
LIMIT #{pageSize} OFFSET #{offset}
</select>
<select id="getExamPaperCountByName" parameterType="java.util.Map" resultType="Integer">
SELECT count(*)
FROM ExamPaper a
left join ExamPaperAuth b
on a.exampaperid = b.exampaperid
WHERE status = 1 and title like '%${name}%' and isOral = #{isOral}
and (a.exampaperid &gt; 112 or a.exampaperid&lt;0 )
and ( teacherId=0 or teacherId = #{teacherId}
or (objectid = #{teacherId} and objecttype = 1)
or (objectid = #{schoolId} and objecttype = 2)
or (objectid = #{areaId} and objecttype = 3) )
</select>
<select id="getExampaperCountByUnivTeacherId" parameterType="java.util.Map" resultType="Integer">
SELECT count(*) as howmuch
FROM V_UnivExamPaper
WHERE teacherId=#{teacherId} and status = 1 and isOral=#{isOral}
<if test="title!=null">
and title like '%${title}%'
</if>
</select>
<select id="getExampapersByUnivTeacherId" parameterType="java.util.Map" resultType="ExamPaper">
SELECT examPaperId , authorType , teacherId , examLevel , title , isRecommend ,
'' as part1Text , part1Voice , part1OrigiScore , '' as part2Text , part2Voice ,
'' as part2Question , part2EachOrigiScore , totalScore , status , areaId ,
'' as content ,
machineScore , humanScore , usedArea , paperFile , md5Code ,isOral
FROM V_UnivExamPaper
WHERE teacherId=#{teacherId} and status = 1 and isOral=#{isOral}
<if test="title!=null">
and title like '%${title}%'
</if>
ORDER BY examPaperId desc
LIMIT #{pageSize} OFFSET #{offset}
</select>
<select id="getExamPapersForExcel" parameterType="java.util.Map" resultType="java.util.HashMap">
select exampaperid , examlevel , title from exampaper where (exampaperid &gt;112 or exampaperid&lt;0) and status=1 and teacherId=0
<if test="examLevel!=null">
and examlevel = #{examLevel}
</if>
<if test="isOral!=null">
and isOral = #{isOral}
</if>
order by examlevel asc,exampaperid desc
</select>
<select id="getExamPapersOfHearByTeacherIdByAuth" parameterType="java.util.Map" resultType="ExamPaper">
SELECT hearpaperid as examPaperId , '' as authorType , teacherId , examLevel , title , null as isRecommend ,
'' as part1Text ,null as part1Voice ,null as part1OrigiScore , '' as part2Text , '' as part2Voice ,
'' as part2Question ,null as part2EachOrigiScore ,null as totalScore , status , areaId ,
'' as content ,
null as machineScore ,null as humanScore ,null as usedArea , null as paperFile ,null as md5Code ,isOral
FROM v_hearpaper
WHERE teacherId=#{teacherId} and status = 1
<if test="title!=null">
and title like '%${title}%'
</if>
ORDER BY examPaperId desc
LIMIT #{pageSize} OFFSET #{offset}
</select>
<select id="getExamPapersOfHearByTeacherIdByAuthCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*)
FROM v_hearpaper
WHERE teacherId=#{teacherId} and status = 1
<if test="title!=null">
and title like '%${title}%'
</if>
</select>
<select id="getOldHearPaperById" parameterType="java.lang.Integer" resultType="ExamPaper">
SELECT hearpaperid examPaperId, teacherId, examLevel, title,
content, status, areaId , -1 as isOral
FROM HearPaper
WHERE hearPaperId=#{hearPaperId}
</select>
<select id="getHearByUnivTeacherIdByAuth" parameterType="java.util.Map" resultType="ExamPaper">
SELECT hearpaperid as examPaperId , '' as authorType , teacherId , examLevel , title , null as isRecommend ,
'' as part1Text ,null as part1Voice ,null as part1OrigiScore , '' as part2Text , '' as part2Voice ,
'' as part2Question ,null as part2EachOrigiScore ,null as totalScore , status , areaId ,
'' as content ,
null as machineScore ,null as humanScore ,null as usedArea , null as paperFile ,null as md5Code ,isOral
FROM v_univhearpaper
WHERE teacherId=#{teacherId} and status = 1
<if test="title!=null">
and title like '%${title}%'
</if>
ORDER BY examPaperId desc
LIMIT #{pageSize} OFFSET #{offset}
</select>
<select id="getHearCountByUnivTeacherIdByAuth" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*)
FROM v_univhearpaper
WHERE teacherId=#{teacherId} and status = 1
<if test="title!=null">
and title like '%${title}%'
</if>
</select>
<select id="getStorageExamPapersByExamPaperIds" parameterType="java.util.Map" resultType="ExamPaper">
SELECT a.examPaperId , a.teacherId , a.title ,a.isOral ,array_to_string(array_agg(c.paraId),',') as examTags,a.assigntime
FROM ExamPaper as a left join ExamPaperTag as b on a.examPaperId = b.examPaperId and b.status=1 left join parameter as c
on c.paraId = b.tagId and c.status = 1 and c.paraint = -1 and c.paraType = 5
WHERE a.status = 1
and (a.exampaperid &gt; 112 or a.exampaperid&lt;0 )
and a.isOral = #{isOral}
and a.examPaperId in
<foreach collection="paperIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
group by a.examPaperId , a.teacherId , a.title ,a.isOral
ORDER BY a.examPaperId desc
<if test="pageSize!=null">
LIMIT #{pageSize}
</if>
<if test="offset!=null">
OFFSET #{offset}
</if>
</select>
<select id="getExamPapersByTags" parameterType="java.util.Map" resultType="ExamPaper">
select * from (
select distinct ep.* from parameter p
INNER JOIN exampapertag e on p.paraid = e.tagid
INNER JOIN exampaper ep on e.exampaperid = ep.exampaperid
where p.paratype = #{paraType} and p.paraint = #{examLevelParaInt}
and p.paraid = #{paraId}
and e.status =1
and ep.status = 1 AND ep.isoral = #{isOral}
AND (ep.exampaperid &gt; 112 or ep.exampaperid &lt; 0)
<if test="title != null">
and ep.title like '%'||#{title}||'%'
</if>
<if test="regionMark ==null">
INTERSECT
select distinct ep.* from parameter p
INNER JOIN exampapertag e on p.paraid = e.tagid
INNER JOIN exampaper ep on e.exampaperid = ep.exampaperid
where p.paratype = #{paraType} and p.paraint = #{cityParaInt}
and p.valueint = #{cityAreaId}
and e.status =1
and ep.status = 1 AND ep.isoral = #{isOral}
AND (ep.exampaperid &gt; 112 or ep.exampaperid &lt; 0)
<if test="title != null">
and ep.title like '%'||#{title}||'%'
</if>
</if>
INTERSECT
select distinct ep.* from parameter p
INNER JOIN exampapertag e on p.paraid = e.tagid
INNER JOIN exampaper ep on e.exampaperid = ep.exampaperid
where p.paratype = #{paraType} and p.paraint = #{editionParaInt}
and p.valueint = #{goodsId}
and e.status =1
and ep.status = 1 AND ep.isoral = #{isOral}
AND (ep.exampaperid &gt; 112 or ep.exampaperid &lt; 0)
<if test="title != null">
and ep.title like '%'||#{title}||'%'
</if>
) a
<where>
<if test="paperIds != null">
and a.examPaperId not in
<foreach collection="paperIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
order by a.examPaperId desc
</select>
<select id="getExamPapersByTagsForDefaultArea" parameterType="java.util.Map" resultType="ExamPaper">
with temp as (
select distinct ep.exampaperid from parameter p
INNER JOIN exampapertag e on p.paraid = e.tagid
INNER JOIN exampaper ep on e.exampaperid = ep.exampaperid
where p.paratype = #{paraType} and p.paraint = #{cityParaInt}
and p.valueint = #{cityAreaId}
and e.status =1
and ep.status = 1 AND ep.isoral = #{isOral}
AND (ep.exampaperid &gt; 112 or ep.exampaperid &lt; 0)
<if test="title != null">
and ep.title like '%'||#{title}||'%'
</if>
)
select * from (
select distinct ep.* from parameter p
INNER JOIN exampapertag e on p.paraid = e.tagid
INNER JOIN exampaper ep on e.exampaperid = ep.exampaperid
where p.paratype = #{paraType} and p.paraint = #{examLevelParaInt}
and p.paraid = #{paraId}
and e.status =1
and ep.status = 1 AND ep.isoral = #{isOral}
AND (ep.exampaperid &gt; 112 or ep.exampaperid &lt; 0)
<if test="title != null">
and ep.title like '%'||#{title}||'%'
</if>
INTERSECT
select distinct ep.* from parameter p
INNER JOIN exampapertag e on p.paraid = e.tagid
INNER JOIN exampaper ep on e.exampaperid = ep.exampaperid
where p.paratype = #{paraType} and p.paraint = #{cityParaInt}
and p.valueint = #{defaultCityAreaId}
and e.status =1
and ep.status = 1 AND ep.isoral = #{isOral}
AND (ep.exampaperid &gt; 112 or ep.exampaperid &lt; 0) and ep.exampaperid not in (select exampaperid from temp)
<if test="title != null">
and ep.title like '%'||#{title}||'%'
</if>
INTERSECT
select distinct ep.* from parameter p
INNER JOIN exampapertag e on p.paraid = e.tagid
INNER JOIN exampaper ep on e.exampaperid = ep.exampaperid
where p.paratype = #{paraType} and p.paraint = #{editionParaInt}
and p.valueint = #{goodsId}
and e.status =1
and ep.status = 1 AND ep.isoral = #{isOral}
AND (ep.exampaperid &gt; 112 or ep.exampaperid &lt; 0)
<if test="title != null">
and ep.title like '%'||#{title}||'%'
</if>
) a
<where>
<if test="paperIds != null">
and a.examPaperId not in
<foreach collection="paperIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
order by a.examPaperId desc
</select>
</mapper>