159 lines
7.2 KiB
XML
159 lines
7.2 KiB
XML
|
|
<?xml version="1.0" encoding="utf-8"?>
|
||
|
|
<dynamic-sql>
|
||
|
|
<sql id="getExampaperEditList"><![CDATA[
|
||
|
|
select
|
||
|
|
et_exam_editexampaper.id,et_exam_editexampaper.edit_id,et_exam_exampaper_and_editexampaper.name,et_exam_exampaper_and_editexampaper.description,et_exam_exampaper_and_editexampaper.sc,et_exam_exampaper_and_editexampaper.state,
|
||
|
|
num,subject,type,type_num,ismust,score,optionA,optionB,optionC,optionD,optionE,optionF,isParagraph,answer
|
||
|
|
from et_exam_exampaper_and_editexampaper
|
||
|
|
inner join et_exam_editexampaper
|
||
|
|
on et_exam_exampaper_and_editexampaper.id = et_exam_editexampaper.edit_id
|
||
|
|
where <@p>edit_id</@p>
|
||
|
|
order by num asc
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="getCount"><![CDATA[
|
||
|
|
select
|
||
|
|
(select count(type_num) q_count
|
||
|
|
from et_exam_exampaper_and_editexampaper
|
||
|
|
inner join et_exam_editexampaper
|
||
|
|
on et_exam_exampaper_and_editexampaper.id = et_exam_editexampaper.edit_id
|
||
|
|
where <@p>edit_id</@p> and type_num=1) q_count1,
|
||
|
|
(select count(type_num) q_count
|
||
|
|
from et_exam_exampaper_and_editexampaper
|
||
|
|
inner join et_exam_editexampaper
|
||
|
|
on et_exam_exampaper_and_editexampaper.id = et_exam_editexampaper.edit_id
|
||
|
|
where <@p>edit_id</@p> and type_num=2) q_count2,
|
||
|
|
(select count(type_num) q_count
|
||
|
|
from et_exam_exampaper_and_editexampaper
|
||
|
|
inner join et_exam_editexampaper
|
||
|
|
on et_exam_exampaper_and_editexampaper.id = et_exam_editexampaper.edit_id
|
||
|
|
where <@p>edit_id</@p> and type_num=3) q_count3,
|
||
|
|
(select count(type_num) q_count
|
||
|
|
from et_exam_exampaper_and_editexampaper
|
||
|
|
inner join et_exam_editexampaper
|
||
|
|
on et_exam_exampaper_and_editexampaper.id = et_exam_editexampaper.edit_id
|
||
|
|
where <@p>edit_id</@p> and type_num=4) q_count4,
|
||
|
|
(select count(type_num) q_count
|
||
|
|
from et_exam_exampaper_and_editexampaper
|
||
|
|
inner join et_exam_editexampaper
|
||
|
|
on et_exam_exampaper_and_editexampaper.id = et_exam_editexampaper.edit_id
|
||
|
|
where <@p>edit_id</@p> and type_num=5) q_count5
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="insertHistoryExam"><![CDATA[
|
||
|
|
insert into et_exam_editexampaper (id,edit_id,num,subject,type,type_num,ismust,score,optionA,optionB,optionC,optionD,optionE,optionF,isParagraph,answer)
|
||
|
|
select md5(uuid()) as id,(select id from et_exam_exampaper_and_editexampaper where <@p>id</@p>) as edit_id,num,subject,type,type_num,ismust,score,optionA,optionB,optionC,optionD,optionE,optionF,isParagraph,answer
|
||
|
|
from et_exam_editexampaper
|
||
|
|
where <@p>edit_id</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="questionTypeNum"><![CDATA[
|
||
|
|
select
|
||
|
|
(select count(*) from et_exam_question where <@p>categoryid</@p> and type = '1') singlenumcheck,
|
||
|
|
(select count(*) from et_exam_question where <@p>categoryid</@p> and type = '2') multiplenumcheck,
|
||
|
|
(select count(*) from et_exam_question where <@p>categoryid</@p> and type = '3') judgementnumcheck,
|
||
|
|
(select count(*) from et_exam_question where <@p>categoryid</@p> and type = '4') blanknumcheck,
|
||
|
|
(select count(*) from et_exam_question where <@p>categoryid</@p> and type = '5') essaynumcheck
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="deleteExam"><![CDATA[
|
||
|
|
delete from et_exam_editexampaper where <@p>edit_id</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="insertRandExam"><![CDATA[
|
||
|
|
insert into et_exam_editexampaper (id,edit_id,num,subject,type,type_num,ismust,optionA,optionB,optionC,optionD,optionE,optionF,isParagraph,answer)
|
||
|
|
select id,edit_id,(@i:=@i+1) i,subject,question_type,type,ismust,optionA,optionB,optionC,optionD,optionE,optionF,isParagraph,answer
|
||
|
|
from
|
||
|
|
(
|
||
|
|
(select md5(uuid()) as id,(select id from et_exam_exampaper_and_editexampaper where <@p>id</@p>) as edit_id,subject,question_type,type,1 as ismust,optionA,optionB,optionC,optionD,optionE,optionF,0 as isParagraph,answer
|
||
|
|
from et_exam_question where <@p>categoryid</@p>
|
||
|
|
and type = 1
|
||
|
|
<@p p=" and %s">card</@p>
|
||
|
|
order by rand() limit <@p p=" ? ">singleNum</@p>)
|
||
|
|
union
|
||
|
|
(select md5(uuid()) as id,(select id from et_exam_exampaper_and_editexampaper where <@p>id</@p>) as edit_id,subject,question_type,type,1 as ismust,optionA,optionB,optionC,optionD,optionE,optionF,0 as isParagraph,answer
|
||
|
|
from et_exam_question where <@p>categoryid</@p>
|
||
|
|
and type = 2
|
||
|
|
<@p p=" and %s">card</@p>
|
||
|
|
order by rand() limit <@p p=" ? ">multipleNum</@p>)
|
||
|
|
union
|
||
|
|
(select md5(uuid()) as id,(select id from et_exam_exampaper_and_editexampaper where <@p>id</@p>) as edit_id,subject,question_type,type,1 as ismust,optionA,optionB,optionC,optionD,optionE,optionF,0 as isParagraph,answer
|
||
|
|
from et_exam_question where <@p>categoryid</@p>
|
||
|
|
and type = 3
|
||
|
|
<@p p=" and %s">card</@p>
|
||
|
|
order by rand() limit <@p p=" ? ">judgementNum</@p>)
|
||
|
|
union
|
||
|
|
(select md5(uuid()) as id,(select id from et_exam_exampaper_and_editexampaper where <@p>id</@p>) as edit_id,subject,question_type,type,1 as ismust,optionA,optionB,optionC,optionD,optionE,optionF,0 as isParagraph,answer
|
||
|
|
from et_exam_question where <@p>categoryid</@p>
|
||
|
|
and type = 4
|
||
|
|
<@p p=" and %s">card</@p>
|
||
|
|
order by rand() limit <@p p=" ? ">blankNum</@p>)
|
||
|
|
union
|
||
|
|
(select md5(uuid()) as id,(select id from et_exam_exampaper_and_editexampaper where <@p>id</@p>) as edit_id,subject,question_type,type,1 as ismust,optionA,optionB,optionC,optionD,optionE,optionF,0 as isParagraph,answer
|
||
|
|
from et_exam_question where <@p>categoryid</@p>
|
||
|
|
and type = 5
|
||
|
|
<@p p=" and %s">card</@p>
|
||
|
|
order by rand() limit <@p p=" ? ">essayNum</@p>)
|
||
|
|
) a,(select @i:=0) z
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="updateRandExamNum"><![CDATA[
|
||
|
|
update et_exam_editexampaper a,
|
||
|
|
(select (@i:=@i+1) i,id,type from et_exam_editexampaper where <@p p =" edit_id = ? ">id</@p> order by type_num) j,
|
||
|
|
(select @i:=0) z
|
||
|
|
set a.num = j.i
|
||
|
|
where a.id=j.id and <@p p =" edit_id = ? ">id</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="getExampaperReturn"><![CDATA[
|
||
|
|
select * from et_exam_exampaper_and_editexampaper
|
||
|
|
where <@p>id</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="getQuestionNum"><![CDATA[
|
||
|
|
select count(*) as num from et_exam_editexampaper
|
||
|
|
where <@p>edit_id</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
|
||
|
|
<sql id="getNumber"><![CDATA[
|
||
|
|
select count(*) as number,
|
||
|
|
(select count(*) from et_exam_editexampaper where <@p>edit_id</@p>) as sum
|
||
|
|
from et_exam_editexampaper where
|
||
|
|
<@p>edit_id</@p>
|
||
|
|
<@p p="and type_num in(%s)" f="?">type_num</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="updateOtherNumber"><![CDATA[
|
||
|
|
update et_exam_editexampaper
|
||
|
|
set <@p p ="num = ?">newnum</@p>
|
||
|
|
where <@p>edit_id</@p>
|
||
|
|
<@p p=" and %s">num</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="updateNewNumber"><![CDATA[
|
||
|
|
update et_exam_editexampaper
|
||
|
|
set <@p p ="num = ?">num</@p>
|
||
|
|
where <@p>id</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="moveOld"><![CDATA[
|
||
|
|
update et_exam_editexampaper
|
||
|
|
set <@p p ="num = ?">newnum</@p>
|
||
|
|
where
|
||
|
|
<@p>edit_id</@p>
|
||
|
|
<@p p=" and num = ?">oldnum</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="moveNew"><![CDATA[
|
||
|
|
update et_exam_editexampaper
|
||
|
|
set <@p>num</@p>
|
||
|
|
where <@p>id</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
<sql id="DeleteExamQuestion"><![CDATA[
|
||
|
|
delete from et_exam_editexampaper where
|
||
|
|
<@p p="edit_id in (%s)" f="?">edit_id</@p>
|
||
|
|
]]></sql>
|
||
|
|
|
||
|
|
</dynamic-sql>
|