2020-10-12 14:39:23 +09:00
<?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 >
2020-12-22 17:37:18 +09:00
<typeAlias alias= "document" type= "NP.Model.document, NP.Model" />
<typeAlias alias= "textvalue" type= "NP.Model.textvalue, NP.Model" />
2020-10-12 14:39:23 +09:00
</alias>
<cacheModels >
<cacheModel id= "croomCache" implementation= "LRU" >
<flushInterval hours= "1" />
<property name= "CacheSize" value= "1000" />
</cacheModel>
</cacheModels>
<resultMaps > </resultMaps>
<statements >
<select id= "cr.main.mygrade" parameterClass= "hashtable" resultClass= "lect" >
2021-01-28 17:16:49 +09:00
select b.lectno, b.isrebate,b.iscomplete,b.attrate
2020-10-12 14:39:23 +09:00
,a.apoint
,a.ex0cnt,a.ex0lectcnt,a.ex0lectpoint,a.mpoint
,a.ex1cnt,a.ex1lectcnt,a.ex1lectpoint,a.fpoint
,a.sd0cnt,a.sd0lectcnt,a.sd0lectpoint,a.spoint
,a.sd1cnt,a.sd1lectcnt,a.sd1lectpoint,a.dpoint
,a.rs0cnt,a.rs0lectcnt,a.rs0lectpoint
,case when b.isrebate = 1 then d.attendcutrfd else d.attendcut end acut
,case when b.isrebate = 1 then d.midcutrfd else d.midcut end mcut
,case when b.isrebate = 1 then d.finalcutrfd else d.finalcut end fcut
,case when b.isrebate = 1 then d.subjectcutrfd else d.subjectcut end scut
,case when b.isrebate = 1 then d.discusscutrfd else d.discusscut end dcut
,case when b.isrebate = 1 then d.cutrfd else d.cut end cut
,case when b.isrebate = 1 then d.attendrfd else d.attend end attend
,case when b.isrebate = 1 then d.midrfd else d.mid end mid
,case when b.isrebate = 1 then d.finalrfd else d.final end final
,case when b.isrebate = 1 then d.subjectrfd else d.subject end subject
,case when b.isrebate = 1 then d.discussrfd else d.discuss end discuss
,case when b.isrebate = 1 then d.attendrfd else d.attend end aportion
,case when b.isrebate = 1 then d.midrfd else d.mid end mportion
,case when b.isrebate = 1 then d.finalrfd else d.final end fportion
,case when b.isrebate = 1 then d.subjectrfd else d.subject end sportion
,case when b.isrebate = 1 then d.discussrfd else d.discuss end dportion
from (
<include refid= "grade.query" > </include>
) a
inner join lect b on b.lectno=a.lectno
inner join users u on u.userno=b.userno
inner join cmev d on d.cmno=b.cmno
</select>
<select id= "cr.main.boardalarm" parameterClass= "hashtable" resultClass= "data" >
select a.*
from (
2020-10-13 16:10:18 +09:00
select a.*
from (
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3,a.strval4
,a.time,a.time2
,a.rno
from (
select 3 dtype
,2 intval,c.iseq intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7
,a.lectno longval
,b.cname strval,b.studyplace strval2,concat(date_format(c.idate,'%m/%d'),' ',left(c.ist,2),':',right(c.ist,2),' ~ ',left(c.iet,2),':',right(c.iet,2)) strval3,bc.cname strval4
2021-01-27 17:23:51 +09:00
,a.sdate time,a.edate time2
2020-10-13 16:10:18 +09:00
,row_number() over(partition by a.cmno order by c.iseq) rno2
,row_number() over(order by b.setime) rno
from lect a
inner join cm b on b.cmno=a.cmno and b.sstime < <include refid= "sql.now" > </include> and b.setime > <include refid= "sql.now" > </include> and b.cshape=1
left outer join comcode bc on bc.ccode=b.studyplace
inner join cminning c on c.cmno=b.cmno and c.isonline=0
<!-- left outer join lectinning d on d.lectno=a.lectno and d.cmino=c.cmino and d.istatus=2 -->
where a.lectno=#lectno# and a.userno=#userno# and a.status=1 and a.ischanged=0
) a
where a.rno2=1
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3,a.strval4
,a.time,a.time2
,a.rno
from (
select 3 dtype
,3 intval,0 intval2,b.classno intval3,c.extype intval4,0 intval5,0 intval6,a.cmno intval7
,a.lectno longval
,b.cname strval,b.studyplace strval2,null strval3,bc.cname strval4
2021-01-27 17:23:51 +09:00
,a.sdate time,a.edate time2
2020-10-13 16:10:18 +09:00
,row_number() over(partition by a.cmno order by c.extype,c.cdt) rno2
,row_number() over(order by b.setime) rno
from lect a
inner join cm b on b.cmno=a.cmno and b.sstime < <include refid= "sql.now" > </include> and b.setime > <include refid= "sql.now" > </include>
left outer join comcode bc on bc.ccode=b.studyplace
inner join cmex c on c.cmno=b.cmno and c.isdel=0 and c.econdition < = a.attrate
left outer join lectex d on d.lectno=a.lectno and d.exno=c.exno and d.eend is not null
where a.lectno=#lectno# and a.userno=#userno# and a.status=1 and a.ischanged=0 and d.lectno is null
) a
where a.rno2=1
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3,a.strval4
,a.time,a.time2
,a.rno
from (
select 3 dtype
,4 intval,0 intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7
,a.lectno longval
,b.cname strval,b.studyplace strval2,null strval3,bc.cname strval4
2021-01-27 17:23:51 +09:00
,a.sdate time,a.edate time2
2020-10-13 16:10:18 +09:00
,row_number() over(partition by a.cmno order by c.cdt) rno2
,row_number() over(order by b.setime) rno
from lect a
inner join cm b on b.cmno=a.cmno and b.sstime < <include refid= "sql.now" > </include> and b.setime > <include refid= "sql.now" > </include>
left outer join comcode bc on bc.ccode=b.studyplace
inner join cmsd c on c.sdtype=0 and c.cmno=b.cmno and c.isdel=0 and c.sdcondition < = a.attrate
left outer join lectsd d on d.lectno=a.lectno and d.sdno=c.sdno and d.submittime is not null
where a.lectno=#lectno# and a.userno=#userno# and a.status=1 and a.ischanged=0 and d.lectno is null
) a
where a.rno2=1
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3,a.strval4
,a.time,a.time2
,a.rno
from (
select 3 dtype
,5 intval,0 intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7
,a.lectno longval
,b.cname strval,b.studyplace strval2,null strval3,bc.cname strval4
2021-01-27 17:23:51 +09:00
,a.sdate time,a.edate time2
2020-10-13 16:10:18 +09:00
,row_number() over(partition by a.cmno order by c.cdt) rno2
,row_number() over(order by b.setime) rno
from lect a
inner join cm b on b.cmno=a.cmno and b.sstime < <include refid= "sql.now" > </include> and b.setime > <include refid= "sql.now" > </include>
left outer join comcode bc on bc.ccode=b.studyplace
inner join cmsd c on c.sdtype=1 and c.cmno=b.cmno and c.isdel=0 and c.sdcondition < = a.attrate
left outer join lectsdboard d on d.lectno=a.lectno and d.sdno=c.sdno and d.isdel=0
where a.lectno=#lectno# and a.userno=#userno# and a.status=1 and a.ischanged=0
group by b.classno,a.cmno,a.lectno,b.cname,b.studyplace,b.sstime,b.setime,c.cdt,bc.cname
having count(d.lectno) < 1
) a
where a.rno2=1
) a
limit 3
2020-10-12 14:39:23 +09:00
) a
<isNotNull property= "bmnos" >
union all
select a.*
from (
select 100 dtype,a.bmno intval,0 intval2,0 intval3,0 intval4,0 intval5,0 intval6,0 intval7
2020-11-05 17:44:46 +09:00
,a.bno longval,0 longval2
,b.bmname strval,a.subject strval2,null strval3,null strval4
,a.cdt time,null time2
,row_number() over(order by a.cdt desc) rno
2020-10-12 14:39:23 +09:00
from board a
inner join boardmaster b on b.bmno=a.bmno
where a.bmno in ($bmnos$) and a.isdel=0 and a.issecr=0 and a.isopen=1 and a.cmno=#cmno#
order by a.cdt desc
limit 3
) a
</isNotNull>
</select>
<select id= "cr.cminnings" parameterClass= "hashtable" resultClass= "lectinning" >
select a.lectno,a.cmno,a.isrebate
2021-01-22 15:06:01 +09:00
,a2.isseq,a2.cshape
,case when a.sdate is null then a2.sstime else a.sdate end as sdate
,case when a.edate is null then a2.setime else a.edate end as edate
2020-10-12 14:39:23 +09:00
,b.cmino,b.iseq,b.isonline,b.ititle,b.sttime,b.idate,b.ist,b.iet,b.icontent
2021-01-22 15:06:01 +09:00
,scd.estart,scd.eend,com.cname
2020-10-12 14:39:23 +09:00
,cp.istatus preistatus
2020-12-14 13:39:56 +09:00
,c.totstudy,c.istatus,c.stime, c.lectno existslectinning
2020-10-12 14:39:23 +09:00
,case when b.isonline=1 then d.tfurl else null end tfurl
,case when b.isonline=1 then df.fileurl else df3.fileurl end fileurl
,case when b.isonline=1 then df.fileno else df3.fileno end fileno
<!-- ,concat('/', d.ccode, '/', e.srcp) tasteurl -->
,df2.fileurl tasteurl
from lect a
inner join cm a2 on a2.cmno=a.cmno
inner join cminning b on b.cmno=a2.cmno
left outer join lectinning c on c.lectno=a.lectno and c.cmino=b.cmino
left outer join cminning bp on bp.cmno=b.cmno and bp.iseq=b.iseq-1
left outer join lectinning cp on cp.lectno=a.lectno and cp.cmino=bp.cmino
left outer join ct d on b.isonline = 1 and d.ctno=b.ctno <!-- and d.ctype=0 -->
left outer join fileinfo df2 on b.isonline=1 and df2.fgno=d.fgnothumb and df2.isdel=0
left outer join fileinfo df on b.isonline=1 and df.fgno=d.fgnotf and df.isdel=0
left outer join fileinfo df3 on b.isonline=0 and df3.fgno=b.fgnotf and df3.isdel=0
left outer join ctpage e on e.ctno=d.ctno and e.pseq=1
2021-01-22 15:06:01 +09:00
left outer join cminningscd scd on a.cmisno = scd.cmisno
left outer join comcode com on scd.studyplace = com.ccode
2020-10-12 14:39:23 +09:00
where a.lectno=#lectno# and a.userno=#userno#
<isNotNull property= "notstudy" > and ifnull(c.istatus,0) < 2 and a2.sstime < now() and a2.setime > now()</isNotNull>
order by b.iseq
<isNotNull property= "limit" > limit $limit$</isNotNull>
</select>
<select id= "cr.lectinnings" parameterClass= "hashtable" resultClass= "lectinning" >
2020-12-14 13:39:56 +09:00
select a.lectno,a.cmino,a.finishtime,a.istatus
from lectinning a
where a.lectno=#lectno#
<isNotNull property= "isfinishtoday" >
2021-05-04 13:21:10 +09:00
and (a.istatus=2 and a.finishtime is not null and date_format(a.finishtime, '%y%m%d')=date_format(now(), '%y%m%d'))</isNotNull>
2020-10-12 14:39:23 +09:00
</select>
<insert id= "cr.lectinningpage.in" parameterClass= "lectinningpage" >
update lectinning a
inner join lect b on b.lectno=a.lectno and b.userno=#userno#
inner join cminning cmi on cmi.cmino=a.cmino
inner join ctpage ctp on ctp.ctno=cmi.ctno and ctp.isdel=0
<isGreaterThan property= "pseq" compareValue= "0" > and ctp.pseq=#pseq#</isGreaterThan>
<isGreaterThan property= "cpno" compareValue= "0" > and ctp.cpno=#cpno#</isGreaterThan>
<isGreaterThan property= "isrelay" compareValue= "0" > and ctp.pseq=a.pseq</isGreaterThan>
set a.etime=now(),a.eip=now(),a.ispce=#ispc#
,a.pseq=ctp.pseq
,a.psec=case when a.pseq=ctp.pseq then a.psec else 0 end
,a.udt=now(),a.uno=#uno#,a.uip=#uip#
where a.lectno=#lectno# and a.cmino=#cmino#;
insert into lectinning (lectno,cmino,totstudy,stime,etime,istatus,finishtime,sip,eip,ispcs,ispce,pseq,psec,<include refid= "sql.inc" > </include> )
select #lectno#,a.cmino,0,now(),now(),case when a.atime=0 then 2 else 0 end,case when a.atime=0 then now() else null end,#uip#,#uip#,#ispc#,#ispc#,ctp.pseq,0,<include refid= "sql.inv" > </include>
from cminning a
inner join ctpage ctp on ctp.ctno=a.ctno and ctp.isdel=0
<isGreaterThan property= "pseq" compareValue= "0" > and ctp.pseq=#pseq#</isGreaterThan>
<isGreaterThan property= "cpno" compareValue= "0" > and ctp.cpno=#cpno#</isGreaterThan>
<isGreaterThan property= "isrelay" compareValue= "0" > and ctp.pseq=1</isGreaterThan>
left outer join lectinning b on b.lectno=#lectno# and b.cmino=#cmino#
where a.cmino=#cmino# and b.lectno is null;
update lect a
inner join (
select a.lectno,truncate(count(c.lectno) / count(b.cmino) * 100, 0) attrate
from lect a
inner join cminning b on b.cmno=a.cmno
left outer join lectinning c on c.lectno=a.lectno and c.cmino=b.cmino and c.istatus=2
where a.lectno=#lectno# and a.userno=#userno#
group by a.lectno
) b on b.lectno=a.lectno
set a.attrate=b.attrate
,a.stime=case when a.stime is null then now() else a.stime end
,a.etime=now()
,a.sip=case when a.sip is null then #uip# else a.sip end
,a.eip=#uip#
,a.ispcs=case when a.ispcs is null then #ispc# else a.ispcs end
,a.ispce=#ispc#
,udt=now(),uno=#uno#,uip=#uip#
where a.lectno=#lectno# and a.userno=#userno#;
SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0;
insert into lectinningpage(lectno,cmino,cpno,totstudy,stime,etime,sip,eip,ispc,webkitinfo,<include refid= "sql.inc" > </include> )
select b.lectno,a.cmino,p.cpno,0,now(),now(),#uip#,#uip#,#ispc#,#webkitinfo#,<include refid= "sql.inv" > </include>
from cminning a
inner join lectinning li on li.lectno=#lectno# and li.cmino=a.cmino
inner join ct ct on ct.ctno=a.ctno
inner join ctpage p on p.ctno=ct.ctno and p.isdel=0
<isGreaterThan property= "pseq" compareValue= "0" > and p.pseq=#pseq#</isGreaterThan>
<isGreaterThan property= "cpno" compareValue= "0" > and p.cpno=#cpno#</isGreaterThan>
<isGreaterThan property= "isrelay" compareValue= "0" > and p.pseq=li.pseq</isGreaterThan>
2021-01-26 10:17:53 +09:00
inner join lect b on b.lectno=#lectno# and b.userno=#userno# and b.cmno=a.cmno and b.status=1 and b.ischanged=0 and b.sdate < now()
<!-- inner join cm c on c.cmno=b.cmno and c.sstime < now() and c.setime > now() -->
2020-10-12 14:39:23 +09:00
where a.cmino=#cmino#
<selectKey type= "post" property= "logno" resultClass= "long" > SELECT last_insert_id()</selectKey>
</insert>
<select id= "cr.ctps" parameterClass= "hashtable" resultClass= "ctp" >
select a.cmino,a.iseq,a.ititle,a.atime,a.mstime,a.metime
,a2.isokmid
,b.ctno,b.ctype,b.ccode,b.ismenu,b.isoversize
,c.cpno,c.pseq,c.cpname,c.srcp,c.srcm
,a2.pseq lastpseq,a2.psec
from cminning a
inner join lectinning a2 on a2.lectno=#lectno# and a2.cmino=a.cmino
inner join ct b on b.ctno=a.ctno and b.isdel=0
inner join ctpage c on c.ctno=b.ctno and c.isdel=0
where a.cmino=#cmino#
order by a.iseq
</select>
2020-11-03 15:54:31 +09:00
<select id= "cr.getprogress" parameterClass= "hashtable" resultClass= "int" >
select case when b.atime=0 then 100
else case when floor(a.totstudy / (b.sttime * 60) * 100) > 100 then 100 else floor(a.totstudy / (b.sttime * 60) * 100) end end
from lectinning a
inner join cminning b on b.cmino=a.cmino
where a.lectno=#lectno# and a.cmino=#cmino#
2021-04-15 16:13:10 +09:00
</select>
2021-01-26 10:17:53 +09:00
<select id= "cr.checklectdate" parameterClass= "hashtable" resultClass= "lect" >
2021-04-15 16:13:10 +09:00
select a.lectno,a.sdate,a.edate
from lect a
where a.lectno=#lectno#
2021-01-26 10:17:53 +09:00
</select>
2020-10-12 14:39:23 +09:00
<update id= "cr.studylog" parameterClass= "hashtable" >
update lectinningpage a
inner join lect b on b.lectno=a.lectno and b.userno=#userno#
set a.totstudy=TIMESTAMPDIFF(SECOND, a.stime, now()),a.etime=now(),a.eip=#uip#,a.udt=now(),a.uno=#uno#,a.uip=#uip#
where a.logno=#logno#;
update lectinning a
inner join lect b on b.lectno=a.lectno and b.userno=#userno#
inner join cminning c on c.cmino=a.cmino
inner join (
select lectno,sum(totstudy) totstudy from lectinningpage where lectno=#lectno# and cmino=#cmino# group by lectno
) d on d.lectno=a.lectno
set a.udt=now(),a.uno=#uno#,a.uip=#uip#
,a.totstudy=d.totstudy
,a.etime=now()
,a.istatus=case when a.istatus < > 2 and c.atime * 60 < = d.totstudy then 2 else a.istatus end
,a.finishtime=case when a.finishtime is null and c.atime * 60 < = d.totstudy then now() else null end
,a.eip=#uip#,a.ispce=#ispc#
,a.psec=#psec#
where a.lectno=#lectno# and a.cmino=#cmino#;
update lect a
inner join (
select a.lectno,truncate(count(c.lectno) / count(b.cmino) * 100, 0) attrate
from lect a
inner join cminning b on b.cmno=a.cmno
left outer join lectinning c on c.lectno=a.lectno and c.cmino=b.cmino and c.istatus=2
where a.lectno=#lectno# and a.userno=#userno#
group by a.lectno
) b on b.lectno=a.lectno
set a.attrate=b.attrate
,a.etime=now()
,a.eip=#uip#
,a.ispce=#ispc#
,udt=now(),uno=#uno#,uip=#uip#
where a.lectno=#lectno# and a.userno=#userno#;
</update>
<select id= "cr.inningchange.pre" parameterClass= "hashtable" resultClass= "lectinning" >
select a.cmino,b.isseq,c.istatus,d.istatus preistatus,a.isrebate,a.iseq,a2.cmino precmino
from (
select a.lectno,a.cmno,a.isrebate,b.cmino,b.iseq,max(c.iseq) preiseq
from (
select a.lectno,b.cmno,b.isrebate,max(d.iseq) iseq
from lectinning a
inner join lect b on b.lectno=a.lectno
inner join cminning c on c.cmino=a.cmino
inner join cminning d on d.cmno=c.cmno and d.iseq < c.iseq and d.isonline=1
where a.lectno=#lectno# and a.cmino=#cmino#
group by a.lectno,b.cmno,b.isrebate
) a
inner join cminning b on b.cmno=a.cmno and b.iseq=a.iseq
left outer join cminning c on c.cmno=b.cmno and c.iseq < b.iseq and c.isonline=1
group by a.lectno,a.cmno,a.isrebate,b.cmino,b.iseq
) a
inner join cm b on b.cmno=a.cmno
left outer join cminning a2 on a2.cmno=b.cmno and a2.iseq=a.preiseq
left outer join lectinning c on c.lectno=a.lectno and c.cmino=a.cmino
left outer join lectinning d on d.lectno=a.lectno and d.cmino=a2.cmino
</select>
<select id= "cr.inningchange.next" parameterClass= "hashtable" resultClass= "lectinning" >
select a.cmino,b.isseq,c.istatus,d.istatus preistatus,a.isrebate,a.iseq,a2.cmino precmino
from (
select a.lectno,a.cmno,a.isrebate,b.cmino,b.iseq,min(c.iseq) preiseq
from (
select a.lectno,b.cmno,b.isrebate,min(d.iseq) iseq
from lectinning a
inner join lect b on b.lectno=a.lectno
inner join cminning c on c.cmino=a.cmino
inner join cminning d on d.cmno=c.cmno and d.iseq > c.iseq and d.isonline=1
where a.lectno=#lectno# and a.cmino=#cmino#
group by a.lectno,b.cmno,b.isrebate
) a
inner join cminning b on b.cmno=a.cmno and b.iseq=a.iseq
left outer join cminning c on c.cmno=b.cmno and c.iseq > b.iseq and c.isonline=1
group by a.lectno,a.cmno,a.isrebate,b.cmino,b.iseq
) a
inner join cm b on b.cmno=a.cmno
left outer join cminning a2 on a2.cmno=b.cmno and a2.iseq=a.preiseq
left outer join lectinning c on c.lectno=a.lectno and c.cmino=a.cmino
left outer join lectinning d on d.lectno=a.lectno and d.cmino=a2.cmino
</select>
<select id= "cr.ctpage.iframe" parameterClass= "hashtable" resultClass= "string" >
select $src$ from ctpage where cpno=#cpno#
</select>
<update id= "cr.studymid" parameterClass= "hashtable" >
update lectinning set isokmid=1 where lectno=#lectno# and cmino=#cmino#
</update>
<select id= "cr.mycmrs" parameterClass= "hashtable" resultClass= "cmrs" >
select distinct a.lectno,a.attrate
,b.rsno,b.cmno,b.rscno,b.rstype,b.rsname,b.rscondition
,case when c.lectno is null then 0 else 1 end isrsok
2021-01-27 17:23:51 +09:00
,a.edate
2020-10-12 14:39:23 +09:00
from lect a
inner join cmrs b on b.cmno=a.cmno and b.isdel=0
left outer join lectrs c on c.lectno=a.lectno and c.rsno=b.rsno
where a.lectno=#lectno# and a.userno=#userno#
order by b.cdt
</select>
<select id= "cr.mycmrsq" parameterClass= "hashtable" resultClass= "rscq" >
select b.rscno,b.rscqno
,c.qno,c.atype,c.qtext,c.rightcount
from (
select distinct b.rscno
from lect a
inner join cmrs b on b.rsno=#rsno# and b.cmno=a.cmno and b.isdel=0
left outer join lectrs c on c.lectno=a.lectno and c.rsno=b.rsno
where a.lectno=#lectno# and a.userno=#userno# and c.lectno is null
) a
inner join rscq b on b.rscno=a.rscno
inner join question c on c.qno=b.qno
order by b.dseq
</select>
<select id= "cr.mycmrsqi" parameterClass= "hashtable" resultClass= "rscq" >
select b.rscqno
,c.qno
,d.qino,d.qitext
,e.fileurl
from (
select distinct b.rscno
from lect a
inner join cmrs b on b.rsno=#rsno# and b.cmno=a.cmno and b.isdel=0
left outer join lectrs c on c.lectno=a.lectno and c.rsno=b.rsno
where a.lectno=#lectno# and a.userno=#userno# and c.lectno is null
) a
inner join rscq b on b.rscno=a.rscno
inner join question c on c.qno=b.qno
inner join questionitem d on d.qno=c.qno and d.isdel=0
left outer join fileinfo e on e.fgno=d.fgno and e.isdel=0
order by b.dseq,d.qino
</select>
<update id= "cr.lectrs.in" parameterClass= "lectrs" >
insert into lectrs(lectno,rsno,rscno,rscqno,qno,atext,<include refid= "sql.inc" > </include> )
select a.lectno,b.rsno,b.rscno,c.rscqno,c.qno,c.atext,<include refid= "sql.inv" > </include>
from lect a
inner join cmrs b on b.rsno=#rsno#
left outer join lectrs a0 on a0.lectno=a.lectno and a0.rsno=b.rsno
inner join (
<iterate property= "Ds" open= "" conjunction= "union all" close= "" > select a.rscqno,a.qno,#Ds[].atext# atext from rscq a where a.rscqno=#Ds[].rscqno# </iterate>
) c on c.rscqno is not null
where a.lectno=#lectno# and a.userno=#userno# and a0.lectno is null
</update>
<select id= "cr.myestimation" parameterClass= "hashtable" resultClass= "data" >
select a.*
from (
select 0 dtype
,null strval,0 intval10
,0 intval,0 intval2,0 intval3,0 intval4
,0 rno
2021-01-27 17:23:51 +09:00
,null time
2020-10-12 14:39:23 +09:00
from (select 1 col1) a
where a.col1=0
<isNotNull property= "exam" >
union all
select b.extype dtype
,b.exname strval,b.exno intval10
2021-01-26 17:26:54 +09:00
<!-- ,case when a2.sstime < now() and a2.setime > now() then a.attrate else - 1 end intval,b.econdition intval2 -->
,case when a.sdate < now() and a.edate > now() then a.attrate else -1 end intval,b.econdition intval2
,case when c.eend is null then 0 else 1 end intval3
,null intval4
2020-10-12 14:39:23 +09:00
,row_number() over (partition by b.extype order by b.extype, b.cdt) rno
2021-01-27 17:23:51 +09:00
,a.edate time
2020-10-12 14:39:23 +09:00
from lect a
inner join cm a2 on a2.cmno=a.cmno
inner join cmex b on b.cmno=a.cmno and b.isdel=0
left outer join lectex c on c.lectno=a.lectno and c.exno=b.exno
where a.lectno=#lectno# and a.userno=#userno#
</isNotNull>
<isNotNull property= "subject" >
union all
select 2 dtype
,b.sdname strval,b.sdno intval10
2021-01-26 17:26:54 +09:00
<!-- ,case when a2.sstime < now() and a2.setime > now() then a.attrate else - 1 end intval,b.sdcondition intval2 -->
,case when a.sdate < now() and a.edate > now() then a.attrate else -1 end intval,b.sdcondition intval2
,case when c.submittime is null then 0 else 1 end intval3
,case when c.checktime is null then 0 else 1 end intval4
2020-10-12 14:39:23 +09:00
,row_number() over (order by b.cdt) rno
2021-01-27 17:23:51 +09:00
,a.edate time
2020-10-12 14:39:23 +09:00
from lect a
inner join cm a2 on a2.cmno=a.cmno
inner join cmsd b on b.cmno=a.cmno and b.sdtype=0 and b.isdel=0
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
where a.lectno=#lectno# and a.userno=#userno#
</isNotNull>
<isNotNull property= "discuss" >
union all
select 3 dtype
,b.sdname strval,b.sdno intval10
2021-01-26 17:26:54 +09:00
<!-- ,case when a2.sstime < now() and a2.setime > now() then a.attrate else - 1 end intval,b.sdcondition intval2 -->
,case when a.sdate < now() and a.edate > now() then a.attrate else -1 end intval,b.sdcondition intval2
2020-10-12 14:39:23 +09:00
,case when count(d.bno) > 0 then 1 else 0 end intval3
,case when c.checktime is null then 0 else 1 end intval4
,row_number() over (order by b.cdt) rno
2021-01-27 17:23:51 +09:00
,a.edate time
2020-10-12 14:39:23 +09:00
from lect a
inner join cm a2 on a2.cmno=a.cmno
inner join cmsd b on b.cmno=a.cmno and b.sdtype=1 and b.isdel=0
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
left outer join lectsdboard d on d.lectno=a.lectno and d.sdno=b.sdno and d.isdel=0
where a.lectno=#lectno# and a.userno=#userno#
group by b.sdname,b.sdno,a2.sstime,a2.setime,a.attrate,b.sdcondition,c.checktime,b.cdt
</isNotNull>
) a
order by a.dtype,a.rno
</select>
<select id= "cr.lectex" parameterClass= "hashtable" resultClass= "lectex" >
2021-05-17 10:14:33 +09:00
select a.lectno,a.attrate,a.iscomplete
2020-10-12 14:39:23 +09:00
,b.sstime,b.setime
2021-05-17 10:14:33 +09:00
,c.exno,c.exname,c.extype,c.edesc,c.econdition,c.etime,c.evtype,c.eqtype,c.israndq,c.israndqi,c.qcount,c.isblur,c.tpoint,ifnull(c.relaylimit,999) relaylimit,c.isusebackup,c.isseq,c.isreexamable,c.isresultopen
2020-10-12 14:39:23 +09:00
,d.lectno exlectno,d.estart,d.eend,d.tpoint,d.recount,d.rechecktime,ifnull(d.entercount,0) entercount,d.cblock
,case when a.etime = 0 then 99999999 else TIMESTAMPDIFF(MINUTE, now(), date_add(ifnull(d.estart, now()), interval c.etime MINUTE)) end rtime
,d.recount
from lect a
inner join cm b on b.cmno=a.cmno
inner join cmex c on c.exno=#exno#
left outer join lectex d on d.lectno=a.lectno and d.exno=c.exno
where a.lectno=#lectno# and a.userno=#userno#
</select>
<select id= "cr.userexamdata.start" parameterClass= "hashtable" resultClass= "lectexq" >
<include refid= "lectexcreate" > </include>
select case when a.etime = 0 then 99999999 else TIMESTAMPDIFF(MINUTE, now(), date_add(ifnull(b.estart, now()), interval a.etime MINUTE)) end etime
,a.qcount,a.evtype,a.israndqi,a.tpoint,a.isblur,a.isusebackup,a.isseq
,b.cblock
,c.atext,c.qseq
,d.eqno,d.rpoint
,e.atype,e.qtext,e.qno,e.rightcount,e.ispassspace,e.isignorecase
from cmex a
inner join cm a3 on a3.cmno=a.cmno
inner join lect a2 on a2.lectno=#lectno# and a2.userno=#userno#
inner join lectex b on b.lectno=a2.lectno and b.exno=a.exno and b.eend is null and (a.etime = 0 or date_add(ifnull(b.estart, now()), interval a.etime MINUTE) > now())
and ifnull(b.entercount,0) < = ifnull(a.relaylimit, 999)
inner join lectexq c on c.lectno=b.lectno and c.exno=b.exno
inner join cmexq d on d.eqno=c.eqno
inner join question e on e.qno=d.qno
where a.exno=#exno# and now() between a3.sstime and a3.setime
order by c.qseq;
update lectex a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
inner join cmex b on b.exno=a.exno
set
a.estart=case when a.estart is null then now() else a.estart end
,a.entercount=ifnull(a.entercount,0)+1
,a.uno=#uno#
,a.uip=#uip#
,a.eip=#uip#
where a.lectno=#lectno# and a.exno=#exno# and a.eend is null and ifnull(a.entercount,0) < = ifnull(b.relaylimit, 999)
</select>
<select id= "cr.userexamquestionitem.get" parameterClass= "hashtable" resultClass= "questionitem" >
select a.qno, a.qino, a.isright, a.qitext, b.fileno, b.fileurl
from questionitem a
left outer join fileinfo b on b.fgno=a.fgno and b.isdel=0
where a.qno in ($qnos$) and a.isdel=0
<isNotNull property= "orderby" > order by $orderby$</isNotNull>
</select>
<select id= "cr.userexam.detailforexamforsubmit" parameterClass= "hashtable" resultClass= "cmex" >
select a.exno,a.exname,a2.sstime,a2.setime,a.tpoint,a.etime,a.qcount,b.estart,a.edesc,TIMESTAMPDIFF(MINUTE, now(), date_add(ifnull(b.estart, now()), interval a.etime MINUTE)) rtime
from cmex a
inner join cm a2 on a2.cmno=a.cmno
inner join lectex b on b.lectno=#lectno# and b.exno=a.exno and b.eend is null and (a.etime = 0 or date_add(ifnull(b.estart, now()), interval (a.etime + 1) MINUTE) > now())
inner join lect c on c.lectno=b.lectno and c.userno=#userno#
where a.exno=#exno#
</select>
<select id= "cr.questionitem.listforcheck" parameterClass= "string" resultClass= "questionitem" >
select a.qino,a.qitext,b.atype,a.qno
from questionitem a
inner join question b on b.qno=a.qno
where a.qno in ($qnos$) and a.isright=1 and a.isdel=0
order by a.qno, a.qino
</select>
<update id= "cr.examsubmit" parameterClass= "lectex" >
update lectexq a
inner join lectex d on d.lectno=a.lectno and d.exno=a.exno and d.eend is null
inner join lect d2 on d2.lectno=d.lectno and d2.userno=#userno#
inner join cmex c on c.exno=a.exno
inner join (
<iterate property= "UED" open= "" conjunction= "union all" close= "" >
select #exno# exno, #UED[].eqno# eqno, #UED[].atext# atext, #UED[].qinos# qinos, #UED[].iscorrect# iscorrect
</iterate>
) b on b.exno=a.exno and b.eqno=a.eqno
set a.atext=b.atext, a.qinos=b.qinos,a.udt=now(),a.uno=#uno#,a.uip=#uip#
,a.cpoint=case when b.iscorrect = 1 then a.dpoint else 0 end
,a.iscorrect=b.iscorrect
where a.lectno=#lectno# and a.exno=#exno#;
update lectex a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
inner join (
select a.exno, sum(ifnull(a.cpoint, 0)) tpoint
from lectexq a
where a.lectno=#lectno# and a.exno=#exno#
group by a.exno
) b on b.exno=a.exno
inner join cmex c on c.exno=a.exno
set a.udt=now(),a.uno=#userno#,a.uip=#uip#
<isEqual property= "issubmit" compareValue= "1" > ,a.eend=now()</isEqual>
, a.tpoint=b.tpoint
<!-- , a.overtime=case when #zstring20# is null then a.overtime else now() end -->
,a.cblock=#cblock#
where a.lectno=#lectno# and a.exno=#exno# and a.eend is null
</update>
<update id= "cr.examsubmitbackup" parameterClass= "lectex" >
update lectexq a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
inner join lectex d on d.lectno=a.lectno and d.exno=a.exno and d.eend is null
inner join cmex c on c.exno=a.exno
inner join (
<iterate property= "UED" open= "" conjunction= "union all" close= "" >
select #exno# exno, #UED[].eqno# eqno, #UED[].atext# atext, #UED[].qinos# qinos, #UED[].iscorrect# iscorrect
</iterate>
) b on b.exno=a.exno and b.eqno=a.eqno
set a.atext=b.atext, a.qinos=b.qinos,a.udt=now(),a.uno=#uno#
,a.cpoint=case when b.iscorrect = 1 then a.dpoint else 0 end
,a.iscorrect=b.iscorrect
where a.lectno=#lectno# and a.exno=#exno#;
update lectex a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
inner join (
select a.exno, sum(ifnull(a.cpoint, 0)) tpoint
from lectexq a
where a.exno=#exno# and a.lectno=#lectno#
group by a.exno
) b on b.exno=a.exno
inner join cmex c on c.exno=a.exno
set a.udt=now(),a.uno=#userno#
, a.tpoint=b.tpoint
<!-- , a.overtime=case when #zstring20# is null then a.overtime else now() end -->
where a.lectno=#lectno# and a.exno=#exno# and a.eend is null
</update>
<select id= "cr.lectsd" parameterClass= "hashtable" resultClass= "lectsd" >
select a.lectno,a.attrate,a.cmno
,b.sdno,b.sdname,b.sddesc,b.fgno sdfgno,b.sdcondition
,c.sstime,c.setime
,d.checktime,d.cpoint,d.feedb,d.fgno,d.atext
from lect a
inner join cmsd b on b.cmno=a.cmno and b.sdno=#sdno#
inner join cm c on c.cmno=b.cmno
left outer join lectsd d on d.lectno=a.lectno and d.sdno=b.sdno
where a.lectno=#lectno# and a.userno=#userno#
</select>
<update id= "cr.lectsd.save" parameterClass= "lectsd" >
update lectsd a
inner join lect b on b.lectno=a.lectno and b.userno=#userno#
inner join cm c on c.cmno=b.cmno and c.sstime < now() and c.setime > now()
set a.udt=now(),a.uno=#uno#,a.uip=#uip#
,a.fgno=#fgno#,a.atext=#atext#
,a.submittime=now(),submitip=#uip#
where a.lectno=#lectno# and a.sdno=#sdno# and a.checktime is null;
insert into lectsd (lectno,sdno,atext,fgno,iscopy,submittime,submitip,<include refid= "sql.inc" > </include> )
select a.lectno,a.sdno,#atext#,#fgno#,0,now(),#uip#,<include refid= "sql.inv" > </include>
from (select #lectno# lectno,#userno# userno,#sdno# sdno) a
inner join lect b on b.lectno=a.lectno and b.userno=a.userno
inner join cm c on c.cmno=b.cmno and c.sstime < now() and c.setime > now()
left outer join lectsd d on d.lectno=a.lectno and d.sdno=a.sdno
where d.lectno is null;
</update>
<select id= "cr.lectsd2" parameterClass= "hashtable" resultClass= "lectsd" >
select a.lectno,a.attrate
,b.sdno,b.sdname,b.sddesc,b.fgno sdfgno,b.sdcondition
,c.sstime,c.setime
,d.checktime,d.cpoint,d.feedb,d.fgno,d.atext
from lect a
inner join cmsd b on b.cmno=a.cmno and b.sdno=#sdno#
inner join cm c on c.cmno=b.cmno
left outer join lectsd d on d.lectno=a.lectno and d.sdno=b.sdno
where a.lectno=#lectno# and a.userno=#userno#
</select>
<select id= "cr.lectsdboards" parameterClass= "int" resultClass= "lectsdboard" >
select a.bno,a.subject,a.cdt,a.rcount
,u.username
,count(b.bcno) ccount
from lectsdboard a
inner join users u on u.userno=a.cno
left outer join lectsdboardcmt b on b.bno=a.bno and b.isdel=0
where a.sdno=#sdno# and a.isdel=0
group by a.bno,a.subject,a.cdt,a.rcount,u.username
order by a.cdt
</select>
<select id= "cr.lectsdboard" parameterClass= "long" resultClass= "lectsdboard" >
update lectsdboard set rcount=rcount+1 where bno=#bno# and cno< > #userno#;
select a.bno,a.subject,a.contents,a.cdt,a.fgno,a.cno
,b.sdname
,c.sstime,c.setime
,u.username,u.userno
,a2.checktime
from lectsdboard a
inner join lectsd a2 on a2.lectno=a.lectno and a2.sdno=a.sdno
inner join users u on u.userno=a.cno
inner join cmsd b on b.sdno=a.sdno
inner join cm c on c.cmno=b.cmno
where a.bno=#bno# and a.isdel=0
</select>
<update id= "cr.lectsdboard.save" parameterClass= "lectsdboard" >
update lectsd a
inner join lect b on b.lectno=a.lectno and b.userno=#userno#
inner join cm c on c.cmno=b.cmno and c.sstime < now() and c.setime > now()
set a.udt=now(),a.uno=#uno#,a.uip=#uip#
,a.submittime=now(),submitip=#uip#
where a.lectno=#lectno# and a.sdno=#sdno# and a.checktime is null;
update lectsdboard a
inner join lectsd a2 on a2.lectno=a.lectno and a2.sdno=a.sdno and a2.checktime is null
inner join lect b on b.lectno=a.lectno and b.userno=#userno#
inner join cm c on c.cmno=b.cmno and c.sstime < now() and c.setime > now()
set a.udt=now(),a.uno=#uno#,a.uip=#uip#
,a.subject=#subject#,contents=#contents#,a.fgno=#fgno#
where a.bno=#bno# and a.lectno=#lectno# and a.sdno=#sdno#;
</update>
<insert id= "cr.lectsdboard.in" parameterClass= "lectsdboard" >
update lectsd a
inner join lect b on b.lectno=a.lectno and b.userno=#userno#
inner join cm c on c.cmno=b.cmno and c.sstime < now() and c.setime > now()
set a.udt=now(),a.uno=#uno#,a.uip=#uip#
,a.submittime=now(),submitip=#uip#
where a.lectno=#lectno# and a.sdno=#sdno# and a.checktime is null;
insert into lectsd (lectno,sdno,iscopy,submittime,submitip,<include refid= "sql.inc" > </include> )
select a.lectno,a.sdno,0,now(),#uip#,<include refid= "sql.inv" > </include>
from (select #lectno# lectno,#userno# userno,#sdno# sdno) a
inner join lect b on b.lectno=a.lectno and b.userno=a.userno
inner join cm c on c.cmno=b.cmno and c.sstime < now() and c.setime > now()
left outer join lectsd d on d.lectno=a.lectno and d.sdno=a.sdno
where d.lectno is null;
SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0;
insert into lectsdboard (lectno,sdno,subject,contents,fgno,rcount,cip,isdel,<include refid= "sql.inc" > </include> )
select a.lectno,a.sdno,#subject#,#contents#,#fgno#,0,#uip#,0,<include refid= "sql.inv" > </include>
from (select #lectno# lectno,#userno# userno,#sdno# sdno) a
inner join lect b on b.lectno=a.lectno and b.userno=a.userno
inner join cm c on c.cmno=b.cmno and c.sstime < now() and c.setime > now();
<selectKey type= "post" property= "bno" resultClass= "long" > SELECT last_insert_id()</selectKey>
</insert>
<select id= "cr.lectsdboardcmt" parameterClass= "long" resultClass= "boardcmt" >
select a.bno
,b.bcno,b.ctext,b.cno,b.cdt
,c.userno,c.username,c.usertype,c.username cnoname
from lectsdboard a
inner join lectsdboardcmt b on b.bno=a.bno and b.isdel=0
inner join users c on c.userno=b.cno
where a.bno=#bno#
order by b.cdt desc
</select>
<update id= "cr.lectsdboard.del" parameterClass= "hashtable" >
update lectsd a
inner join lectsdboard b on b.bno=#bno# and b.cno=#userno# and b.isdel=0 and b.lectno=a.lectno and b.sdno=a.sdno
inner join lect a2 on a2.lectno=b.lectno and a2.userno=b.cno
inner join cm c on c.cmno=a2.cmno and c.sstime < now() and c.setime > now()
set a.submittime=null,a.submitip=null and a.checktime is null;
update lectsdboard a
inner join lectsd b on b.lectno=a.lectno and b.sdno=a.sdno and b.checktime is null
inner join lect a2 on a2.lectno=b.lectno and a2.userno=a.cno
inner join cm c on c.cmno=a2.cmno and c.sstime < now() and c.setime > now()
set a.uno=#uno#,a.udt=now(),a.uip=#uip#
,a.isdel=1
where a.bno=#bno# and a.cno=#userno# and a.isdel=0;
</update>
<insert id= "cr.lectsdboardcmt.in" parameterClass= "boardcmt" >
SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0;
insert into lectsdboardcmt (bno,ctext,isdel,<include refid= "sql.inc" > </include> )
values (#bno#,#ctext#,0,<include refid= "sql.inv" > </include> );
<selectKey type= "post" property= "bcno" resultClass= "long" > SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id= "cr.lectsdboardcmt.up" parameterClass= "boardcmt" >
update lectsdboardcmt set <include refid= "sql.up" > </include>
,ctext=#ctext#
where bcno=#bcno# <isGreaterThan property= "cno" compareValue= "0" > and cno=#cno#</isGreaterThan>
</update>
<update id= "cr.lectsdboardcmt.del" parameterClass= "hashtable" >
update lectsdboardcmt set <include refid= "sql.up" > </include> ,isdel=1 where bcno=#bcno# <isGreaterThan property= "cno" compareValue= "0" > and cno=#cno#</isGreaterThan>
</update>
<select id= "cr.payitems" parameterClass= "hashtable" resultClass= "payitem" >
select a.*
from (
select a.isexamready,a.ccount
,case when a.isexamready=1 then ue.exno else p.payno end payno
,case when a.isexamready=1 then 0 else p.ptype end pptype,p.payoktime,p.isgroup
,case when a.isexamready=1 then case when ua.isjoin=1 then uee.infee else uee.outfee end else p.payamt end payamt,p.refundamt,p.rstatus
,case when a.isexamready=1 then 21 else p.pstatus end pstatus
,case when a.isexamready=1 then ue.cdt else case pi.ptype when 3 then exu.cdt when 4 then le.oktime else p.cdt end end cdt
,case when a.isexamready=1 then ue.exno else pi.pino end pino,pi.isrebate
,case when a.isexamready=1 then 3 else pi.ptype end ptype
,case when a.isexamready=1 then 0 else p.isunpay end isunpay
,case when p.rstatus=0 and pr.rstatus = 0 and pri.rfdno is not null then 1 else 0 end isrefundcall
,u.userno,u.userid,u.username
,ua.asname,ua.isjoin
,cm.cshape,cm.sstime,cm.setime
2021-03-31 13:53:32 +09:00
,le.sdate,le.edate
2020-10-12 14:39:23 +09:00
,case when a.isexamready=1 then uee.exname else case pi.ptype when 2 then bk.bkname when 3 then ex.exname else cm.cname end end itemname
2021-05-17 12:48:23 +09:00
,ppl.rbankname,ppl.rbankacc,ppl.rbankowner
2020-10-12 14:39:23 +09:00
,row_number() over(order by case when pr.rstatus=0 and pri.rfdno is not null then 0 else 1 end, case when a.isexamready=1 then ue.cdt else p.cdt end desc) rno
,count(p.payno) over() pagetotalcount
from (
select 0 isexamready,p.payno,max(case when pi.ptype in (0,1,3,4) then pi.pino else 0 end) pi1,min(pi.pino) pi2,count(pi.pino) ccount
from pay p
inner join payitem pi on pi.payno=p.payno
<isNotNull property= "piptype" > and pi.ptype=#piptype#</isNotNull>
<isNotNull property= "isrebates" > and pi.ptype in (0, 4) and pi.isrebate in ($isrebates$)</isNotNull>
inner join users u on u.userno=p.userno
left outer join assign ua on ua.asno=u.asno
left outer join payrfditem pri on pri.pino=pi.pino
left outer join payrfd pr on pr.rfdno=pri.rfdno
left outer join cm cm on pi.ptype in (0,1,4) and cm.cmno=pi.itemno
left outer join cm cm2 on cm2.cmno=cm.pcmno
left outer join cg cg on cg.cgno=cm.cgno
left outer join book bk on pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
2020-12-24 15:27:40 +09:00
where p.pstatus in (1,21,22,41,42,43)
2020-10-12 14:39:23 +09:00
<isNotNull property= "cdts" > and p.cdt > = #cdts#</isNotNull>
<isNotNull property= "cdte" > and p.cdt < = #cdte#</isNotNull>
<!-- <isNotNull property="pstatusin">and p.pstatus in ($pstatusin$)</isNotNull> -->
2020-12-24 15:27:40 +09:00
<!-- <isNotNull property="isrefundcall">and (p.rstatus =0 and pr.rstatus=0 and pri.rfdno is not null)</isNotNull> -->
2020-10-12 14:39:23 +09:00
<!-- <isNotNull property="rstatusin">and pi.rstatus in ($rstatusin$)</isNotNull> -->
<isNotNull property= "pstatusall" > $pstatusall$</isNotNull>
<isNotNull property= "ptypein" > and p.ptype in ($ptypein$)</isNotNull>
<isNotNull property= "isjoin" > and ua.isjoin=#isjoin#</isNotNull>
<isNotNull property= "asname" > and ua.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNull property= "brno" > and ua.brno=#brno#</isNotNull>
<isNotNull property= "cshape" > and cm.cshape=#cshape#</isNotNull>
<isNotNull property= "pcgno" > and cg.pcgno=#pcgno#</isNotNull>
<isNotNull property= "username" > and u.username=#username#</isNotNull>
<isNotNull property= "userid" > and u.userid=#userid#</isNotNull>
<isNotNull property= "itemname" > and (cm.cname like concat('%',#itemname#,'%') or bk.bkname like concat('%',#itemname#,'%') or ex.exname like concat('%',#itemname#,'%'))</isNotNull>
<isNotNull property= "cname" > and (cm2.cname like concat('%',#cname#,'%'))</isNotNull>
<isNotNull property= "usernameiditemname" > and (u.username=#usernameiditemname# or u.userid=#usernameiditemname# or cm.cname like concat('%',#usernameiditemname#,'%') or bk.bkname like concat('%',#usernameiditemname#,'%') or ex.exname like concat('%',#usernameiditemname#,'%') or cm2.cname like concat('%',#usernameiditemname#,'%'))</isNotNull>
<isNotNull property= "isgroup" > and p.isgroup=1</isNotNull>
<isNotNull property= "isunpay" > and p.isunpay=#isunpay#</isNotNull>
group by p.payno
union all
select 1 isexamready,a.exno payno,a.userno pi1,a.userno pi2,1 ccount
from examuser a
inner join exam ex on ex.exno=a.exno <isNotNull property= "itemname" > and ex.exname like concat('%',#itemname#,'%')</isNotNull>
inner join users u on u.userno=a.userno
left outer join assign ua on ua.asno=u.asno
where a.status=1 and a.payno is null and a.pino is null and a.pstatus=4
<isNotNull property= "piptype" > and #piptype#=3</isNotNull>
<isNotNull property= "isrebates" > and a.exno=0</isNotNull>
<isNotNull property= "rstatusin" > and a.exno=0</isNotNull>
<isNotNull property= "cdts" > and a.cdt > = #cdts#</isNotNull>
<isNotNull property= "cdte" > and a.cdt < = #cdte#</isNotNull>
<isNotNull property= "pstatusin" > and concat(',',#pstatusin#,',') like '%,21,%'</isNotNull>
<isNotNull property= "isrefundcall" > and a.exno=0</isNotNull>
<isNotNull property= "ptypein" > and a.exno=0</isNotNull>
<isNotNull property= "isjoin" > and ua.isjoin=#isjoin#</isNotNull>
<isNotNull property= "asname" > and ua.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNull property= "brno" > and ua.brno=#brno#</isNotNull>
<isNotNull property= "cshape" > and a.exno=0</isNotNull>
<isNotNull property= "pcgno" > and a.exno=0</isNotNull>
<isNotNull property= "username" > and u.username=#username#</isNotNull>
<isNotNull property= "userid" > and u.userid=#userid#</isNotNull>
<isNotNull property= "usernameiditemname" > and (u.username=#usernameiditemname# or u.userid=#usernameiditemname# or ex.exname like concat('%',#usernameiditemname#,'%'))</isNotNull>
<isNotNull property= "isgroup" > and a.exno=0</isNotNull>
) a
left outer join pay p on a.isexamready=0 and p.payno=a.payno
left outer join payitem pi on a.isexamready=0 and pi.pino=case when a.pi1=0 then a.pi2 else a.pi1 end
left outer join examuser ue on a.isexamready=1 and ue.exno=a.payno and ue.userno=a.pi1
left outer join exam uee on a.isexamready=1 and uee.exno=ue.exno
inner join users u on u.userno=case when a.isexamready=0 then p.userno else ue.userno end
left outer join assign ua on ua.asno=u.asno
left outer join payrfditem pri on a.isexamready=0 and pri.pino=pi.pino
left outer join payrfd pr on a.isexamready=0 and pr.rfdno=pri.rfdno
left outer join cm cm on a.isexamready=0 and pi.ptype in (0,1,4) and cm.cmno=pi.itemno
left outer join lect le on a.isexamready=0 and le.pino=pi.pino and le.ischanged=0
left outer join book bk on a.isexamready=0 and pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on a.isexamready=0 and ex.exno=pi.itemno
left outer join examuser exu on exu.exno=ex.exno and exu.userno=p.userno
2021-05-17 12:48:23 +09:00
left outer join pplog ppl on ppl.pplno = p.pplno
2020-10-12 14:39:23 +09:00
) a
<include refid= "sql.pagedynamic" > </include>
order by a.rno
<!-- select a.*
from (
select p.payno,p.ptype pptype,p.payoktime
,case pi.ptype when 3 then exu.cdt when 4 then le.oktime else p.cdt end cdt
,pi.pino,pi.isrebate,pi.ptype,pi.payamt,pi.refundamt,pi.rstatus,pi.pstatus
,case when pri.rfdno is not null then 1 else 0 end isrefundcall
,u.userno,u.userid,u.username
,ua.asname,ua.isjoin
,cm.cshape
,case pi.ptype when 2 then bk.bkname when 3 then ex.exname else cm.cname end itemname
,row_number() over(order by case when pr.rfdno is not null then 0 else 1 end, p.cdt desc) rno
,count(p.payno) over() pagetotalcount
from pay p
inner join payitem pi on pi.payno=p.payno
<isNotNull property= "piptype" > and pi.ptype=#piptype#</isNotNull>
<isNotNull property= "isrebates" > and pi.ptype in (0, 4) and pi.isrebate in ($isrebates$)</isNotNull>
<isNotNull property= "rstatusin" > and pi.rstatus in ($rstatusin$)</isNotNull>
inner join users u on u.userno=p.userno
left outer join assign ua on ua.asno=u.asno
left outer join payrfditem pri on pri.pino=pi.pino
left outer join payrfd pr on pr.rfdno=pri.rfdno and pr.rstatus=0
left outer join cm cm on pi.ptype in (0,1,4) and cm.cmno=pi.itemno
left outer join lect le on le.pino=pi.pino and le.ischanged=0
left outer join cg cg on cg.cgno=cm.cgno
left outer join book bk on pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
left outer join examuser exu on exu.exno=ex.exno and exu.userno=p.userno
where p.pstatus in (1,21,22,41,42,43) and (pri.rfdno is null or pr.rfdno is not null)
<isNotNull property= "cdts" > and p.cdt > = #cdts#</isNotNull>
<isNotNull property= "cdte" > and p.cdt < = #cdte#</isNotNull>
<isNotNull property= "pstatusin" > and p.pstatus in ($pstatusin$)</isNotNull>
<isNotNull property= "isrefundcall" > and pr.rfdno is not null</isNotNull>
<isNotNull property= "ptypein" > and p.ptype in ($ptypein$)</isNotNull>
<isNotNull property= "isjoin" > and ua.isjoin=#isjoin#</isNotNull>
<isNotNull property= "asname" > and ua.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNull property= "brno" > and ua.brno=#brno#</isNotNull>
<isNotNull property= "cshape" > and cm.cshape=#cshape#</isNotNull>
<isNotNull property= "pcgno" > and cg.pcgno=#pcgno#</isNotNull>
<isNotNull property= "username" > and u.username=#username#</isNotNull>
<isNotNull property= "userid" > and u.userid=#userid#</isNotNull>
<isNotNull property= "itemname" > and (cm.cname like concat('%',#itemname#,'%') or bk.bkname like concat('%',#itemname#,'%') or ex.exname like concat('%',#itemname#,'%'))</isNotNull>
<isNotNull property= "usernameiditemname" > and (u.username=#usernameiditemname# or u.userid=#usernameiditemname# or cm.cname like concat('%',#usernameiditemname#,'%') or bk.bkname like concat('%',#usernameiditemname#,'%') or ex.exname like concat('%',#usernameiditemname#,'%'))</isNotNull>
) a
<include refid= "sql.pagedynamic" > </include>
order by a.rno-->
</select>
<select id= "cr.pay1" parameterClass= "long" resultClass= "pay" >
select p.payno,p.cdt,p.payamt,p.ptype,p.refundamt,p.ispg,p.isgroup,p.isexam,p.pstatus,p.rstatus,p.payoktime,p.pgkey,p.isdvr,p.deliamt,p.isunpay,p.paylimit
,u.username,u.post,u.address1,u.address2
,CAST(AES_DECRYPT(UNHEX(u.userpno), <include refid= "sql.digest" > </include> ) AS char) userpno
,CAST(AES_DECRYPT(UNHEX(u.telno), <include refid= "sql.digest" > </include> ) AS char) telno
,CAST(AES_DECRYPT(UNHEX(u.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(u.email), <include refid= "sql.digest" > </include> ) AS char) email
,case pi.ptype when 3 then exu.cdt when 4 then le.oktime else p.cdt end oktime
,pd.dvrcode,pd.rcvname,pd.isdvr isdvr2,pd.codetime,pd.post post2,pd.address1 address12,pd.address2 address22,pd.dmemo
,CAST(AES_DECRYPT(UNHEX(pd.telno), <include refid= "sql.digest" > </include> ) AS char) telno2
,CAST(AES_DECRYPT(UNHEX(pd.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile2
2021-03-25 14:31:41 +09:00
,tax.iscancel, tax.taxdate, tax.taxno
2020-10-12 14:39:23 +09:00
from pay p
inner join users u on u.userno=p.userno
left outer join payitem pi on pi.payno=p.payno and pi.ptype in (3,4)
left outer join lect le on pi.ptype=4 and le.pino=pi.pino and le.ischanged=0
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
left outer join examuser exu on exu.exno=ex.exno and exu.userno=p.userno
left outer join paydvr pd on pd.payno=p.payno
2021-03-25 14:31:41 +09:00
left outer join paytax tax on tax.payno = p.payno
2020-10-12 14:39:23 +09:00
where p.payno=#payno#
</select>
<select id= "cr.pay2" parameterClass= "long" resultClass= "payitem" >
2021-03-24 14:34:38 +09:00
select pi.payno,pi.pino,pi.itemno,pi.pcno,pi.payamt,pi.pcnt,pi.ptype,pi.isrebate
2020-10-12 14:39:23 +09:00
,case pi.ptype when 2 then bk.bkname when 3 then ex.exname else cm.cname end itemname
,u.username,u.userid,u.isassignuser,u.depart,u.kfcfyear
,cc.cname ccpositionname
,CAST(AES_DECRYPT(UNHEX(u.telno), <include refid= "sql.digest" > </include> ) AS char) telno
,CAST(AES_DECRYPT(UNHEX(u.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,ua.asname
,cm.cshape
,cg.cgname
,pcg.cgname pcgname
2021-03-24 14:34:38 +09:00
,pi.rbank , CAST(AES_DECRYPT(UNHEX(pi.rbankaccnum), <include refid= "sql.digest" > </include> ) AS char) rbankaccnum, pi.tbankuser
2020-10-12 14:39:23 +09:00
from payitem pi
inner join pay p on p.payno=pi.payno
left outer join cm cm on pi.ptype in (0,1,4) and cm.cmno=pi.itemno
left outer join cg cg on pi.ptype in (0,1,4) and cg.cgno=cm.cgno
left outer join cg pcg on pcg.cgno=cg.pcgno
left outer join book bk on pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
left outer join users u on p.isgroup=1 and u.userno=pi.userno
left outer join assign ua on ua.asno=u.asno
left outer join comcode cc on cc.ccode=u.ccposition
where pi.payno=#payno#
</select>
2021-03-24 14:34:38 +09:00
<update id= "cr.payrefundinfo.up" parameterClass= "payitem" >
update payitem
set <include refid= "sql.up" > </include>
,rbank = #rbank#
,rbankaccnum = HEX(AES_ENCRYPT(#rbankaccnum#, <include refid= "sql.digest" > </include> ))
,tbankuser = #tbankuser#
where
payno = #payno#
</update>
2020-10-12 14:39:23 +09:00
<select id= "cr.payforexam1" parameterClass= "hashtable" resultClass= "pay" >
select eu.exno payno, eu.userno,eu.cdt,case when ua.isjoin=1 then ex.infee else ex.outfee end payamt,0 ptype,0 ispg,0 isgroup,1 isexam,21 pstatus,0 rstatus,null payoktime,null pgkey,0 isdvr,0 deliamt
,u.username,u.post,u.address1,u.address2
,CAST(AES_DECRYPT(UNHEX(u.userpno), <include refid= "sql.digest" > </include> ) AS char) userpno
,CAST(AES_DECRYPT(UNHEX(u.telno), <include refid= "sql.digest" > </include> ) AS char) telno
,CAST(AES_DECRYPT(UNHEX(u.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(u.email), <include refid= "sql.digest" > </include> ) AS char) email
,eu.cdt oktime
,null dvrcode,null rcvname,0 isdvr2,null codetime,null post2,null address12,null address22,null dmemo
,null telno2
,null mobile2
from examuser eu
inner join users u on u.userno=eu.userno
left outer join assign ua on ua.asno=u.asno
left outer join exam ex on ex.exno=eu.exno
where eu.exno=#exno# and eu.userno=#userno# and eu.status=1 and eu.payno is null and eu.pino is null and eu.pstatus=4
</select>
<select id= "cr.payforexam2" parameterClass= "hashtable" resultClass= "payitem" >
select eu.exno payno,eu.userno pino,eu.exno itemno,null pcno,case when ua.isjoin=1 then ex.infee else ex.outfee end payamt,1 pcnt,3 ptype
,ex.exname itemname
,u.username,u.userid,u.isassignuser,u.depart,u.kfcfyear
,cc.cname ccpositionname
,CAST(AES_DECRYPT(UNHEX(u.telno), <include refid= "sql.digest" > </include> ) AS char) telno
,CAST(AES_DECRYPT(UNHEX(u.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,ua.asname
,0 cshape
,null cgname
,null pcgname
from examuser eu
left outer join exam ex on ex.exno=eu.exno
left outer join users u on u.userno=eu.userno
left outer join assign ua on ua.asno=u.asno
left outer join comcode cc on cc.ccode=u.ccposition
where eu.exno=#exno# and eu.userno=#userno#
</select>
<insert id= "cr.examuserpayok" parameterClass= "pay" >
SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0;
insert into pay (ptype,ispg,isgroup,isexam,userno,username,pstatus,rstatus,rstatustime,cshrcancelnum,canceltime,cancelmsg,cancelcnt
,refunding,paylimit,payoktime,pgkey,orgamt,discamt,deliamt,isrefunddvr,payamt,refundamt,isdvr,<include refid= "sql.inc" > </include> )
select #ptype#,0,0,1,u.userno,u.username,1,0,null,null,null,null,null
,0,null,#payoktime#,null
,a.outfee
,case when #ptype# = 6 then a.outfee else case when ua.isjoin=1 then a.outfee-a.infee else 0 end end
,0,0
,case when #ptype# = 6 then 0 else case when ua.isjoin=1 then a.infee else a.outfee end end
,0,0,<include refid= "sql.inv" > </include>
from exam a
inner join users u on u.userno=#userno#
left outer join assign ua on ua.asno=u.asno
where a.exno=#exno#
<selectKey type= "post" property= "payno" resultClass= "long" > SELECT last_insert_id()</selectKey>
</insert>
<insert id= "cr.examuserpayok2" parameterClass= "payitem" >
SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0;
insert into payitem (payno,ptype,pcno,itemno,userno,pstatus,rstatus,pgkey,cancelcode,cancelmsg,canceltype,pcnt
,orgamt,discamt,payamt
,payamtcash,payamtcard
,refundamt,refundtime,refundtimereal,refundinfo,isrebate,fgno,cartno,<include refid= "sql.inc" > </include> )
select p.payno,3,null,#itemno#,#userno#,1,0,null,null,null,null,1
,a.outfee
,case when p.ptype=6 then a.outfee else case when ua.isjoin=1 then a.outfee-a.infee else 0 end end
,case when p.ptype=6 then 0 else case when ua.isjoin=1 then a.infee else a.outfee end end
,0,0
,0,null,null,null,0,null,null,<include refid= "sql.inv" > </include>
from exam a
inner join users u on u.userno=#userno#
inner join pay p on p.payno=#payno#
left outer join assign ua on ua.asno=u.asno
where a.exno=#itemno#
<selectKey type= "post" property= "pino" resultClass= "long" > SELECT last_insert_id()</selectKey>
</insert>
<update id= "cr.examuserpayok3" parameterClass= "payitem" >
update examuser set <include refid= "sql.up" > </include>
,payno=#payno#,pino=#pino#,pstatus=1
where exno=#itemno# and userno=#userno# and status=1 and payno is null and pino is null and pstatus=4
</update>
<update id= "cr.examuserpaycancel" parameterClass= "hashtable" >
update examuser set <include refid= "sql.up" > </include>
,pstatus=9
where exno=#exno# and userno=#userno# and status=1 and payno is null and pino is null and pstatus=4
</update>
<select id= "cr.pay.forrfd" parameterClass= "long" resultClass= "pay" >
2020-12-01 15:50:16 +09:00
select a.payno,a.ispg,a.pstatus,a.ptype,a.pgkey,a.isdvr,a.deliamt,a.isrefunddvr,a.payamt,a.refundamt,a.rstatus,a.isgroup,a.iscanceled,a.payoktime
2020-10-12 14:39:23 +09:00
,b.isdvr isdvr2,b.dvrcode
,CAST(AES_DECRYPT(UNHEX(u.email), <include refid= "sql.digest" > </include> ) AS char) email
from pay a
left outer join paydvr b on b.payno=a.payno
inner join users u on u.userno=a.userno
where a.payno=#payno# and a.pstatus=1
</select>
<select id= "cr.payitem.forrfd" parameterClass= "long" resultClass= "payitem" >
select pi.pino,pi.payno,pi.pcnt,pi.payamt,pi.refundamt,pi.refundtime,pi.refundinfo,pi.refundstatus,pi.rstatus,pi.ptype
,case pi.ptype when 2 then bk.bkname when 3 then ex.exname else cm.cname end itemname
,pcg.cgname pcgname
,u.userid,u.username
from payitem pi
inner join pay p on p.payno=pi.payno and p.pstatus=1
inner join users u on u.userno=case when pi.ptype=3 then p.userno else pi.userno end
left outer join cm cm on pi.ptype in(0,1,4) and cm.cmno=pi.itemno
left outer join cg cg on cg.cgno=cm.cgno
left outer join cg pcg on pcg.cgno=cg.pcgno
left outer join book bk on pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
where pi.payno=#payno#
</select>
<select id= "cr.payrfditems" parameterClass= "long" resultClass= "payrfd" >
select b.cdt,a.rfdno
,b.rtext,b.rstatus
,p.isgroup
,case pi.ptype when 2 then bk.bkname when 3 then ex.exname else cm.cname end itemname
,pi.ptype
,u.username,u.userid
from pay p
inner join payitem pi on pi.payno=p.payno
inner join payrfditem a on a.pino=pi.pino
inner join payrfd b on b.rfdno=a.rfdno
inner join users u on u.userno=case when p.isgroup=1 and pi.ptype in (0,1,4) then pi.userno else p.userno end
left outer join cm cm on pi.ptype in(0,1,4) and cm.cmno=pi.itemno
left outer join cg cg on cg.cgno=cm.cgno
left outer join cg pcg on pcg.cgno=cg.pcgno
left outer join book bk on pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
where p.payno=#payno#
order by a.rfdno desc
</select>
<select id= "cr.payrfditems2" parameterClass= "long" resultClass= "payrfd" >
select a.rfdno
,b.rtext,b.rstatus,b.cdt,b.isowner,b.ramt,b.bankname,b.bankowner
2020-12-01 15:50:16 +09:00
,b.rreason,b.ruser,b.fgnor,b.fgnob
,CAST(AES_DECRYPT(UNHEX(b.rphone), <include refid= "sql.digest" > </include> ) AS char) rphone
,b.rback
2020-10-12 14:39:23 +09:00
,CAST(AES_DECRYPT(UNHEX(b.bankno), <include refid= "sql.digest" > </include> ) AS char) bankno
,p.isgroup
,pi.payamt
,case pi.ptype when 2 then bk.bkname when 3 then ex.exname else cm.cname end itemname
,u.username,u.userid
,CAST(AES_DECRYPT(UNHEX(u.telno), <include refid= "sql.digest" > </include> ) AS char) telno
,CAST(AES_DECRYPT(UNHEX(u.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,ua.asname
2020-12-01 15:50:16 +09:00
,f1.orgname,f1.fileno
,f2.orgname orgname2,f2.fileno file2
2020-10-12 14:39:23 +09:00
from payrfditem a
inner join payitem pi on pi.pino=a.pino
inner join pay p on p.payno=pi.payno
inner join users u on u.userno=case when p.isgroup=1 and pi.ptype in (0,1,4) then pi.userno else p.userno end
left outer join assign ua on ua.asno=u.asno
inner join payrfd b on b.rfdno=a.rfdno
left outer join cm cm on pi.ptype in(0,1,4) and cm.cmno=pi.itemno
left outer join cg cg on cg.cgno=cm.cgno
left outer join cg pcg on pcg.cgno=cg.pcgno
left outer join book bk on pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
2020-12-01 15:50:16 +09:00
left outer join fileinfo f1 on f1.fgno=b.fgnor and f1.isdel=0
left outer join fileinfo f2 on f2.fgno=b.fgnob and f2.isdel=0
2020-10-12 14:39:23 +09:00
where a.rfdno=#rfdno#
order by a.rfdno desc
</select>
<update id= "cr.payrfd.save" parameterClass= "hashtable" >
update payrfd set <include refid= "sql.up" > </include>
2020-12-01 15:50:16 +09:00
,bankname=#bankname#,bankowner=#bankowner#,bankno=HEX(AES_ENCRYPT(#bankno#, <include refid= "sql.digest" > </include> ))
,isowner=#isowner#,ruser=#ruser#,rphone=HEX(AES_ENCRYPT(#rphone#, <include refid= "sql.digest" > </include> ))
,rreason=#rreason#,rtext=#rtext#,rstatus=#rstatus#,rback=#rback#
,statustime=case when rstatus < > #rstatus# then now() else statustime end
2020-10-12 14:39:23 +09:00
where rfdno=#rfdno#
</update>
<select id= "cr.payitems.forcheck" parameterClass= "string" resultClass= "payitem" >
select a.pino,a.ptype
from payitem a
where a.pino in ($pinos$) and a.pstatus=1 and a.rstatus=0
</select>
<select id= "cr.payitems.forcheck2" parameterClass= "string" resultClass= "payitem" >
select a.pino,a.ptype
from payitem a
where a.pino in ($pinos$) and a.pstatus=1 and a.rstatus< > 0
</select>
<update id= "cr.paycancel" parameterClass= "pay" >
update pay set <include refid= "sql.up" > </include>
,rstatus=1,rstatustime=now(),cancelcnt=case when #cancelcnt# = 0 then cancelcnt else #cancelcnt# end
,isrefunddvr=case when isrefunddvr = 0 and #isrefunddvr# = 1 then 1 else isrefunddvr end
,refundamt = refundamt + #newrefundamt#
,iscanceled = #iscanceled#
where payno=#payno#;
update payitem a
inner join (
<iterate property= "PIs" open= "" conjunction= "union all" close= "" > select #PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo </iterate>
) b on b.pino=a.pino
set a.rstatus=1,a.pgkey=#cancelcode#,a.refundamt=b.refundamt,a.refundtime=b.refundtime,a.refundtimereal=now(),a.refundinfo=b.refundinfo,a.refundstatus=b.refundstatus
where a.payno=#payno# and a.rstatus=0;
<isNotNull property= "pinosexamuser" >
update examuser set udt=now(),uno=#uno#,uip=#uip#
,pstatus=8
where payno=#payno# and pino in ($pinosexamuser$);
</isNotNull>
<isNotNull property= "pinoslect" >
update lect set udt=now(),uno=#uno#,uip=#uip#
,status=8
where payno=#payno# and pino in ($pinoslect$) and ischanged=0;
</isNotNull>
<isNotNull property= "pinosexamuser2" >
update payitem a
inner join (
<iterate property= "PIs" open= "" conjunction= "union all" close= "" > select #PIs[].rstatus# rstatus,#PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo </iterate>
) b on b.pino=a.pino and b.rstatus > 0
set a.refundstatus=b.refundstatus
where a.payno=#payno# and a.pino in ($pinosexamuser2$) and a.rstatus> 0;
update examuser a
inner join (
<iterate property= "PIs" open= "" conjunction= "union all" close= "" > select #PIs[].rstatus# rstatus,#PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo </iterate>
) b on b.pino=a.pino and b.rstatus > 0
set a.udt=now(),a.uno=#uno#,a.uip=#uip#
,a.pstatus=case when b.refundstatus=1 then 8 else 1 end
where a.payno=#payno# and a.pino in ($pinosexamuser2$);
</isNotNull>
<isNotNull property= "pinoslect2" >
update payitem a
inner join (
<iterate property= "PIs" open= "" conjunction= "union all" close= "" > select #PIs[].rstatus# rstatus,#PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo </iterate>
) b on b.pino=a.pino and b.rstatus > 0
set a.refundstatus=b.refundstatus
where a.payno=#payno# and a.pino in ($pinoslect2$) and a.rstatus> 0;
update lect a
inner join (
<iterate property= "PIs" open= "" conjunction= "union all" close= "" > select #PIs[].rstatus# rstatus,#PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo </iterate>
) b on b.pino=a.pino and b.rstatus > 0
set a.udt=now(),a.uno=#uno#,a.uip=#uip#
,a.status=case when b.refundstatus=1 then 8 else 1 end
where a.payno=#payno# and a.pino in ($pinoslect2$);
</isNotNull>
insert into payrfdlog (payno,pino,refundamt,refunddate,dmemo,pistatus,<include refid= "sql.inc" > </include> )
select #payno#,a.pino,a.refundamt,a.refundtime,a.refundinfo,a.refundstatus,<include refid= "sql.inv" > </include>
from (
<iterate property= "PIs" open= "" conjunction= "union all" close= "" > select #PIs[].pino# pino,#PIs[].refundamt# refundamt,#PIs[].refundstatus# refundstatus,#PIs[].refundtime# refundtime,#PIs[].refundinfo# refundinfo </iterate>
) a;
<isGreaterThan property= "isrefunddvr" compareValue= "0" >
insert into payrfdlog (payno,pino,refundamt,refunddate,dmemo,pistatus,<include refid= "sql.inc" > </include> )
values(#payno#,null,#deliamt#,now(),"택배비환불",0,<include refid= "sql.inv" > </include> );
</isGreaterThan>
</update>
<!-- <update id="cr.lectchange" parameterClass="pay">
update payitem a
inner join (
<iterate property= "PIs" open= "" conjunction= "union all" close= "" >
select a.pino, case when #PIs[].rstatus# = 1 then #PIs[].refundstatus# else a.refundstatus end refundstatus
from payitem a
where a.pino=#PIs[].pino#
</iterate>
) b on b.pino=a.pino
set a.refundstatus=b.refundstatus
where a.payno=#payno# and a.pino=b.pino;
update lect a
inner join (
<iterate property= "PIs" open= "" conjunction= "union all" close= "" >
select a.pino,case when (case when #PIs[].rstatus# = 1 then #PIs[].refundstatus# else ifnull(a.refundstatus,0) end) = 0 then 1 else 8 end status
from payitem a
where a.pino = #PIs[].pino#
</iterate>
) b on b.pino=a.pino
set a.udt=now(),a.uno=#uno#,a.uip=#uip#
,a.status=b.status
where a.payno=#payno# and a.pino=b.pino and a.ischanged=0;
</update> -->
<select id= "cr.paytaxes" parameterClass= "hashtable" resultClass= "paytax" >
select a.*
from (
select a.taxno,ifnull(a.cname, ifnull(a.exname, a.bkname)) itemname,a.asaddr,a.pcnt,a.ccount,b.iscancel
,b.payno,b.asname,b.taxamt,b.cdt,b.taxdate,b.ceoname,b.brno,b.grno,b.btype,b.bkind,b.manname,b.fgno,b.taxinfo,b.isreceipt
,CAST(AES_DECRYPT(UNHEX(b.telno), <include refid= "sql.digest" > </include> ) AS char) telno
,CAST(AES_DECRYPT(UNHEX(b.email), <include refid= "sql.digest" > </include> ) AS char) email
,u.userno cno,u.username,u.userid
,ua.isjoin
,row_number() over(order by b.cdt desc) rno
,count(a.taxno) over() pagetotalcount
2021-04-23 18:18:52 +09:00
,a.mgtkey
2020-10-12 14:39:23 +09:00
from (
2021-04-23 18:18:52 +09:00
select a.taxno,max(cm.cname) cname,a.asaddr,max(bk.bkname) bkname,max(ex.exname) exname,sum(pi.pcnt) pcnt,count(pi.pino) ccount, a.mgtkey
2020-10-12 14:39:23 +09:00
from paytax a
inner join paytaxitem b on b.taxno=a.taxno
inner join payitem pi on pi.pino=b.pino
left outer join cm cm on pi.ptype in (0,1,4) and cm.cmno=pi.itemno
inner join cm cm2 on cm2.cmno=cm.pcmno
left outer join book bk on pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
inner join users u on u.userno=a.cno
<dynamic prepend= "where" >
<isNotNull property= "payno" prepend= "and" > a.payno = #payno#</isNotNull>
<isNotNull property= "cno" prepend= "and" > a.cno = #cno#</isNotNull>
<isNotNull property= "nottaxno" prepend= "and" > a.taxno < > #nottaxno#</isNotNull>
<isNotNull property= "taxno" prepend= "and" > a.taxno=#taxno#</isNotNull>
<isNotNull property= "iscancel" prepend= "and" > ifnull(a.iscancel,0)=#iscancel#</isNotNull>
<isNotNull property= "cdts" prepend= "and" > a.cdt > = #cdts#</isNotNull>
<isNotNull property= "cdte" prepend= "and" > a.cdt < = #cdte#</isNotNull>
<isNotNull property= "tstatus0" prepend= "and" > a.taxdate is null</isNotNull>
<isNotNull property= "tstatus1" prepend= "and" > a.taxdate is not null</isNotNull>
<isNotNull property= "tstatus1" prepend= "and" > a.taxdate is not null</isNotNull>
<isNotNull property= "username" prepend= "and" > u.username like concat('%',#username#,'%')</isNotNull>
<isNotNull property= "userid" prepend= "and" > u.userid like concat('%',#userid#,'%')</isNotNull>
<isNotNull property= "manname" prepend= "and" > a.manname like concat('%',#manname#,'%')</isNotNull>
<isNotNull property= "itemname" prepend= "and" > (cm.cname like concat('%', #itemname#, '%') or bk.bkname like concat('%', #itemname#, '%') or ex.exname like concat('%', #itemname#, '%'))</isNotNull>
<isNotNull property= "cname" prepend= "and" > cm2.cname like concat('%', #cname#, '%')</isNotNull>
2021-03-24 17:13:42 +09:00
<isNotNull property= "paynos" prepend= "and" > a.payno like concat('%', #paynos#, '%')</isNotNull>
2020-10-12 14:39:23 +09:00
<isNotNull property= "nimp" prepend= "and" >
(u.username=#nimp# or u.userid=#nimp# or a.manname=#nimp# or cm.cname like concat('%', #nimp#, '%') or bk.bkname like concat('%', #nimp#, '%') or ex.exname like concat('%', #nimp#, '%') or cm2.cname like concat('%', #nimp#, '%'))
</isNotNull>
</dynamic>
group by a.taxno
) a
inner join paytax b on b.taxno=a.taxno
inner join users u on u.userno=b.cno
left outer join assign ua on ua.asno=u.asno
) a
<include refid= "sql.pagedynamic" > </include>
order by rno
</select>
<select id= "cr.paytaxitem" parameterClass= "long" resultClass= "payitem" >
select case pi.ptype when 2 then bk.bkname when 3 then ex.exname else cm.cname end itemname,pi.payamt,pi.pcnt,pi.ptype
,p.isgroup,p.payamt ppayamt,p.payoktime,p.ptype pptype
from paytax a
inner join paytaxitem b on b.taxno=a.taxno
inner join payitem pi on pi.pino=b.pino
inner join pay p on p.payno=pi.payno
left outer join cm cm on pi.ptype in (0,1,4) and cm.cmno=pi.itemno
left outer join book bk on pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
where a.taxno=#taxno#
</select>
2021-03-25 14:31:41 +09:00
<select id= "cr.paytaxitem2" parameterClass= "hashtable" resultClass= "payitem" >
select case pi.ptype when 2 then bk.bkname when 3 then ex.exname else cm.cname end itemname,pi.payamt,pi.pcnt,pi.ptype
,p.isgroup,p.payamt ppayamt,p.payoktime,p.ptype pptype
from paytax a
inner join paytaxitem b on b.taxno=a.taxno
inner join payitem pi on pi.pino=b.pino
inner join pay p on p.payno=pi.payno
left outer join cm cm on pi.ptype in (0,1,4) and cm.cmno=pi.itemno
left outer join book bk on pi.ptype=2 and bk.bkno=pi.itemno
left outer join exam ex on pi.ptype=3 and ex.exno=pi.itemno
<dynamic prepend= "where" >
<isNotNull property= "payno" prepend= "and" > a.payno=#payno#</isNotNull>
<isNotNull property= "taxno" prepend= "and" > a.taxno=#taxno#</isNotNull>
</dynamic>
</select>
2020-10-12 14:39:23 +09:00
<select id= "cr.paytaxes2" parameterClass= "long" resultClass= "paytax" >
select a.taxno,a.taxamt,a.taxdate
from paytax a
where a.payno=#payno#
</select>
2021-04-23 18:18:52 +09:00
<select id= "cr.paytax.formgtkey" parameterClass= "hashtable" resultClass= "paytax" >
2021-04-26 18:19:17 +09:00
select taxno, mgtkey
2021-04-23 18:18:52 +09:00
from paytax
2021-04-26 18:19:17 +09:00
where mgtkey like concat(#taxdate#,'%')
2021-04-23 18:18:52 +09:00
order by mgtkey desc
limit 1
</select>
2020-10-12 14:39:23 +09:00
<update id= "cr.paytax.save" parameterClass= "paytax" >
update paytax
set <include refid= "sql.up" > </include>
,asname=#asname#
,ceoname=#ceoname#
,brno=#brno#
,grno=#grno#
,btype=#btype#
,bkind=#bkind#
,manname=#manname#
,telno=HEX(AES_ENCRYPT(#telno#, <include refid= "sql.digest" > </include> ))
,email=HEX(AES_ENCRYPT(#email#, <include refid= "sql.digest" > </include> ))
,taxdate=#taxdate#
,taxinfo=#taxinfo#
2021-04-28 18:23:25 +09:00
,isreceipt=#isreceipt#
2020-10-12 14:39:23 +09:00
,iscancel=#iscancel#
2021-04-28 18:23:25 +09:00
,asaddr=#asaddr#
2021-04-23 18:18:52 +09:00
,mgtkey=#mgtkey#
2020-10-12 14:39:23 +09:00
where taxno=#taxno#
</update>
2020-12-22 17:37:18 +09:00
<select id= "cr.documnetspast" parameterClass= "hashtable" resultClass= "document" >
select
a.*
from (
select
a.no,a.kind,a.cg,a.cshape,a.username,a.userpno,a.typeman,a.edukind,a.typeedu,a.typegrade,a.typejob,a.cgname,a.completeno,a.companyname,a.companyaddr,a.brno,a.eino,a.btype
,a.bkind,a.ceoname,date_format(a.ssdate, '%Y-%m-%d') ssdate,date_format(a.sedate, '%Y-%m-%d') sedate,a.sctime,a.assign,a.slevel,a.uduty,a.phone,a.mname,a.mphone,a.sprice,a.rprice,a.rbank,a.rbankno,a.rbankuser,a.taxemail,a.syear
,row_number() over(order by a.ssdate desc) rno
,count(a.ssdate) over() pagetotalcount
from docprintpast a
where a.ssdate > = #ssdate# and a.sedate < = #sedate#
<isNotNull property= "syear" > and a.syear=#syear#</isNotNull>
<isNotNull property= "cg" > and a.cg=#cg#</isNotNull>
<isNotNull property= "cshape" > and a.cshape=#cshape#</isNotNull>
<isNotNull property= "typeman" > and a.typeman=#typeman#</isNotNull>
<isNotNull property= "edukind" > and a.edukind=#edukind#</isNotNull>
<isNotNull property= "typeedu" > and a.typeedu=#typeedu#</isNotNull>
<isNotNull property= "typegrade" > and a.typegrade=#typegrade#</isNotNull>
<isNotNull property= "typejob" > and a.typejob=#typejob#</isNotNull>
<isNotNull property= "word" >
<isNotNull property= "text" >
<isEqual property= "word" compareValue= "username" prepend= "and" > a.username like concat('%',#text#,'%')</isEqual>
<isEqual property= "word" compareValue= "userpno" prepend= "and" > a.userpno like concat('%',#text#,'%')</isEqual>
<isEqual property= "word" compareValue= "completeno" prepend= "and" > a.completeno like concat('%',#text#,'%')</isEqual>
<isEqual property= "word" compareValue= "companyname" prepend= "and" > a.companyname like concat('%',#text#,'%')</isEqual>
<isEqual property= "word" compareValue= "brno" prepend= "and" > a.username brno concat('%',#text#,'%')</isEqual>
</isNotNull>
</isNotNull>
) a
<include refid= "sql.pagedynamic" > </include>
order by a.rno
</select>
<select id= "cr.documnets.syear" parameterClass= "hashtable" resultClass= "textvalue" >
select a.syear value,a.syear text from docprintpast a
where a.syear is not null and a.syear < > ""
group by a.syear
</select>
<select id= "cr.documnets.cg" parameterClass= "hashtable" resultClass= "textvalue" >
select a.cg value,a.cg text from docprintpast a
where a.cg is not null and a.cg < > ""
group by a.cg
</select>
<select id= "cr.documnets.cshape" parameterClass= "hashtable" resultClass= "textvalue" >
select a.cshape value,a.cshape text from docprintpast a
where a.cshape is not null and a.cshape < > ""
group by a.cshape
</select>
<select id= "cr.documnets.typeman" parameterClass= "hashtable" resultClass= "textvalue" >
select a.typeman value,a.typeman text from docprintpast a
where a.typeman is not null and a.typeman < > ""
group by a.typeman
</select>
<select id= "cr.documnets.edukind" parameterClass= "hashtable" resultClass= "textvalue" >
select a.edukind value,a.edukind text from docprintpast a
where a.edukind is not null and a.edukind < > ""
group by a.edukind
</select>
<select id= "cr.documnets.typeedu" parameterClass= "hashtable" resultClass= "textvalue" >
select a.typeedu value,a.typeedu text from docprintpast a
where a.typeedu is not null and a.typeedu < > ""
group by a.typeedu
</select>
<select id= "cr.documnets.typegrade" parameterClass= "hashtable" resultClass= "textvalue" >
select a.typegrade value,a.typegrade text from docprintpast a
where a.typegrade is not null and a.typegrade < > ""
group by a.typegrade
</select>
<select id= "cr.documnets.typejob" parameterClass= "hashtable" resultClass= "textvalue" >
select a.typejob value,a.typejob text from docprintpast a
where a.typejob is not null and a.typejob < > ""
group by a.typejob
</select>
2021-04-15 16:13:10 +09:00
<select id= "cr.lectinningpage.totstudy" parameterClass= "hashtable" resultClass= "int" >
select ifnull(sum(totstudy),-1) totstudy
from lectinningpage
where lectno = #lectno# and cmino = #cmino# and cpno = #cpno#
</select>
2020-10-12 14:39:23 +09:00
</statements>
</sqlMap>