301 lines
17 KiB
XML
301 lines
17 KiB
XML
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|||
|
|
<sqlMap xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/tr/xmlschema-1/" namespace="">
|
|||
|
|
<alias>
|
|||
|
|
|
|||
|
|
</alias>
|
|||
|
|
<cacheModels>
|
|||
|
|
<cacheModel id="examCache" implementation="LRU" >
|
|||
|
|
<flushInterval hours="1" />
|
|||
|
|
<property name="CacheSize" value="1000" />
|
|||
|
|
</cacheModel>
|
|||
|
|
</cacheModels>
|
|||
|
|
<resultMaps></resultMaps>
|
|||
|
|
<statements>
|
|||
|
|
<select id="exam.exams" parameterClass="hashtable" resultClass="exam">
|
|||
|
|
select a.*
|
|||
|
|
from (
|
|||
|
|
select a.exno,a.cgno,a.exname,a.infee,a.outfee,a.certcc,a.certgradecc,a.gradename,a.rstime,a.retime
|
|||
|
|
,a.fee
|
|||
|
|
,a.estime,a.eetime
|
|||
|
|
,a.certdate,a.certindate,a.elocation,a.introhtml
|
|||
|
|
,a.isscored,a.isopen,a.fgno,a.isdel,a.isresultopen
|
|||
|
|
,a.cdt,a.cno,a.udt,a.uno,a.uip
|
|||
|
|
,a.pcgno
|
|||
|
|
,a.cgname
|
|||
|
|
,a.pcgname
|
|||
|
|
,a.rno
|
|||
|
|
,a.pagetotalcount
|
|||
|
|
from (
|
|||
|
|
select a.exno,a.cgno,a.exname,a.infee,a.outfee,a.certcc,a.certgradecc,a.gradename,a.rstime,a.retime
|
|||
|
|
,a.fee
|
|||
|
|
,a.estime,a.eetime
|
|||
|
|
,a.certdate,a.certindate,a.elocation,a.introhtml
|
|||
|
|
,a.isscored,a.isopen,a.fgno,a.isdel,a.isresultopen
|
|||
|
|
,a.cdt,a.cno,a.udt,a.uno,a.uip
|
|||
|
|
,a.pcgno
|
|||
|
|
,a.cgname
|
|||
|
|
,a.pcgname
|
|||
|
|
,row_number() over(order by a.retime desc) rno
|
|||
|
|
,count(a.exno) over() pagetotalcount
|
|||
|
|
from (
|
|||
|
|
select a.exno,a.cgno,a.exname,a.infee,a.outfee,a.certcc,a.certgradecc,d.cname gradename,a.rstime,a.retime
|
|||
|
|
,case when ua.isjoin=1 then a.infee else a.outfee end fee
|
|||
|
|
,a.estime,a.eetime
|
|||
|
|
,a.certdate,a.certindate,a.elocation,a.introhtml
|
|||
|
|
,a.isscored,a.isopen,a.fgno,a.isdel,a.isresultopen
|
|||
|
|
,a.cdt,a.cno,a.udt,a.uno,a.uip
|
|||
|
|
,b.pcgno pcgno
|
|||
|
|
,b.cgname cgname
|
|||
|
|
,c.cgname pcgname
|
|||
|
|
,row_number() over(order by a.retime desc) rno
|
|||
|
|
,count(a.exno) over() pagetotalcount
|
|||
|
|
from exam a
|
|||
|
|
inner join cg b on b.cgno=a.cgno
|
|||
|
|
inner join cg c on c.cgno=b.pcgno
|
|||
|
|
inner join comcode d on d.ccode = a.certgradecc
|
|||
|
|
left outer join users u on u.userno=#userno#
|
|||
|
|
left outer join assign ua on ua.asno=u.asno
|
|||
|
|
where a.isdel = 0
|
|||
|
|
) a
|
|||
|
|
<dynamic prepend="where">
|
|||
|
|
<isNotNull property="exno" prepend ="and">a.exno=#exno#</isNotNull>
|
|||
|
|
<isNotNull property="pcgno" prepend ="and">a.pcgno=#pcgno#</isNotNull>
|
|||
|
|
<isNotNull property="cgno" prepend ="and">a.cgno=#cgno#</isNotNull>
|
|||
|
|
<isNotNull property="ename" prepend="and">a.exname like concat('%',#ename#,'%')</isNotNull>
|
|||
|
|
<isNotNull property="isopen" prepend="and">a.isopen=1</isNotNull>
|
|||
|
|
<isNotNull property="status" prepend="and">
|
|||
|
|
<isEqual property="status" compareValue="0" >a.rstime > now()</isEqual>
|
|||
|
|
<isEqual property="status" compareValue="1" >now() > a.rstime and now() < a.retime</isEqual>
|
|||
|
|
<isEqual property="status" compareValue="2" >now() > a.retime and now() < a.estime</isEqual>
|
|||
|
|
<isEqual property="status" compareValue="3" >now() > a.estime and a.isresultopen=0</isEqual>
|
|||
|
|
<isEqual property="status" compareValue="4" >a.isscored=1 and a.isresultopen=1</isEqual>
|
|||
|
|
</isNotNull>
|
|||
|
|
</dynamic>
|
|||
|
|
) a
|
|||
|
|
<include refid="sql.pagedynamic"></include>
|
|||
|
|
) a
|
|||
|
|
order by a.retime desc
|
|||
|
|
</select>
|
|||
|
|
<insert id="exam.exam.in" parameterClass="exam">
|
|||
|
|
insert into exam (cgno,exname,infee,outfee
|
|||
|
|
,certcc,certgradecc,rstime,retime,estime,eetime
|
|||
|
|
,elocation,certdate,certindate,introhtml
|
|||
|
|
,isopen,isresultopen,isscored,fgno,isdel
|
|||
|
|
,<include refid="sql.inc"></include>)
|
|||
|
|
values (#cgno#,#exname#,#infee#,#outfee#
|
|||
|
|
,#certcc#,#certgradecc#,#rstime#,#retime#,#estime#,#eetime#
|
|||
|
|
,#elocation#,#certdate#,#certindate#,#introhtml#
|
|||
|
|
,#isopen#,0,#isscored#,#fgno#,0
|
|||
|
|
,<include refid="sql.inv"></include>)
|
|||
|
|
<selectKey type="post" property="exno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
|
|||
|
|
</insert>
|
|||
|
|
<update id="exam.exam.up" parameterClass="exam">
|
|||
|
|
update exam set <include refid="sql.up"></include>
|
|||
|
|
,exname =#exname#
|
|||
|
|
,infee =#infee#
|
|||
|
|
,outfee =#outfee#
|
|||
|
|
,certcc =#certcc#
|
|||
|
|
,certgradecc =#certgradecc#
|
|||
|
|
,rstime =#rstime#
|
|||
|
|
,retime =#retime#
|
|||
|
|
,estime =#estime#
|
|||
|
|
,eetime =#eetime#
|
|||
|
|
,elocation =#elocation#
|
|||
|
|
,certdate =#certdate#
|
|||
|
|
,certindate =#certindate#
|
|||
|
|
,introhtml =#introhtml#
|
|||
|
|
,isopen =#isopen#
|
|||
|
|
,fgno =#fgno#
|
|||
|
|
where exno=#exno#
|
|||
|
|
</update>
|
|||
|
|
<update id="exam.del" parameterClass="hashtable">
|
|||
|
|
<!--update exam set isdel=1,uno=#uno#,uip=#uip# where exno=#exno#-->
|
|||
|
|
update exam a
|
|||
|
|
inner join (
|
|||
|
|
select count(userno) cntuser, exno
|
|||
|
|
from examuser
|
|||
|
|
where exno = #exno#
|
|||
|
|
group by exno
|
|||
|
|
) b on b.exno=a.exno
|
|||
|
|
set a.uip=#uip#
|
|||
|
|
,a.uno=#uno#
|
|||
|
|
,a.isdel = 1
|
|||
|
|
where a.exno=#exno# and b.cntuser=0 and a.isdel=0;
|
|||
|
|
</update>
|
|||
|
|
<select id="exam.examusers" parameterClass="hashtable" resultClass="examuser">
|
|||
|
|
select a.*
|
|||
|
|
from (
|
|||
|
|
select a.exno,a.userno,a.status,a.pstatus,a.epoint1,a.epoint2,a.epoint3,a.avrg
|
|||
|
|
,a.ispass,a.certdate,a.certindate,a.cdt,a.cno,a.udt,a.uno,a.uip
|
|||
|
|
,a.isscored,a.certcc,a.certgradecc
|
|||
|
|
,a.username,a.userid,a.usernameeng,a.userpno
|
|||
|
|
,a.asname
|
|||
|
|
,a.rno
|
|||
|
|
,a.pagetotalcount
|
|||
|
|
,(a.countesame + a.countlsame) as countsame
|
|||
|
|
from (
|
|||
|
|
select a.exno,a.userno,a.status,a.pstatus,a.epoint1,a.epoint2,a.epoint3,a.avrg
|
|||
|
|
,a.ispass,a.certdate,a.certindate,a.cdt,a.cno,a.udt,a.uno,a.uip
|
|||
|
|
,b.isscored,b.certcc,b.certgradecc
|
|||
|
|
,c.username,c.userid,c.usernameeng,CAST(AES_DECRYPT(UNHEX(c.userpno),<include refid="sql.digest"></include>) as char) userpno
|
|||
|
|
,d.asname
|
|||
|
|
,row_number() over(order by a.cdt desc) rno
|
|||
|
|
,count(a.exno) over() pagetotalcount
|
|||
|
|
,count(f.exno) countesame
|
|||
|
|
,count(h.lectno) countlsame
|
|||
|
|
from examuser a
|
|||
|
|
inner join exam b on b.exno=a.exno
|
|||
|
|
inner join users c on c.userno=a.userno and c.status = 1
|
|||
|
|
left outer join assign d on d.asno = c.asno
|
|||
|
|
left outer join exam e on e.certcc=b.certcc and e.certgradecc=b.certgradecc and e.exno<>b.exno
|
|||
|
|
left outer join examuser f on f.exno=e.exno and f.userno=a.userno and f.pstatus=1 and f.ispass is not null
|
|||
|
|
left outer join cm g on g.certcc = b.certcc and g.certgradecc=b.certgradecc
|
|||
|
|
left outer join lect h on h.userno=a.userno and h.cmno=g.cmno and h.status<5 and h.ischanged=0
|
|||
|
|
<dynamic prepend="where">
|
|||
|
|
<isNotNull property="exno" prepend ="and">a.exno=#exno#</isNotNull>
|
|||
|
|
<isNotNull property="userno" prepend ="and">a.userno =#userno#</isNotNull>
|
|||
|
|
<isNotNull property="usernos" prepend ="and">a.userno in ($usernos$)</isNotNull>
|
|||
|
|
<isNotNull property="pstatus" prepend ="and">a.pstatus=#pstatus#</isNotNull>
|
|||
|
|
<isNotNull property="pstatus24" prepend ="and">a.pstatus in(2,4)</isNotNull>
|
|||
|
|
<isNotNull property="pstatus89" prepend ="and">a.pstatus in(8,9)</isNotNull>
|
|||
|
|
<isNotNull property="username" prepend ="and">c.username=#pstatus#</isNotNull>
|
|||
|
|
<isNotNull property="userid" prepend ="and">c.userid=#pstatus#</isNotNull>
|
|||
|
|
<isNotNull property="certcc"><isGreaterThan compareValue="0" property="certcc" prepend ="and">b.certcc=#certcc#</isGreaterThan></isNotNull>
|
|||
|
|
<isNotNull property="certgradecc"><isGreaterThan compareValue="0" property="certgradecc" prepend ="and">b.certgradecc=#certgradecc#</isGreaterThan></isNotNull>
|
|||
|
|
<isNotNull property="certdate" prepend="and">
|
|||
|
|
a.certindate > #certdate#
|
|||
|
|
</isNotNull>
|
|||
|
|
<isNotNull property="certindate" prepend="and">
|
|||
|
|
a.certindate < #certindate#
|
|||
|
|
</isNotNull>
|
|||
|
|
<!--<isNotNull property="certdate" prepend="and">
|
|||
|
|
<isNull property="certindate">
|
|||
|
|
a.certdate > #certdate#
|
|||
|
|
</isNull>
|
|||
|
|
<isNotNull property="certindate">
|
|||
|
|
a.certdate > #certdate# and a.certindate < #certindate#
|
|||
|
|
</isNotNull>
|
|||
|
|
</isNotNull>-->
|
|||
|
|
<isNotNull property="cnamelike">
|
|||
|
|
<isNull property="searchcon" prepend="and">
|
|||
|
|
(c.username like concat('%',#cnamelike#,'%') or c.userid like concat('%',#cnamelike#,'%'))
|
|||
|
|
</isNull>
|
|||
|
|
<isNotNull property="searchcon" prepend="and">
|
|||
|
|
<isEqual property="searchcon" compareValue="1">c.username like concat('%',#cnamelike#,'%')</isEqual>
|
|||
|
|
<isEqual property="searchcon" compareValue="2">c.userid like concat('%',#cnamelike#,'%')</isEqual>
|
|||
|
|
</isNotNull>
|
|||
|
|
</isNotNull>
|
|||
|
|
<isNotNull property="ispass">
|
|||
|
|
<isEqual property="ispass" prepend = "and" compareValue="-1">a.ispass is null</isEqual>
|
|||
|
|
<isEqual property="ispass" prepend = "and" compareValue="1">a.ispass = 1</isEqual>
|
|||
|
|
<isEqual property="ispass" prepend = "and" compareValue="0">a.ispass = 0</isEqual>
|
|||
|
|
</isNotNull>
|
|||
|
|
</dynamic>
|
|||
|
|
group by a.exno,a.userno,a.status,a.pstatus,a.epoint1,a.epoint2,a.epoint3,a.avrg
|
|||
|
|
,a.ispass,a.certdate,a.certindate,a.cdt,a.cno,a.udt,a.uno,a.uip
|
|||
|
|
,b.isscored,b.certcc,b.certgradecc
|
|||
|
|
,c.username,c.userid,c.usernameeng,userpno
|
|||
|
|
,d.asname
|
|||
|
|
<isNotNull property="resultview">
|
|||
|
|
order by d.asname desc,c.username desc
|
|||
|
|
</isNotNull>
|
|||
|
|
) a
|
|||
|
|
) a
|
|||
|
|
<include refid="sql.pagedynamic"></include>
|
|||
|
|
order by a.rno
|
|||
|
|
</select>
|
|||
|
|
<update id="exam.examuser.save" parameterClass="hashtable">
|
|||
|
|
insert ignore into examuser(exno,userno,status,pstatus,avrg,certdate,certindate,cdt,cno,udt,uno,uip)
|
|||
|
|
values (#exno#,#userno#,#status#,#pstatus#,#avrg#,#certdate#,#certindate#,<include refid="sql.inv"></include>)
|
|||
|
|
</update>
|
|||
|
|
<update id="exam.examuser.del" parameterClass="hashtable">
|
|||
|
|
insert into examuserdelbk(exno,userno,status,payno,pino,pstatus,epoint1,epoint2,epoint3,avrg,ispass,certdate,certindate,cdt,cno,udt,uno,uip)
|
|||
|
|
select exno,userno,status,payno,pino,pstatus,epoint1,epoint2,epoint3,avrg,ispass,certdate,certindate,now(),cno,udt,uno,uip
|
|||
|
|
from examuser a
|
|||
|
|
where a.exno=#exno# and a.userno in ($usernos$) and a.pstatus in(4,8);
|
|||
|
|
|
|||
|
|
delete from examuser
|
|||
|
|
where exno=#exno# and userno in (
|
|||
|
|
select a.userno
|
|||
|
|
from (
|
|||
|
|
select a.userno
|
|||
|
|
from examuser a
|
|||
|
|
where a.exno=#exno# and a.userno in ($usernos$) and a.pstatus in(4,8)
|
|||
|
|
) a
|
|||
|
|
)
|
|||
|
|
</update>
|
|||
|
|
<update id="exam.examuser.regbatch" parameterClass="examuser">
|
|||
|
|
insert into examuser(exno,userno,status,pstatus,avrg,certdate,certindate,cdt,cno,udt,uno,uip)
|
|||
|
|
<iterate property="Ds" open="" conjunction="union all" close="">
|
|||
|
|
select #exno# exno,#Ds[].userno# userno,#Ds[].status# status,#Ds[].pstatus# pstatus,#Ds[].avrg# avrg,#certdate# certdate,#certindate# certindate,now() cdt,#uno# cno,now() udt,#uno# uno,#uip# uip
|
|||
|
|
</iterate>
|
|||
|
|
</update>
|
|||
|
|
<update id="exam.examuserbatch" parameterClass="examuser">
|
|||
|
|
update examuser a
|
|||
|
|
inner join (
|
|||
|
|
<iterate property="Ds" open ="" conjunction="union all" close="">
|
|||
|
|
select #exno# exno,#Ds[].userno# userno,#Ds[].epoint1# epoint1,#Ds[].epoint2# epoint2,#Ds[].epoint3# epoint3,#Ds[].avrg# avrg,#Ds[].ispass# ispass
|
|||
|
|
</iterate>
|
|||
|
|
) b on b.userno=a.userno
|
|||
|
|
set a.epoint1=b.epoint1,a.epoint2=b.epoint2,a.epoint3=b.epoint3,a.avrg=b.avrg,a.ispass=b.ispass
|
|||
|
|
,a.udt=now(),a.uno=#uno#,a.uip=#uip#
|
|||
|
|
where a.exno=#exno#;
|
|||
|
|
|
|||
|
|
update exam set <include refid="sql.up"></include>,isscored=1 where exno=#exno#;
|
|||
|
|
|
|||
|
|
insert into examuserrenew (exno,userno,certtime,certdate,certindate,renewreason,certidx,isfirst,<include refid="sql.inc"></include>)
|
|||
|
|
select a.exno,a.userno,now(),a2.certdate,a2.certindate,'시험합격',row_number() over (order by a.cdt) + ifnull(max(d.certidx), 0),1,<include refid="sql.inv"></include>
|
|||
|
|
from examuser a
|
|||
|
|
inner join exam a2 on a2.exno=a.exno
|
|||
|
|
left outer join examuserrenew b on b.exno=a.exno and b.userno=a.userno
|
|||
|
|
left outer join exam c on c.certcc=a2.certcc and c.certgradecc=a2.certgradecc
|
|||
|
|
left outer join examuserrenew d on d.exno=c.exno and year(d.certtime)=year(a2.certdate)
|
|||
|
|
where a.exno=#exno# and a.pstatus=1 and a.ispass=1 and b.exno is null
|
|||
|
|
group by a.exno,a.userno,a2.certdate,a2.certindate
|
|||
|
|
</update>
|
|||
|
|
<update id="exam.examopen" parameterClass="hashtable">
|
|||
|
|
update exam set <include refid="sql.up"></include>,isresultopen=#isresultopen# where exno=#exno#;
|
|||
|
|
</update>
|
|||
|
|
<select id="exam.examuserrenews" parameterClass="hashtable" resultClass="examuserrenew">
|
|||
|
|
select a.exno,a.userno,a.certtime,a.certdate,a.certindate,a.renewreason,a.cdt,a.isfirst,a.certidx
|
|||
|
|
,b.username,c.username cnoname
|
|||
|
|
,row_number() over(order by a.certtime asc) rno
|
|||
|
|
from examuserrenew a
|
|||
|
|
inner join users b on b.userno = a.userno
|
|||
|
|
left outer join users c on c.userno=a.cno
|
|||
|
|
<dynamic prepend="where">
|
|||
|
|
<isNotNull property="exno" prepend ="and">a.exno=#exno#</isNotNull>
|
|||
|
|
<isNotNull property="userno" prepend ="and">a.userno=#userno#</isNotNull>
|
|||
|
|
<isNotNull property="usernos" prepend ="and">a.userno in ($usernos$)</isNotNull>
|
|||
|
|
</dynamic>
|
|||
|
|
group by a.exno,a.userno,a.certtime,a.certdate,a.certindate,a.renewreason,a.cdt
|
|||
|
|
,b.username
|
|||
|
|
,c.username
|
|||
|
|
<isNotNull property="isprint">
|
|||
|
|
order by a.certtime asc
|
|||
|
|
</isNotNull>
|
|||
|
|
<isNull property="isprint">
|
|||
|
|
order by a.certdate desc
|
|||
|
|
<isNotNull property="orderby">
|
|||
|
|
,a.certtime desc
|
|||
|
|
</isNotNull>
|
|||
|
|
</isNull>
|
|||
|
|
</select>
|
|||
|
|
<update id="exam.examuser.renew" parameterClass="hashtable">
|
|||
|
|
update examuser set <include refid="sql.up"></include>,certdate=#certdate#,certindate=#certindate#
|
|||
|
|
where exno=#exno# and userno=#userno#;
|
|||
|
|
|
|||
|
|
insert into examuserrenew (exno,userno,certtime,certdate,certindate,renewreason,isfirst,certidx,<include refid="sql.inc"></include>)
|
|||
|
|
select a.exno,#userno#,now(),#certdate#,#certindate#,#renewreason#,0,max(a.certidx),now(),#uno#,now(),#uno#,#uip#
|
|||
|
|
from(
|
|||
|
|
select a.exno,ifnull(max(d.certidx), 0)+1 certidx
|
|||
|
|
from examuser a
|
|||
|
|
inner join exam a2 on a2.exno=a.exno
|
|||
|
|
left outer join exam c on c.certcc=a2.certcc and c.certgradecc=a2.certgradecc
|
|||
|
|
left outer join examuserrenew d on d.exno=c.exno and year(d.certtime)=year(a.certdate)
|
|||
|
|
where a.exno=#exno#
|
|||
|
|
group by a.exno,a.userno,a.certdate,a.certindate
|
|||
|
|
) a
|
|||
|
|
</update>
|
|||
|
|
</statements>
|
|||
|
|
</sqlMap>
|