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 >
<typeAlias alias= "lect" type= "NP.Model.Lect, NP.Model" />
<typeAlias alias= "scdlect" type= "NP.Model.SCDLect, NP.Model" />
<typeAlias alias= "lectrs" type= "NP.Model.LectRS, NP.Model" />
<typeAlias alias= "edub2b" type= "NP.Model.EduB2B, NP.Model" />
<typeAlias alias= "lectinning" type= "NP.Model.LectInning, NP.Model" />
<typeAlias alias= "lectinningpage" type= "NP.Model.LectInningPage, NP.Model" />
<typeAlias alias= "pagelog" type= "NP.Model.PageLog, NP.Model" />
<typeAlias alias= "lectex" type= "NP.Model.LectEX, NP.Model" />
<typeAlias alias= "lectexq" type= "NP.Model.LectEXQ, NP.Model" />
<typeAlias alias= "lectsd" type= "NP.Model.LectSD, NP.Model" />
<typeAlias alias= "lectsdboard" type= "NP.Model.LectSDBoard, NP.Model" />
<typeAlias alias= "exam" type= "NP.Model.Exam, NP.Model" />
<typeAlias alias= "examuser" type= "NP.Model.ExamUser, NP.Model" />
<typeAlias alias= "examuserrenew" type= "NP.Model.ExamUserRenew, NP.Model" />
</alias>
<cacheModels >
<cacheModel id= "lectCache" implementation= "LRU" >
<flushInterval hours= "1" />
<property name= "CacheSize" value= "1000" />
</cacheModel>
</cacheModels>
<resultMaps > </resultMaps>
<statements >
<select id= "lect.lects.my" parameterClass= "hashtable" resultClass= "lect" >
select a.*
from (
select a.lectno,a.cmno,a.payno,a.pino,a.userno,a.status,a.iscomplete,a.isrebate,a.cdt
,pi.pstatus,pi.rstatus
,b.cname,b.classno,b.studytime,b.sstime,b.setime
,bc.refcode
,cg.cgname
,pcg.cgcode pcgcode
,c.tyear,c.tseq
2020-11-11 16:26:18 +09:00
,u.username,u.uduty
2020-10-12 14:39:23 +09:00
,case when uc.cname = '기타' then u.ccpositionetc else uc.cname end ccpositionname
,ua.asname
,row_number() over(order by <isNotNull property= "orderby" > $orderby$</isNotNull> <isNull property= "orderby" > a.cdt desc</isNull> ) rno
,count(a.cdt) over() pagetotalcount
from lect a
left outer join payitem pi on pi.pino=a.pino
inner join cm b on b.cmno=a.cmno
left outer join comcode bc on bc.ccode=b.certgradecc
inner join cg cg on cg.cgno=b.cgno
inner join cg pcg on pcg.cgno=cg.pcgno
inner join term c on c.tmno=b.tmno
inner join users u on u.userno=a.userno
left outer join comcode uc on uc.ccode=u.ccposition
left outer join assign ua on ua.asno=u.asno
where a.ischanged=0
<isNotNull property= "lectno" > and a.lectno=#lectno#</isNotNull>
<isNotNull property= "userno" > and a.userno=#userno#</isNotNull>
) a
<include refid= "sql.pagedynamic" > </include>
order by a.rno
</select>
<select id= "lect.check.lectinning.hascminning" parameterClass= "hashtable" resultClass= "long" >
select a.lectno
from lect a
inner join lectinning b on b.lectno=a.lectno
<dynamic prepend= "where" >
<isNotNull property= "cmno" prepend= "and" > a.cmno=#cmno#</isNotNull>
</dynamic>
limit 1
</select>
<select id= "lect.check.count" parameterClass= "hashtable" resultClass= "int" >
select count(a.lectno)
from lect a
<dynamic prepend= "where" >
<isNotNull property= "cmno" prepend= "and" > a.cmno=#cmno#</isNotNull>
<isNotNull property= "status" prepend= "and" > a.status in (1,2,3,4)</isNotNull>
<isNotNull property= "ispc" prepend= "and" > a.ispc=#ispc#</isNotNull>
</dynamic>
</select>
<select id= "lect.users" parameterClass= "hashtable" resultClass= "lect" >
select a.lectno,a.cmno,a.payno,a.pino,a.userno,a.status,a.iscomplete,a.orgcmno,a.attrate,a.isrebate,a.ispc
,b.username,b.isacceptemail
,CAST(AES_DECRYPT(UNHEX(b.email), <include refid= "sql.digest" > </include> ) AS char) email
,CAST(AES_DECRYPT(UNHEX(b.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
from lect a
inner join users b on b.userno=a.userno and b.status=1
<dynamic prepend= "where" >
<isNotNull property= "cmno" prepend= "and" > a.cmno=#cmno#</isNotNull>
<isNotNull property= "status" prepend= "and" > a.status=#status#</isNotNull>
</dynamic>
order by b.username
</select>
<select id= "lect.cms" parameterClass= "hashtable" resultClass= "cm" >
2020-11-24 13:19:48 +09:00
select a.cmno,c.tyear,c.tseq,d.cgname,b.quota,b.cshape,b.cname,b.classno,b.rstime,b.retime,a.countlect,a.countstandby,a.rno,a.pagetotalcount,a.countnoresult,a.countfail,a.countcomplete,a.countsuccess,a.countstanbypay,a.countstanbydraw
2020-10-12 14:39:23 +09:00
from (
select a.cmno,a.countlect,a.countstandby,a.rno,a.pagetotalcount,a.countnoresult,a.countfail,a.countcomplete,a.countsuccess,a.countstanbypay,a.countstanbydraw
from (
2020-11-24 13:19:48 +09:00
select b.cmno,count(d.lectno) countlect
,sum(case when ifnull(d.isready,0) = 1 and d.status = 3 then 1 else 0 end) countstandby
,sum(case when d.iscomplete is null then 1 else 0 end) countnoresult
,sum(d.iscomplete) countcomplete
,sum(case when d.iscomplete=0 then 1 else 0 end) countfail
,row_number() over(order by <isNotNull property= "orderby" > $orderby$</isNotNull> <isNull property= "orderby" > case when b.retime < now() then 1 else 2 end,b.retime desc</isNull> ) rno
2020-10-12 14:39:23 +09:00
,sum(case when d.lectno is not null and p.pstatus=1 then 1 else 0 end) countsuccess
,sum(case when d.lectno is not null and p.pstatus=21 then 1 else 0 end) countstanbypay
,sum(case when d.lectno is not null and p.pstatus = 22 then 1 else 0 end) countstanbydraw
,count(a.cdt) over() pagetotalcount
from term a
inner join cm b on b.tmno=a.tmno <isNotNull property= "cshape" > and b.cshape=#cshape#</isNotNull> <isNotNull property= "cnamelike" > and b.cname like concat('%',#cnamelike#,'%')</isNotNull>
inner join cg c on c.cgno=b.cgno
<isNotNull property= "islect" >
2020-11-24 13:19:48 +09:00
left outer join lect d on d.cmno=b.cmno and d.status < 5 and d.ischanged=0
2020-10-12 14:39:23 +09:00
left outer join users u on u.userno = d.userno
inner join payitem pi on pi.pino=d.pino
inner join pay p on p.payno=pi.payno
</isNotNull>
<isNull property= "islect" >
inner join lect d on d.cmno=b.cmno <isNotNull property= "status" > and d.status=#status#</isNotNull> and d.status < 5 and d.ischanged=0
inner join payitem pi on pi.pino=d.pino
inner join pay p on p.payno=pi.payno
</isNull>
<isNotNull property= "profno" >
inner join cmprof pr on pr.cmno=b.cmno and pr.userno=#profno#
</isNotNull>
<dynamic prepend= "where" >
<isNotNull property= "tyear" prepend= "and" > a.tyear=#tyear#</isNotNull>
<isNotNull property= "tmno" prepend= "and" > a.tmno=#tmno#</isNotNull>
<isNotNull property= "islect" prepend= "and" > b.isdel=0 and (u.status in (1,99) or u.status is null)</isNotNull>
</dynamic>
group by b.cmno
<isNotNull property= "nocomplete" > having sum(d.iscomplete) < 1</isNotNull>
<isNotNull property= "hascomplete" > having sum(d.iscomplete) > 0</isNotNull>
) a
<include refid= "sql.pagedynamic" > </include>
) a
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno
order by a.rno
</select>
<select id= "lect.lects" parameterClass= "hashtable" resultClass= "lect" >
2020-11-25 10:30:03 +09:00
select a.lectno,a.cdt,a.status,a.userno,a.oktime
2020-10-12 14:39:23 +09:00
,af.fileurl,af.fileno,af.orgname
,f.asname
,d.username cnoname,d.userid cnoid
2020-11-24 13:19:48 +09:00
,e.username,e.status ustatus,e.depart,e.userid,e.uduty
2020-10-12 14:39:23 +09:00
,e.kfcfyear,e.isassignuser,e.edus
,CAST(AES_DECRYPT(UNHEX(e.email), <include refid= "sql.digest" > </include> ) AS char) email
,CAST(AES_DECRYPT(UNHEX(e.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(e.telno), <include refid= "sql.digest" > </include> ) AS char) telno
,cc.cname ccpositionname
,c.pstatus,c.payno,c.userno payuserno
,b.rstatus
,a2.rstime,a2.retime,a2.sstime,a2.setime
,row_number() over(order by <isNotNull property= "orderby" > $orderby$</isNotNull> <isNull property= "orderby" > a.payno,a.pino</isNull> ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join cm a2 on a2.cmno=a.cmno
left outer join fileinfo af on af.fgno=a.fgno and af.isdel=0
inner join payitem b on b.pino=a.pino
inner join pay c on c.payno=b.payno
<isNotNull property= "paystatusnotin" > and c.pstatus not in ($paystatusnotin$)</isNotNull>
<isNotNull property= "paystatus" > and c.pstatus=#paystatus#</isNotNull>
<isNotNull property= "rstatus" > and c.rstatus=#rstatus#</isNotNull>
inner join users d on d.userno=c.userno
inner join users e on e.userno=a.userno and e.status in (1,99)
left outer join comcode cc on cc.ccode=e.ccposition
left outer join assign f on f.asno=e.asno
left outer join payrfditem rfdi on rfdi.pino=a.pino
left outer join payrfd rfd on rfd.rfdno=rfdi.rfdno
where a.ischanged=0
2020-11-24 13:19:48 +09:00
<isNotNull property= "isready" prepend= "and" > ifnull(a.isready,0)=#isready#</isNotNull>
2020-10-12 14:39:23 +09:00
<isNotNull property= "lectno" prepend= "and" > a.lectno=#lectno#</isNotNull>
<isNotNull property= "cmno" prepend= "and" > a.cmno=#cmno#</isNotNull>
<isNotNull property= "status" prepend= "and" > a.status=#status#</isNotNull>
<isNotNull property= "statusin" prepend= "and" > a.status in ($statusin$)</isNotNull>
<isNotNull property= "refundcall" > and (rfd.rstatus = 0 and rfdi.rfdno is not null)</isNotNull>
and (rfdi.rfdno is null or rfd.rfdno is not null)
order by rno
</select>
<select id= "lect.lects.att" parameterClass= "int" resultClass= "lect" >
select a.lectno,a.cdt,a.status
,p.pstatus,p.rstatus
,pu.username cnoname,pu.userid cnoid
,b.username,b.userid
,CAST(AES_DECRYPT(UNHEX(b.email), <include refid= "sql.digest" > </include> ) AS char) email
,CAST(AES_DECRYPT(UNHEX(b.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(b.telno), <include refid= "sql.digest" > </include> ) AS char) telno
,b.depart,b.kfcfyear,b.isassignuser,b.edus
,cc.cname ccpositionname
,c.isjoin,c.asname
,row_number() over(order by b.username) rno
from lect a
inner join pay p on p.payno=a.payno
<isNotNull property= "paystatusnotin" > and p.pstatus not in ($paystatusnotin$)</isNotNull>
inner join users pu on pu.userno=p.userno
inner join users b on b.userno=a.userno <isNotNull property= "status" > and b.status=#status#</isNotNull>
left outer join comcode cc on cc.ccode=b.ccposition
left outer join assign c on c.asno=b.asno
where a.cmno=#cmno#
2020-11-24 13:19:48 +09:00
<isNotNull property= "isready" > and ifnull(a.isready,0) = #isready# </isNotNull>
2020-10-12 14:39:23 +09:00
<isNotNull property= "status" > and a.status < 5 and p.pstatus in (1,22 ) </isNotNull>
<isNotNull property= "statusin" prepend= "and" > a.status in ($statusin$)</isNotNull>
and a.ischanged=0
order by rno
</select>
<update id= "lect.status" parameterClass= "hashtable" >
update lect set <include refid= "sql.up" > </include> ,status=#status#,oktime=case when oktime is null and #status# = 4 and status< > 4 then now() else oktime end where lectno=#lectno# and status in (3,4,5);
<isGreaterThan property= "status" compareValue= "3" >
update pay a
inner join lect b on b.lectno=#lectno# and b.payno=a.payno and b.status in (4,5)
set a.pstatus=case when b.status = 4 then 21 else 52 end
where a.pstatus=51;
update payitem a
inner join lect b on b.lectno=#lectno# and b.pino=a.pino and b.status in (4,5)
set a.pstatus=case when b.status=4 then 21 else 52 end
where a.pstatus=51
</isGreaterThan>
</update>
2020-11-24 13:19:48 +09:00
<update id= "lect.status3" parameterClass= "hashtable" >
2020-11-25 10:30:03 +09:00
update lect set <include refid= "sql.up" > </include> ,status=#status#,oktime=case when oktime is null and #status# = 4 and status=6 then now() else oktime end where lectno=#lectno# and status in (4,5,6);
2020-11-24 13:19:48 +09:00
<isGreaterThan property= "status" compareValue= "3" >
2020-11-25 10:30:03 +09:00
<isLessThan property= "status" compareValue= "6" >
2020-11-24 13:19:48 +09:00
update pay a
inner join lect b on b.lectno=#lectno# and b.payno=a.payno and b.status in (4,5)
set a.pstatus=case when b.status = 4 then 21 else 52 end
where a.pstatus=55;
update payitem a
inner join lect b on b.lectno=#lectno# and b.pino=a.pino and b.status in (4,5)
set a.pstatus=case when b.status=4 then 21 else 52 end
where a.pstatus=55
2020-11-25 10:30:03 +09:00
</isLessThan>
2020-11-24 13:19:48 +09:00
</isGreaterThan>
</update>
<update id= "lect.status2" parameterClass= "hashtable" >
update lect set <include refid= "sql.up" > </include>
2020-11-25 10:30:03 +09:00
,status = #status#
,oktime = now()
where lectno in ($lectnos$) and status in (4,5,6);
2020-11-24 13:19:48 +09:00
update pay a
2020-11-25 10:30:03 +09:00
inner join lect b on b.lectno in ($lectnos$) and b.payno=a.payno and b.status in (4,5,6)
set a.pstatus=case when b.status = 6 then 55 when b.status = 4 then 21 else 52 end
2020-11-24 13:19:48 +09:00
where a.pstatus in (55, 21, 52);
update payitem a
2020-11-25 10:30:03 +09:00
inner join lect b on b.lectno in ($lectnos$) and b.pino=a.pino and b.status in (4,5,6)
set a.pstatus=case when b.status = 6 then 55 when b.status = 4 then 21 else 52 end
2020-11-24 13:19:48 +09:00
where a.pstatus in (55, 21, 52)
</update>
2020-10-12 14:39:23 +09:00
<select id= "lect.cmforchange" parameterClass= "int" resultClass= "cm" >
select b.cmno,b.cname,b.classno,b.cshape
,t.tyear,t.tseq
from cm a
inner join cm b on b.ismaster=0 and b.pcmno=a.pcmno and b.cmno < > #cmno# and b.setime is not null and b.setime > now() and b.isuse=1 and b.isdel=0
inner join term t on t.tmno=b.tmno
left outer join lect c on c.cmno=b.cmno and c.status in (1,3,4) and c.ischanged=0
where a.cmno=#cmno#
group by b.cmno,b.cname,b.classno,b.quota,b.cshape
,t.tyear,t.tseq
having b.quota = 0 or b.quota > count(c.lectno)
order by b.cname,b.classno,b.setime
</select>
<update id= "lect.lectchange" parameterClass= "hashtable" >
update lect set <include refid= "sql.up" > </include>
,ischanged=1
where lectno=#lectno#;
insert into lect (cmno,payno,pino,userno,status,iscomplete,orgcmno,attrate,isrebate,ispc,isjoin,fgno,ischanged,<include refid= "sql.inc" > </include> )
select #cmno#,payno,pino,userno,status,null,cmno,0,isrebate,ispc,isjoin,fgno,0,<include refid= "sql.inv" > </include>
from lect a
where a.lectno=#lectno#
</update>
<select id= "lect.scdlects" parameterClass= "hashtable" resultClass= "scdlect" >
2020-11-05 11:07:44 +09:00
select a.scdno,a.dday,a.dtime,a.istalk,a.isemail,a.issms,a.isuse
2020-10-12 14:39:23 +09:00
from scdlect a
order by a.scdno
</select>
<update id= "lect.scdlect.save" parameterClass= "scdlect" >
2020-11-05 11:07:44 +09:00
insert into scdlectlog (userno,scdno,dday,dtime,istalk,isemail,issms,isuse,<include refid= "sql.inc" > </include> )
select #uno#,scdno,dday,dtime,istalk,isemail,issms,isuse,<include refid= "sql.inv" > </include>
2020-10-12 14:39:23 +09:00
from scdlect;
update scdlect a
inner join (
2020-11-05 11:07:44 +09:00
<iterate property= "Ds" open= "" conjunction= "union all" close= "" > select #Ds[].scdno# scdno,#Ds[].dday# dday,#Ds[].dtime# dtime,#Ds[].istalk# istalk,#Ds[].isemail# isemail,#Ds[].issms# issms,#Ds[].isuse# isuse </iterate>
2020-10-12 14:39:23 +09:00
) b on b.scdno=a.scdno
2020-11-05 11:07:44 +09:00
set a.dday=b.dday,a.dtime=b.dtime,a.istalk=b.istalk,a.isemail=b.isemail,a.issms=b.issms,a.isuse=b.isuse,a.udt=<include refid= "sql.now" > </include> ,a.uno=#uno#,a.uip=#uip#;
2020-10-12 14:39:23 +09:00
2020-11-05 11:07:44 +09:00
insert into scdlect (scdno,dday,dtime,istalk,isemail,issms,isuse,<include refid= "sql.inc" > </include> )
select a.scdno,a.dday,a.dtime,a.istalk,a.isemail,a.issms,a.isuse,<include refid= "sql.inv" > </include>
2020-10-12 14:39:23 +09:00
from (
2020-11-05 11:07:44 +09:00
<iterate property= "Ds" open= "" conjunction= "union all" close= "" > select #Ds[].scdno# scdno,#Ds[].dday# dday,#Ds[].dtime# dtime,#Ds[].istalk# istalk,#Ds[].isemail# isemail,#Ds[].issms# issms,#Ds[].isuse# isuse </iterate>
2020-10-12 14:39:23 +09:00
) a
left outer join scdlect b on b.scdno=a.scdno
where b.scdno is null
</update>
<sql id= "sql.encourages" parameterClass= "hashtable" resultClass= "scdlect" >
2020-11-05 11:07:44 +09:00
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
2020-10-13 16:10:18 +09:00
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,CAST(AES_DECRYPT(UNHEX(d.email), <include refid= "sql.digest" > </include> ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,null place
2020-10-12 14:39:23 +09:00
from scdlect a
inner join cm b on b.ismaster=0 and date_format(b.setime,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d') and b.cshape in (0,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.attrate < 80 and c.status=1 and c.ischanged=0
inner join users d on d.userno=c.userno and d.status=1
where a.scdno < 3 and a.isuse=1 and a.dtime=#dtime#
union all
2020-11-05 11:07:44 +09:00
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
2020-10-13 16:10:18 +09:00
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,CAST(AES_DECRYPT(UNHEX(d.email), <include refid= "sql.digest" > </include> ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,null place
2020-10-12 14:39:23 +09:00
from scdlect a
inner join cm b on b.ismaster=0 and date_format(b.setime,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d') and b.cshape in (0,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0
inner join users d on d.userno=c.userno and d.status=1
inner join cmex e on e.cmno=c.cmno and e.extype=case when a.scdno=3 then 0 else 1 end and e.isdel=0
left outer join lectex f on f.lectno=c.lectno and f.exno=e.exno
where a.scdno > 2 and a.scdno < 5 and a.isuse=1 and a.dtime=#dtime# and f.lectno is null
union all
2020-11-05 11:07:44 +09:00
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
2020-10-13 16:10:18 +09:00
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,CAST(AES_DECRYPT(UNHEX(d.email), <include refid= "sql.digest" > </include> ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,null place
2020-10-12 14:39:23 +09:00
from scdlect a
inner join cm b on b.ismaster=0 and date_format(b.setime,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d') and b.cshape in (0,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0
inner join users d on d.userno=c.userno and d.status=1
inner join cmsd e on e.cmno=c.cmno and e.sdtype=0 and e.isdel=0
left outer join lectsd f on f.lectno=c.lectno and f.sdno=e.sdno
where a.scdno=5 and a.isuse=1 and a.dtime=#dtime# and f.lectno is null
union all
2020-11-05 11:07:44 +09:00
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
2020-10-12 14:39:23 +09:00
,d.userno,d.username
2020-10-13 16:10:18 +09:00
,b.cmno cmexno,b.cname,null stime
,CAST(AES_DECRYPT(UNHEX(d.email), <include refid= "sql.digest" > </include> ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,null place
2020-10-12 14:39:23 +09:00
from scdlect a
inner join cm b on b.ismaster=0 and date_format(b.setime,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d') and b.cshape in (0,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0
inner join users d on d.userno=c.userno and d.status=1
inner join cmsd e on e.cmno=c.cmno and e.sdtype=1 and e.isdel=0
left outer join lectsd f on f.lectno=c.lectno and f.sdno=e.sdno
where a.scdno=6 and a.isuse=1 and a.dtime=#dtime# and f.lectno is null
union all
2020-11-05 11:07:44 +09:00
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
2020-10-13 16:10:18 +09:00
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,CAST(AES_DECRYPT(UNHEX(d.email), <include refid= "sql.digest" > </include> ) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <include refid= "sql.digest" > </include> ) AS char) mobile
,null place
2020-10-12 14:39:23 +09:00
from scdlect a
inner join cm b on b.ismaster=0 and date_format(b.setime,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d') and b.cshape in (0,2) and b.isuse=1 and b.isdel=0
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0
inner join users d on d.userno=c.userno and d.status=1
inner join cmrs e on e.cmno=c.cmno and e.rstype=0 and e.isdel=0
left outer join lectrs f on f.lectno=c.lectno and f.rsno=e.rsno
where a.scdno=7 and a.isuse=1 and a.dtime=#dtime# and f.lectno is null
union all
2020-11-05 11:07:44 +09:00
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
2020-10-13 16:10:18 +09:00
,d.userno,d.username
,b.cmno cmexno,b.cname,b.sstime
,CAST(AES_DECRYPT(UNHEX(d.email), <include refid= "sql.digest" > </include> ) AS char),CAST(AES_DECRYPT(UNHEX(d.mobile), <include refid= "sql.digest" > </include> ) AS char)
,bc.cname place
2020-10-12 14:39:23 +09:00
from scdlect a
inner join cm b on b.ismaster=0 and date_format(b.sstime,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d') and b.cshape =1 and b.isuse=1 and b.isdel=0
2020-10-13 16:10:18 +09:00
left outer join comcode bc on bc.ccode=b.studyplace
2020-10-12 14:39:23 +09:00
inner join lect c on c.cmno=b.cmno and c.status=1 and c.ischanged=0
inner join users d on d.userno=c.userno and d.status=1
where a.scdno=8 and a.isuse=1 and a.dtime=#dtime#
union all
2020-11-05 11:07:44 +09:00
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
2020-10-13 16:10:18 +09:00
,d.userno,d.username
,b.exno cmexno,b.exname cname,b.estime
,CAST(AES_DECRYPT(UNHEX(d.email), <include refid= "sql.digest" > </include> ) AS char),CAST(AES_DECRYPT(UNHEX(d.mobile), <include refid= "sql.digest" > </include> ) AS char)
,b.elocation place
2020-10-12 14:39:23 +09:00
from scdlect a
inner join exam b on date_format(b.estime,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d') and b.isopen=1
inner join examuser c on c.exno=b.exno and c.status=1 and c.pstatus=1
inner join users d on d.userno=c.userno and d.status=1
where a.scdno=9 and a.isuse=1 and a.dtime=#dtime#
</sql>
<select id= "lect.encourages" parameterClass= "hashtable" resultClass= "scdlect" >
insert into alarms (userno,atime,scdno,cmexno,dday,isdel,<include refid= "sql.inc" > </include> )
select a.userno,<include refid= "sql.now" > </include> ,a.scdno,a.cmexno,a.dday,0,<include refid= "sql.inv" > </include>
from (
<include refid= "sql.encourages" > </include>
) a;
<include refid= "sql.encourages" > </include>
</select>
<select id= "lect.cmrss" parameterClass= "hashtable" resultClass= "cmrs" >
select a.*
from (
select a.*
,row_number() over(order by a.tyear desc,a.tseq,a.cname,a.classno ) rno
,count(a.cdt) over() pagetotalcount
from (
select d.rsno,b.cmno,a.tyear,a.tseq,c.cgname,b.cshape,b.cname,b.classno,b.sstime,b.setime,d.rstype
,count(distinct e.lectno) countlect,count(distinct f.lectno) countok,a.cdt
from term a
inner join cm b on b.ismaster=0 and b.tmno=a.tmno <isNotNull property= "cshape" > and b.cshape=#cshape#</isNotNull> <isNotNull property= "cnamelike" > and b.cname like concat('%',#cnamelike#,'%')</isNotNull>
inner join cg c on c.cgno=b.cgno
inner join cmrs d on d.cmno=b.cmno <isNotNull property= "rstype" > and d.rstype=#rstype#</isNotNull> and d.isdel=0
inner join lect e on e.cmno=d.cmno and e.status =1 and e.ischanged=0
left outer join lectrs f on f.lectno=e.lectno and f.rsno=d.rsno
<dynamic prepend= "where" >
<isNotNull property= "tyear" prepend= "and" > a.tyear=#tyear#</isNotNull>
<isNotNull property= "tmno" prepend= "and" > a.tmno=#tmno#</isNotNull>
</dynamic>
group by d.rsno,b.cmno,a.tyear,a.tseq,c.cgname,b.cshape,b.cname,b.classno,b.sstime,b.setime,d.rstype
) a
) a
<include refid= "sql.pagedynamic" > </include>
order by a.rno
</select>
<select id= "lect.cmrs" parameterClass= "int" resultClass= "cmrs" >
select a.rsno,a.rstype,a2.rscno,a2.rscname,b.cshape,b.cname,b.classno,b.rstime,b.retime,b.sstime,b.setime
,c.tyear,c.tseq
,count(distinct d.lectno) countlect,count(distinct e.lectno) countok
from cmrs a
inner join rsc a2 on a2.rscno=a.rscno
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
inner join lect d on d.cmno=b.cmno and d.status=1 and d.ischanged=0
left outer join lectrs e on e.lectno=d.lectno and e.rsno=a.rsno
where a.rsno=#rsno#
group by a.rsno,a.rstype,a2.rscno,a2.rscname,b.cshape,b.cname,b.classno,b.rstime,b.retime,b.sstime,b.setime,c.tyear,c.tseq
</select>
<select id= "lect.cmrscqs" parameterClass= "int" resultClass= "rscq" >
select a.rsno
,b.rscqno
,c.qno,c.qtext,c.atype
,d.qino,d.qitext
,sum(case when concat(',',e.atext,',') like concat('%,',d.qino,',%') then 1 else 0 end) scount
,count(e.atext) acount
,group_concat(e.atext order by e.cdt separator '<![CDATA[<br />]]> ') atext
from cmrs a
inner join rscq b on b.rscno=a.rscno
inner join question c on c.qno=b.qno
left outer join questionitem d on d.qno=c.qno and d.isdel=0
left outer join lectrs e on e.rsno=a.rsno and e.rscqno=b.rscqno
where a.rsno=#rsno#
group by a.rsno
,b.rscqno
,c.qno,c.qtext,c.atype
,d.qino,d.qitext
order by b.dseq,b.qno,d.qino
</select>
<select id= "lect.rscq" parameterClass= "int" resultClass= "rscq" >
select a.rscqno,a.qno,q.atype,qi.qino,row_number() over(partition by qi.qno order by qi.qino) rno
from rscq a
inner join question q on q.qno=a.qno
left outer join questionitem qi on qi.qno=q.qno and qi.isdel=0
where a.rscno=#rscno#
order by a.dseq
</select>
<select id= "lect.lectrss" parameterClass= "int" resultClass= "lectrs" >
select a.rsno,b.lectno,c.rscno,c.rscqno,u.username,u.userid,uc.cname ccpositionname,b.isrebate,c.cdt,c.atext
from cmrs a
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users u on u.userno=b.userno
left outer join assign ua on ua.asno=u.asno
left outer join comcode uc on uc.ccode=u.ccposition
inner join lectrs c on c.lectno=b.lectno and c.rsno=a.rsno
inner join rscq rq on rq.rscqno=c.rscqno
inner join question q on q.qno=rq.qno
where a.rsno=#rsno#
order by u.username,u.userno,rq.dseq,rq.rscqno
</select>
<select id= "lect.edub2bs" parameterClass= "hashtable" resultClass= "edub2b" >
select a.*
from (
select a.eduno,a.etype,a.userno,a.edate,a.esubject,a.etarget,a.ecount,a.eplace,a.ecomment,a.compname,a.ceoname,a.brno,a.addr,a.btype,a.bkind,a.manname
,CAST(AES_DECRYPT(UNHEX(a.email), <include refid= "sql.digest" > </include> ) AS char) email
,CAST(AES_DECRYPT(UNHEX(a.telno), <include refid= "sql.digest" > </include> ) AS char) telno
,a.fgno,a.cdt
,b.userid,b.username
,c.asname
,row_number() over(order by <isNotNull property= "orderby" > $orderby$</isNotNull> <isNull property= "orderby" > a.cdt desc</isNull> ) rno
,count(a.cdt) over() pagetotalcount
from edub2b a
inner join users b on b.userno=a.userno
left outer join assign c on c.asno=b.asno
<dynamic prepend= "where" >
<isNotNull property= "eduno" prepend= "and" > a.eduno=#eduno#</isNotNull>
</dynamic>
) a
<include refid= "sql.pagedynamic" > </include>
order by a.rno
</select>
<select id= "lect.checkuser" parameterClass= "hashtable" resultClass= "lect" >
select a.lectno,a.cmno,a.userno,b.userid
from lect a
inner join users b on b.userno = a.userno
<dynamic prepend= "where" >
<isNotNull property= "cmno" prepend= "and" > a.cmno = #cmno#</isNotNull>
<isNotNull property= "userno" prepend= "and" > a.userno=#userno#</isNotNull>
<isNotEmpty property= "cmnos" prepend= "and" > a.cmno in ($cmnos$)</isNotEmpty>
<isNotEmpty property= "userids" prepend= "and" > b.userid in ($userids$)</isNotEmpty>
</dynamic>
and a.ischanged=0 and a.status < 5
</select>
<select id= "lect.checkuser2" parameterClass= "hashtable" resultClass= "lect" >
select a.lectno,a.cmno,a.userno
from lect a
where
<isNotEmpty property= "cmnos" > a.cmno in ($cmnos$) and</isNotEmpty> a.ischanged=0 and a.status < 5
</select>
<select id= "lect.checkuser3" parameterClass= "hashtable" resultClass= "lect" >
select a.userno,a.lectno,a.cmno
from lect a
where
<isNotEmpty property= "cmnos" > a.cmno in ($cmnos$) and</isNotEmpty> a.ischanged=0 and a.status < 5
group by a.userno
</select>
<select id= "lect.attoffs" parameterClass= "datetime" resultClass= "cminning" >
select c.tyear,c.tseq
,a.cmno,a.cname,a.classno
,b.cmino,b.week,b.iseq,b.ititle,b.idate,b.ist,b.iet
,d.username
from cm a
inner join cminning b on b.cmno=a.cmno and b.isonline=0 and b.idate=#edate#
inner join term c on c.tmno=a.tmno
left outer join users d on d.userno=b.userno
where a.ismaster=0 and a.sstime < =#edate# and a.setime > = #edate# and a.isuse=1 and a.isdel=0
order by b.iet,a.cname
</select>
<select id= "lect.cminning" parameterClass= "long" resultClass= "cminning" >
select c.tyear,c.tseq
,b.cshape,b.cname,b.classno
,a.cmino,a.ititle,a.idate,a.ist,a.iet
from cminning a
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
where a.cmino=#cmino#
</select>
<select id= "lect.lectinnings.foratt" parameterClass= "long" resultClass= "lectinning" >
select a.cmino,b.lectno,c.userno
,ca.asname,c.username,c.userid,d.stime,d.etime,d.istatus
,row_number() over(order by d.udt desc,c.username) rno
,count(a.cdt) over() pagetotalcount
from cminning a
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
left outer join assign ca on ca.asno=c.asno
left outer join lectinning d on d.lectno=b.lectno and d.cmino=a.cmino
where a.cmino=#cmino#
order by rno
</select>
<select id= "lect.atts" parameterClass= "hashtable" resultClass= "lect" >
select a.lectno,a.isrebate,a.attrate,a.stime,a.sip,a.etime,a.eip
,b.username,b.userid,b.userno
,c.asname
,count(d.cmino) countinning
,sum(case when e.istatus=2 then 1 else 0 end) countattok
,row_number() over(order by <isNotNull property= "orderby" > $orderby$</isNotNull> <isNull property= "orderby" > b.username</isNull> ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join users b on b.userno=a.userno <isNotNull property= "ustatus" > and b.status=#ustatus#</isNotNull>
left outer join assign c on c.asno=b.asno
inner join cminning d on d.cmno=a.cmno
left outer join lectinning e on e.lectno=a.lectno and e.cmino=d.cmino
where a.ischanged=0 <isNotNull property= "cmno" > and a.cmno=#cmno#</isNotNull> <isNotNull property= "status" > and a.status=#status#</isNotNull> <isNotNull property= "isrebate" > and a.isrebate=#isrebate#</isNotNull>
group by a.lectno,a.isrebate,a.attrate,a.stime,a.sip,a.etime,a.eip
,b.username,b.userid
,c.asname
order by rno
</select>
<select id= "lect.lectinnings.bycmino" parameterClass= "hashtable" resultClass= "lectinning" >
select b.lectno,a.cmino
,u.userno,u.userid,u.username
,ua.asname
,c.stime,c.etime,c.istatus
,row_number() over(order by u.username) rno
,count(b.lectno) over() pagetotalcount
from cminning a
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users u on u.userno=b.userno and u.status=1
left outer join assign ua on ua.asno=u.asno
left outer join lectinning c on c.lectno=b.lectno and c.cmino=a.cmino
where a.cmino=#cmino#
group by b.lectno,a.cmino,u.userno,u.userid,u.username,ua.asname,c.stime,c.etime,c.istatus
order by u.username
</select>
<select id= "lect.lectinningpages" parameterClass= "hashtable" resultClass= "lectinningpage" >
select a.lectno,b.cmino,d.logno,f.sstime,f.setime
,b.iseq,b.isonline,b.ititle,b.atime
,c.istatus,c.totstudy litotstudy,c.stime listime,c.etime lietime,c.sip lisip,c.eip lieip,c.ispcs liispcs,c.ispce liispce
,c.statustime,c.statusreason,c.statususerno,cu.username statususername,cu.userid statususerid
,d.totstudy,d.stime,d.etime,d.sip,d.eip,d.ispc,d.ispc ispcs,d.webkitinfo
,e.pseq,e.cpno
from lect a
inner join cminning b on b.cmno=a.cmno
inner join cm f on f.cmno=a.cmno
left outer join lectinning c on c.lectno=a.lectno and c.cmino=b.cmino
left outer join users cu on cu.userno=c.statususerno
left outer join lectinningpage d on d.lectno=c.lectno and d.cmino=c.cmino
left outer join ctpage e on e.cpno=d.cpno
<dynamic prepend= "where" >
<isNotNull property= "lectno" prepend= "and" > a.lectno=#lectno#</isNotNull>
<isNotNull property= "userno" prepend= "and" > a.userno=#userno#</isNotNull>
</dynamic>
order by b.iseq,d.stime
</select>
<select id= "lect.pagelogs" parameterClass= "hashtable" resultClass= "pagelog" >
select a.cdt,a.uip,b.pagename,a.loginfo
from pagelog a
left outer join menupage b on b.pno=a.pno
<dynamic prepend= "where" >
<isNotNull property= "logsite" prepend= "and" > a.logsite=#logsite#</isNotNull>
<isNotNull property= "userno" prepend= "and" > a.userno=#userno#</isNotNull>
<isNotNull property= "start" prepend= "and" > a.cdt between #start# and #end#</isNotNull>
<isNotNull property= "from" prepend= "and" > a.cdt > = #from#</isNotNull>
<isNotNull property= "to" prepend= "and" > a.cdt < = #to#</isNotNull>
</dynamic>
union all
select a.cdt,a.uip,'로그인', '로그인'
from loginlog a
<dynamic prepend= "where" >
<isNotNull property= "logsite" prepend= "and" > a.logsite=#logsite#</isNotNull>
<isNotNull property= "userno" prepend= "and" > a.userno=#userno# and a.loginstatus < 2</isNotNull>
<isNotNull property= "start" prepend= "and" > a.cdt between #start# and #end#</isNotNull>
<isNotNull property= "from" prepend= "and" > a.cdt > = #from#</isNotNull>
<isNotNull property= "to" prepend= "and" > a.cdt < = #to#</isNotNull>
</dynamic>
order by cdt desc
</select>
<select id= "lect.lectexes" parameterClass= "hashtable" resultClass= "lectex" >
select a.lectno,a.userno,a.cmno,a.isrebate
,b.exno
,c.estart,c.eend,c.eip,c.tpoint,c.recount,c.entercount,c.cblock
,d.username,d.userid
,e.asname
,row_number() over(order by <isNotNull property= "orderby" > $orderby$</isNotNull> <isNull property= "orderby" > d.username</isNull> ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join cmex b on b.isdel=0 <isNotNull property= "exno" > and b.exno=#exno#</isNotNull>
left outer join lectex c on c.lectno=a.lectno and c.exno=b.exno
inner join users d on d.userno=a.userno
left outer join assign e on e.asno=d.asno
where a.cmno=#cmno# and a.status=1 and a.ischanged=0
<isNotNull property= "isrebate" > and a.isrebate=#isrebate#</isNotNull>
<isNotNull property= "estate" >
<isEqual property= "estate" compareValue= "0" > and c.estart is null</isEqual>
<isEqual property= "estate" compareValue= "1" > and c.estart is not null and c.eend is null</isEqual>
<isEqual property= "estate" compareValue= "2" > and c.eend is not null</isEqual>
</isNotNull>
order by rno
</select>
<update id= "lect.reexam" parameterClass= "hashtable" >
update lectex set estart=null,eend=null,eip=null,tpoint=0,recount=recount+1,entercount=0,cblock=0 where lectno=#lectno# and exno=#exno#;
update lectexq a
inner join cmex b on b.exno=a.exno and b.eqtype=0
set a.atext=null,a.qinos=null,a.cpoint=0,a.iscorrect=null
where a.lectno=#lectno# and a.exno=#exno#;
delete from lectexq where lectno=#lectno# and exno=#exno# and eqno in (
select a.eqno
from (
select b.eqno
from cmex a
inner join lectexq b on b.lectno=#lectno# and b.exno=a.exno
where a.exno=#exno# and a.eqtype=1
) a
);
insert into lectexq (lectno,exno,eqno,cpoint,dpoint,qseq,<include refid= "sql.inc" > </include> )
select a.lectno,a.exno,a.eqno,0,a.rpoint,row_number() over(order by case when a.israndq=0 then a.qseq else rand() end),<include refid= "sql.inv" > </include>
from (
select a.*
from (
select a.lectno,a.exno,d.eqno,c.israndq,el.qcount,d.rpoint,d.qseq,rank() over(partition by el.qdiff,el.cc1,el.cc2,el.cc3,el.cc4,el.cc5 order by rand()) rank
from (select #lectno# lectno, #exno# exno) a
left outer join lectex b on b.lectno=a.lectno and b.exno=a.exno
inner join cmex c on c.exno=a.exno and c.eqtype=1
inner join cmexlayer el on el.exno=c.exno and el.qcount > 0
inner join cmexq d on d.exno=el.exno
inner join question e on e.qno=d.qno
and e.qdiff=case when el.qdiff=0 then e.qdiff else el.qdiff end
and e.cc1=case when el.cc1=0 then e.cc1 else el.cc1 end
and e.cc2=case when el.cc2=0 then e.cc2 else el.cc2 end
and e.cc3=case when el.cc3=0 then e.cc3 else el.cc3 end
and e.cc4=case when el.cc4=0 then e.cc4 else el.cc4 end
and e.cc5=case when el.cc5=0 then e.cc5 else el.cc5 end
) a
where a.rank < = a.qcount
) a
order by rand();
</update>
<sql id= "lectexcreate" >
insert into lectexq (lectno,exno,eqno,cpoint,dpoint,qseq,<include refid= "sql.inc" > </include> )
select a.lectno,a.exno,d.eqno,0,d.rpoint,row_number() over(order by case when c.israndq=0 then d.qseq else rand() * d.qseq end),<include refid= "sql.inv" > </include>
from (select #lectno# lectno, #exno# exno) a
<isNotNull property= "userno" >
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
</isNotNull>
left outer join lectex b on b.lectno=a.lectno and b.exno=a.exno
inner join cmex c on c.exno=a.exno and c.eqtype=0
inner join cmexq d on d.exno=c.exno
inner join (
select count(b.lectno) exq
from (select 1 col1) a
left outer join lectexq b on b.lectno=#lectno# and b.exno=#exno#
) z on z.exq < 1
where b.lectno is null
order by rand();
insert into lectexq (lectno,exno,eqno,cpoint,dpoint,qseq,<include refid= "sql.inc" > </include> )
select a.lectno,a.exno,a.eqno,0,a.rpoint,row_number() over(order by case when a.israndq=0 then a.qseq else rand() end),<include refid= "sql.inv" > </include>
from (
select a.lectno,a.exno,d.eqno,d.rpoint,el.qcount,c.israndq,d.qseq,rank() over(partition by el.qdiff, el.cc1, el.cc2, el.cc3, el.cc4, el.cc5 order by rand()) rank
from (select #lectno# lectno, #exno# exno) a
<isNotNull property= "userno" >
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
</isNotNull>
left outer join lectex b on b.lectno=a.lectno and b.exno=a.exno
inner join cmex c on c.exno=a.exno and c.eqtype=1
inner join cmexlayer el on el.exno=c.exno and el.qcount > 0
inner join cmexq d on d.exno=el.exno
inner join question e on e.qno=d.qno
and e.qdiff=case when el.qdiff=0 then e.qdiff else el.qdiff end
and e.cc1=case when el.cc1=0 then e.cc1 else el.cc1 end
and e.cc2=case when el.cc2=0 then e.cc2 else el.cc2 end
and e.cc3=case when el.cc3=0 then e.cc3 else el.cc3 end
and e.cc4=case when el.cc4=0 then e.cc4 else el.cc4 end
and e.cc5=case when el.cc5=0 then e.cc5 else el.cc5 end
where b.lectno is null
) a
inner join (
select count(b.lectno) exq
from (select 1 col1) a
left outer join lectexq b on b.lectno=#lectno# and b.exno=#exno#
) z on z.exq < 1
where a.rank < = a.qcount
order by rand();
insert into lectex (lectno,exno,tpoint,recount,cblock,<include refid= "sql.inc" > </include> )
select a.lectno,a.exno,0,0,0,<include refid= "sql.inv" > </include>
from (select #lectno# lectno, #exno# exno) a
<isNotNull property= "userno" >
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
</isNotNull>
left outer join lectex b on b.lectno=a.lectno and b.exno=a.exno
where b.lectno is null;
</sql>
<select id= "lect.lectex" parameterClass= "hashtable" resultClass= "lectex" >
<include refid= "lectexcreate" > </include>
select a.exno,a.tpoint extpoint
,b.lectno,b.tpoint
,c.userno,c.username,c.userid
,d.asname
from cmex a
inner join lectex b on b.lectno=#lectno# and b.exno=a.exno
inner join lect b2 on b2.lectno=b.lectno
inner join users c on c.userno=b2.userno
left outer join assign d on d.asno=c.asno
where a.exno=#exno#
</select>
<select id= "lect.lectexq" parameterClass= "hashtable" resultClass= "lectexq" >
select a.lectno,a.exno,a.eqno,a.atext,a.qinos,a.cpoint,a.dpoint,a.iscorrect,a.qseq
,c.qno,c.atype,c.qtext
from lectexq a
inner join cmexq b on b.eqno=a.eqno
inner join question c on c.qno=b.qno
where a.lectno=#lectno# and a.exno=#exno#
order by a.qseq
</select>
<select id= "lect.lectexqs" parameterClass= "hashtable" resultClass= "questionitem" >
select c.qno
,sum(case when concat(',',a.atext,',') like concat('%,',c.qino,',%') then 1 else 0 end) countselect
,avg(case when concat(',',a.atext,',') like concat('%,',c.qino,',%') then 100 else 0 end) avgselect
from lectexq a
inner join cmexq b on b.eqno=a.eqno
inner join questionitem c on c.qno=b.qno
where a.exno=#exno# and a.eqno in ($eqnos$) and a.atext is not null
group by c.qno
</select>
<update id= "lect.lectexq.point" parameterClass= "hashtable" >
update lectexq set <include refid= "sql.up" > </include>
,rechecktime=<include refid= "sql.now" > </include>
,cpoint=#cpoint#
where lectno=#lectno# and exno=#exno# and eqno=#eqno#;
update lectex a
inner join (
select lectno, sum(cpoint) tpoint
from lectexq where lectno=#lectno# and exno=#exno#
group by lectno
) b on b.lectno=a.lectno
set a.udt=<include refid= "sql.now" > </include> ,a.uno=#uno#,a.uip=#uip#
,a.tpoint=b.tpoint
,a.rechecktime=<include refid= "sql.now" > </include>
where a.lectno=#lectno# and a.exno=#exno#
</update>
<select id= "lect.lectsds" parameterClass= "hashtable" resultClass= "lectsd" >
select a.lectno,a.userno,a.cmno,a.isrebate
,b.sdno
,c.atext,c.fgno,c.copyrate,c.iscopy,c.cpoint,c.feedb,c.submittime,c.submitip,c.checktime,c.checkip
,cf.fileno,cf.orgname,cf.fileurl
,d.username,d.userid
,e.asname
,row_number() over(order by <isNotNull property= "orderby" > $orderby$</isNotNull> <isNull property= "orderby" > d.username</isNull> ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join cmsd b on b.isdel=0 <isNotNull property= "sdno" > and b.sdno=#sdno#</isNotNull>
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
left outer join fileinfo cf on cf.fgno=c.fgno and cf.isdel=0
inner join users d on d.userno=a.userno
left outer join assign e on e.asno=d.asno
where a.cmno=#cmno# and a.status=1 and a.ischanged=0
<isNotNull property= "isrebate" > and a.isrebate=#isrebate#</isNotNull>
<isNotNull property= "sdstate" >
<isEqual property= "sdstate" compareValue= "0" > and c.submittime is null</isEqual>
<isEqual property= "sdstate" compareValue= "1" > and c.submittime is not null</isEqual>
</isNotNull>
order by rno
</select>
<select id= "lect.lectsd" parameterClass= "hashtable" resultClass= "lectsd" >
select a.sdno,a.tpoint sdtpoint
,b.lectno,b.atext,b.fgno,b.copyrate,b.iscopy,b.cpoint,b.feedb,b.submittime,b.checktime
,c.userno,c.username,c.userid
,d.asname
,f.fileno,f.orgname,f.fileurl
from cmsd a
inner join lect b2 on b2.lectno=#lectno#
inner join users c on c.userno=b2.userno
left outer join assign d on d.asno=c.asno
left outer join lectsd b on b.lectno=b2.lectno and b.sdno=a.sdno
left outer join fileinfo f on f.fgno=b.fgno and f.isdel=0
where a.sdno=#sdno#
</select>
<update id= "lect.lectsd.save" parameterClass= "lectsd" >
update lectsd set <include refid= "sql.up" > </include>
,iscopy=#iscopy#,cpoint=#cpoint#
,feedb=case when feedb is null then #feedb# else feedb end
,checktime=case when #cpoint# is not null or #feedb# is not null then now() else checktime end
,checkip=case when #cpoint# is not null or #feedb# is not null then #uip# else checkip end
where lectno=#lectno# and sdno=#sdno#;
insert into lectsd (lectno,sdno,atext,fgno,copyrate,iscopy,cpoint,feedb,submittime,submitip,checktime,checkip,<include refid= "sql.inc" > </include> )
select #lectno#,#sdno#,null,null,null,#iscopy#,#cpoint#,#feedb#,null,null
,case when #cpoint# is not null or #feedb# is not null then now() else null end
,case when #cpoint# is not null or #feedb# is not null then #uip# else null end
,<include refid= "sql.inv" > </include>
from (select 1 col1) a
left outer join lectsd b on b.lectno=#lectno# and b.sdno=#sdno#
where b.lectno is null
</update>
<update id= "lect.lectsd.savebatch" parameterClass= "lectsd" >
update lectsd set <include refid= "sql.up" > </include>
,iscopy=#iscopy#,cpoint=#cpoint#,feedb=case when feedb is null then #feedb# else feedb end
,checktime=case when #cpoint# is not null or #feedb# is not null then now() else checktime end
,checkip=case when #cpoint# is not null or #feedb# is not null then #uip# else checkip end
where lectno in ($lectnos$) and sdno=#sdno#;
insert into lectsd (lectno,sdno,atext,fgno,copyrate,iscopy,cpoint,feedb,submittime,submitip,checktime,checkip,<include refid= "sql.inc" > </include> )
select a.lectno,#sdno#,null,null,null,#iscopy#,#cpoint#,#feedb#,null,null
,case when #cpoint# is not null or #feedb# is not null then now() else null end
,case when #cpoint# is not null or #feedb# is not null then #uip# else null end
,<include refid= "sql.inv" > </include>
from lect a
left outer join lectsd b on b.lectno=a.lectno and b.sdno=#sdno#
where a.lectno in ($lectnos$) and a.status=1 and a.ischanged=0 and b.lectno is null
</update>
<update id= "lect.lectsd2.save" parameterClass= "lectsd" >
update lectsd set <include refid= "sql.up" > </include>
,cpoint=#cpoint#,feedb=#feedb#
,checktime=case when #cpoint# is not null or #feedb# is not null then now() else checktime end
,checkip=case when #cpoint# is not null or #feedb# is not null then #uip# else checkip end
where lectno=#lectno# and sdno=#sdno#;
insert into lectsd (lectno,sdno,atext,fgno,copyrate,iscopy,cpoint,feedb,submittime,submitip,checktime,checkip,<include refid= "sql.inc" > </include> )
select #lectno#,#sdno#,null,null,null,0,#cpoint#,#feedb#,null,null
,case when #cpoint# is not null or #feedb# is not null then now() else null end
,case when #cpoint# is not null or #feedb# is not null then #uip# else null end
,<include refid= "sql.inv" > </include>
from (select 1 col1) a
left outer join lectsd b on b.lectno=#lectno# and b.sdno=#sdno#
where b.lectno is null
</update>
<update id= "lect.lectsd2.savebatch" parameterClass= "lectsd" >
update lectsd set <include refid= "sql.up" > </include>
,cpoint=#cpoint#,feedb=#feedb#
,checktime=case when #cpoint# is not null or #feedb# is not null then now() else checktime end
,checkip=case when #cpoint# is not null or #feedb# is not null then #uip# else checkip end
where lectno in ($lectnos$) and sdno=#sdno#;
insert into lectsd (lectno,sdno,atext,fgno,copyrate,iscopy,cpoint,feedb,submittime,submitip,checktime,checkip,<include refid= "sql.inc" > </include> )
select a.lectno,#sdno#,null,null,null,0,#cpoint#,#feedb#,null,null
,case when #cpoint# is not null or #feedb# is not null then checktime else null end
,case when #cpoint# is not null or #feedb# is not null then #uip# else null end
,<include refid= "sql.inv" > </include>
from lect a
left outer join lectsd b on b.lectno=a.lectno and b.sdno=#sdno#
where a.lectno in ($lectnos$) and a.status=1 and a.ischanged=0 and b.lectno is null
</update>
<select id= "lect.lectsdfiles" parameterClass= "int" resultClass= "lectsd" >
select d.orgname,d.fileurl,c.userno,c.userid,c.username
from lectsd a
inner join lect b on b.lectno=a.lectno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno
inner join fileinfo d on d.fgno=a.fgno and d.isdel=0
where a.sdno=#sdno#
</select>
<select id= "lect.lectdiscusses" parameterClass= "hashtable" resultClass= "lectsd" >
select a.lectno,a.userno,a.cmno,a.isrebate
,b.sdno
,c.cpoint,c.feedb,c.submittime,c.submitip,c.checktime,c.checkip
,d.username,d.userid
,e.asname
,count(c2.bno) ccount
,row_number() over(order by <isNotNull property= "orderby" > $orderby$</isNotNull> <isNull property= "orderby" > d.username</isNull> ) rno
,count(a.cdt) over() pagetotalcount
from lect a
inner join cmsd b on b.isdel=0 <isNotNull property= "sdno" > and b.sdno=#sdno#</isNotNull>
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
left outer join lectsdboard c2 on c2.lectno=c.lectno and c2.sdno=c.sdno and c2.isdel=0
inner join users d on d.userno=a.userno
left outer join assign e on e.asno=d.asno
where a.cmno=#cmno# and a.status=1 and a.ischanged=0
<isNotNull property= "isrebate" > and a.isrebate=#isrebate#</isNotNull>
group by a.lectno,a.userno,a.cmno,a.isrebate
,b.sdno
,c.cpoint,c.feedb,c.submittime,c.submitip,c.checktime,c.checkip
,d.username,d.userid
,e.asname
<isNotNull property= "dcount" >
having count(c2.bno) $dcount$
</isNotNull>
order by rno
</select>
<select id= "lect.lectdiscuss" parameterClass= "hashtable" resultClass= "lectsd" >
select a.sdno,a.tpoint sdtpoint
,b.lectno,b.cpoint,b.feedb,b.submittime,b.checktime
,c.userno,c.username,c.userid
,d.asname
from cmsd a
inner join lect b2 on b2.lectno=#lectno#
inner join users c on c.userno=b2.userno
left outer join assign d on d.asno=c.asno
left outer join lectsd b on b.lectno=b2.lectno and b.sdno=a.sdno
where a.sdno=#sdno#
</select>
<select id= "lect.lectsdboards" parameterClass= "hashtable" resultClass= "lectsdboard" >
select bno,a.lectno,a.sdno,a.subject,a.contents,a.fgno,a.rcount,a.cdt,a.cip
from lectsdboard a
where a.isdel=0
<isNotNull property= "lectno" > and a.lectno=#lectno#</isNotNull>
<isNotNull property= "sdno" > and a.sdno=#sdno#</isNotNull>
order by a.lectno,a.cdt desc
</select>
<update id= "lect.edub2b" parameterClass= "edub2b" >
insert into edub2b (etype,userno,edate,esubject,etarget,ecount,eplace,ecomment,compname,ceoname,brno,addr,btype,bkind,manname,email,telno,fgno,<include refid= "sql.inc" > </include> )
values (#etype#,#userno#,#edate#,#esubject#,#etarget#,#ecount#,#eplace#,#ecomment#,#compname#,#ceoname#,#brno#,#addr#,#btype#,#bkind#,#manname#,HEX(AES_ENCRYPT(#email#, <include refid= "sql.digest" > </include> )),HEX(AES_ENCRYPT(#telno#, <include refid= "sql.digest" > </include> )),#fgno#,<include refid= "sql.inv" > </include> )
</update>
<select id= "lect.mydata" parameterClass= "int" resultClass= "data" >
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8
,a.longval,a.longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
2020-11-10 14:34:17 +09:00
,null time3 ,null time4
2020-10-12 14:39:23 +09:00
,a.rno
from(
select 1 dtype
,d.tyear intval,d.tseq intval2,c.cshape intval3,a.pstatus intval4,case when e.rfdno is null then 0 else 1 end intval5,a.isrebate intval6,a.itemno intval7
,case when c.sstime < now() and c.setime > now() then 1 else 0 end intval8
,l.lectno longval,a.payno longval2
,c.cname strval,null strval2,null strval3
,c.rstime time,c.retime time2
,row_number() over(order by c.retime) rno
from payitem a
inner join pay b on b.payno=a.payno and b.pstatus in (1,21,22,51) and b.rstatus < 2
inner join cm c on c.cmno=a.itemno and c.rstime < <include refid= "sql.now" > </include> and c.retime > <include refid= "sql.now" > </include>
inner join lect l on l.cmno=c.cmno and l.status < 5 and l.ischanged=0 and l.userno=b.userno
inner join term d on d.tmno=c.tmno
left outer join payrfd e on e.payno=a.payno and e.payno=a.payno and e.rstatus=0
where a.ptype in (0,1,4) and a.userno=#userno# and a.pstatus in (1,21,22,51) and a.rstatus=0
order by rno
) a
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
2020-11-10 14:34:17 +09:00
,a.time3,a.time4
2020-10-12 14:39:23 +09:00
,a.rno
from (
select 2 dtype
,c.tyear intval,c.tseq intval2,b.cshape intval3,0 intval4,0 intval5,a.isrebate intval6,a.cmno intval7,0 intval8
,a.lectno longval,0 longval2
,b.cname strval,null strval2,null strval3
,b.sstime time,b.setime time2
2020-11-10 14:34:17 +09:00
,d.estart time3,d.eend time4
2020-10-12 14:39:23 +09:00
,row_number() over(order by b.setime desc) rno
from lect a
inner join cm b on b.cmno=a.cmno and b.sstime < <include refid= "sql.now" > </include>
inner join term c on c.tmno=b.tmno
2020-11-10 14:34:17 +09:00
left outer join cminningscd d on a.cmisno = d.cmisno
2020-10-12 14:39:23 +09:00
where a.userno=#userno# and a.status=1 and a.ischanged=0
order by case when time2 > now() then 1 else 0 end desc , time2 desc
) a
union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
2020-11-10 14:34:17 +09:00
,null time3, null time4
2020-10-12 14:39:23 +09:00
,a.rno
from (
select 3 dtype
,1 intval,c.iseq intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
,b.cname strval,null strval2,null strval3
,b.sstime time,b.setime time2
,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>
inner join cminning c on c.cmno=b.cmno and c.isonline=1
left outer join lectinning d on d.lectno=a.lectno and d.cmino=c.cmino and d.istatus=2
where 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.intval8
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
2020-11-10 14:34:17 +09:00
,null time3, null time4
2020-10-12 14:39:23 +09:00
,a.rno
from (
select 3 dtype
,2 intval,c.iseq intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
2020-10-13 16:10:18 +09:00
,b.cname strval,bc.cname 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
2020-10-12 14:39:23 +09:00
,b.sstime time,b.setime time2
,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
2020-10-13 16:10:18 +09:00
left outer join comcode bc on bc.ccode=b.studyplace
2020-10-12 14:39:23 +09:00
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.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.intval8
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
2020-11-10 14:34:17 +09:00
,null time3, null time4
2020-10-12 14:39:23 +09:00
,a.rno
from (
select 3 dtype
,3 intval,0 intval2,b.classno intval3,c.extype intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
2020-10-13 16:10:18 +09:00
,b.cname strval,bc.cname strval2,null strval3
2020-10-12 14:39:23 +09:00
,b.sstime time,b.setime time2
,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>
2020-10-13 16:10:18 +09:00
left outer join comcode bc on bc.ccode=b.studyplace
2020-10-12 14:39:23 +09:00
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.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.intval8
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
2020-11-10 14:34:17 +09:00
,null time3, null time4
2020-10-12 14:39:23 +09:00
,a.rno
from (
select 3 dtype
,4 intval,0 intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
2020-10-13 16:10:18 +09:00
,b.cname strval,bc.cname strval2,null strval3
2020-10-12 14:39:23 +09:00
,b.sstime time,b.setime time2
,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>
2020-10-13 16:10:18 +09:00
left outer join comcode bc on bc.ccode=b.studyplace
2020-10-12 14:39:23 +09:00
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.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.intval8
,a.longval,0 longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
2020-11-10 14:34:17 +09:00
,null time3, null time4
2020-10-12 14:39:23 +09:00
,a.rno
from (
select 3 dtype
,5 intval,0 intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,a.cmno intval7,0 intval8
,a.lectno longval
2020-10-13 16:10:18 +09:00
,b.cname strval,bc.cname strval2,null strval3
2020-10-12 14:39:23 +09:00
,b.sstime time,b.setime time2
,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>
2020-10-13 16:10:18 +09:00
left outer join comcode bc on bc.ccode=b.studyplace
2020-10-12 14:39:23 +09:00
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.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.intval8
,a.longval,a.longval2
,a.strval,a.strval2,a.strval3
,a.time,a.time2
2020-11-10 14:34:17 +09:00
,null time3, null time4
2020-10-12 14:39:23 +09:00
,a.rno
from (
select 4 dtype
,a.scdno intval,a.dday intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,b.cmno intval7,0 intval8
,c.lectno longval,a.alno longval2
,b.cname strval,null strval2,null strval3
,a.atime time,null time2
,row_number() over(order by a.atime desc) rno
from alarms a
inner join cm b on b.cmno=a.cmexno
inner join lect c on c.cmno=b.cmno and c.userno=a.userno and c.status=1 and c.ischanged=0
where a.userno=#userno# and a.scdno < 9 and a.isdel=0
order by a.atime desc
limit 5
) a
</select>
<update id= "lect.alarm.del" parameterClass= "hashtable" >
update alarms set isdel=1 where alno=#alno# and userno=#userno#
</update>
<select id= "lect.mylectures" parameterClass= "hashtable" resultClass= "lect" >
select a.lectno,a.cmno,a.userno,a.isrebate,a.iscomplete
,b.cmno,b.cname,b.cshape
<!-- ,case when a.ispc=1 then pc.sstime else b.sstime end sstime
,case when a.ispc=1 then pc.setime else b.setime end setime-->
,b.sstime,b.setime
,b.classno,b.isrefund
,c.tyear,c.tseq
,e.isgroup,e.payno
,u.username,null ccpositionname,CAST(AES_DECRYPT(UNHEX(u.email), <include refid= "sql.digest" > </include> ) AS char) email,ua.asname
,1 rno
2020-11-10 16:33:06 +09:00
,scd.estart,scd.eend
2020-10-12 14:39:23 +09:00
from lect a
inner join cm b on b.cmno=a.cmno and b.sstime < <include refid= "sql.now" > </include>
<!-- inner join cm pc on pc.cmno=case when a.ispc=1 then a.pcno else a.cmno end and pc.sstime < <include refid="sql.now"></include> -->
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno <isNotNull property= "cgcode" > and d.cgcode=#cgcode#</isNotNull>
inner join pay e on e.payno=a.payno and e.isgroup=0
inner join users u on u.userno=a.userno
left outer join assign ua on ua.asno=u.asno
2020-11-10 16:33:06 +09:00
left outer join cminningscd scd on scd.cmisno = a.cmisno
2020-10-12 14:39:23 +09:00
where a.userno=#userno# and a.status=1 and a.ischanged=0
2020-11-10 16:33:06 +09:00
<isNotNull property= "cshape" > and b.cshape=#cshape#</isNotNull>
2020-10-12 14:39:23 +09:00
union all
select a.lectno,a.cmno,a.userno,a.isrebate,a.iscomplete
,b.cmno,b.cname,b.cshape,b.sstime,b.setime,b.classno,b.isrefund
,c.tyear,c.tseq
,e.isgroup,e.payno
,u.username,null ccpositionname,CAST(AES_DECRYPT(UNHEX(u.email), <include refid= "sql.digest" > </include> ) AS char) email,ua.asname
,row_number() over(partition by e.payno) rno
2020-11-10 16:33:06 +09:00
,null estart, null eend
2020-10-12 14:39:23 +09:00
from pay e
inner join lect a on a.payno=e.payno and a.status=1 and a.ischanged=0
inner join cm b on b.cmno=a.cmno and b.sstime < <include refid= "sql.now" > </include>
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno <isNotNull property= "iscover" > and d.iscover=1</isNotNull>
inner join users u on u.userno=a.userno
left outer join assign ua on ua.asno=u.asno
where e.isgroup=1 and e.userno=#userno# and e.pstatus=1
2020-11-10 16:33:06 +09:00
<isNotNull property= "cshape" > and b.cshape=#cshape#</isNotNull>
2020-10-12 14:39:23 +09:00
union all
select a.lectno,a.cmno,a.userno,a.isrebate,a.iscomplete
,b.cmno,b.cname,b.cshape,b.sstime,b.setime,b.classno,b.isrefund
,c.tyear,c.tseq
,e.isgroup,e.payno
,u.username,null ccpositionname,CAST(AES_DECRYPT(UNHEX(u.email), <include refid= "sql.digest" > </include> ) AS char) email,ua.asname
,row_number() over(partition by e.payno) rno
2020-11-10 16:33:06 +09:00
,null estart, null eend
2020-10-12 14:39:23 +09:00
from lect a0
inner join pay e on e.payno=a0.payno and e.isgroup=1 and e.userno< > #userno# and e.pstatus=1
inner join lect a on a.payno=e.payno and a.status=1 and a.ischanged=0
inner join cm b on b.cmno=a.cmno and b.sstime < <include refid= "sql.now" > </include>
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno <isNotNull property= "iscover" > and d.iscover=1</isNotNull>
inner join users u on u.userno=a.userno
left outer join assign ua on ua.asno=u.asno
where a0.userno=#userno# and a0.status=1 and a0.ischanged=0
2020-11-10 16:33:06 +09:00
<isNotNull property= "cshape" > and b.cshape=#cshape#</isNotNull>
2020-10-12 14:39:23 +09:00
order by case when setime < now() then 0 else 1 end desc,setime desc,payno
</select>
<select id= "lect.myexams" parameterClass= "hashtable" resultClass= "examuser" >
select a.exno,a.userno,a.status,a.payno,a.pino,a.pstatus,a.epoint1,a.epoint2,a.epoint3,a.avrg,a.ispass,a.certdate,a.certindate
,b.exname,b.isopen,b.rstime,b.retime,b.estime,b.elocation,b.isresultopen
,c.certdate firstcertdate
,u.username,u.userid
,cc.cname gradename
from examuser a
inner join exam b on b.exno=a.exno <isNotNull property= "isresultopen" > and b.isresultopen=#isresultopen#</isNotNull>
left outer join examuserrenew c on c.exno=a.exno and c.userno=a.userno and c.isfirst=1
inner join users u on u.userno=a.userno
inner join comcode cc on cc.ccode=b.certgradecc
<dynamic prepend= "where" >
<isNotNull property= "userno" prepend= "and" > a.userno=#userno#</isNotNull>
<isNotNull property= "validstatus" prepend= "and" > a.status < 9 and a.pstatus < 8</isNotNull>
</dynamic>
order by a.cdt desc
</select>
<select id= "lect.myexamrenews" parameterClass= "hashtable" resultClass= "examuserrenew" >
select a.exno,a.userno,a.certtime,a.certdate,a.certindate,a.renewreason,a.isfirst,a.certidx
,b.username cnoname
from examuserrenew a
left outer join users b on b.userno=a.cno
where a.exno=#exno# and a.userno=#userno#
order by a.certdate desc
</select>
<select id= "lect.myexamrenewlects" parameterClass= "hashtable" resultClass= "lect" >
select a.*,b.cmno,b.oktime,b.iscomplete
from (
select distinct(c.cmno),c.cname,c.cshape
from examuser a
inner join exam b on b.exno=a.exno
inner join cm c on c.certcc=b.certcc and c.certgradecc=b.certgradecc and c.isdel=0 and c.isuse=1
inner join cg d on d.cgno = c.cgno and d.isuse=1 and d.isdel=0 and d.iscover=1
where a.exno=#exno# and a.userno=#userno#
)a
inner join lect b on b.cmno=a.cmno
where b.status=1 and b.iscomplete=1 and b.ischanged=0 and b.userno=#userno#
group by a.cmno,a.cname,a.cshape,b.oktime,b.iscomplete
limit 3
</select>
<select id= "lect.myalarm" parameterClass= "int" resultClass= "data" >
select 4 dtype,a.scdno intval,a.dday intval2,b.classno intval3,0 intval4,0 intval5,0 intval6,b.cmno intval7
,c.lectno longval,a.alno longval2
,b.cname strval,null strval2,null strval3
,a.atime time,null time2
from alarms a
inner join cm b on b.cmno=a.cmexno
inner join lect c on c.cmno=b.cmno and c.userno=a.userno and c.status=1 and c.ischanged=0
where a.userno=#userno# and date_add(a.atime, interval 3 month) > now() and a.scdno < 9 and a.isdel=0
order by a.atime desc
</select>
<select id= "lect.lectex.result" parameterClass= "hashtable" resultClass= "lectex" >
select a.etime,a.exname,a.tpoint fullpoint,a.isresultopen
,b.estart,b.eend,b.tpoint, b.udt
from cmex a
inner join lectex b on b.lectno=#lectno# and b.exno=a.exno
inner join lect c on c.lectno=b.lectno and c.userno=#userno#
where a.exno=#exno#
</select>
<select id= "lect.lectexq.result" parameterClass= "hashtable" resultClass= "lectexq" >
select d.atype,b.cpoint,b.dpoint,d.qtext,b.atext,d.qdesc,b.iscorrect,c.qno,b.eqno,b.qseq
from lectex a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
inner join lectexq b on b.lectno=a.lectno and b.exno=a.exno
inner join cmexq c on c.eqno=b.eqno
inner join question d on d.qno=c.qno
where a.lectno=#lectno# and a.exno=#exno#
order by b.qseq
</select>
<select id= "lect.lectexqqi.list" parameterClass= "string" resultClass= "questionitem" >
select a.qno,a.qitext,b.fileurl,a.isright,a.qino
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
order by a.qno, a.qino
</select>
<select id= "lect.lectexresult.rightrate" parameterClass= "string" resultClass= "cmexq" >
select a.eqno,sum(a.iscorrect)/count(a.eqno)*100 rightrate
from lectexq a
where a.eqno in ($eqnos$)
group by a.eqno
</select>
<select id= "lect.lectexresult.selectrate" parameterClass= "hashtable" resultClass= "cmexq" >
select a.eqno,sum(case when a.atext = b.atext then 1 else 0 end) / count(b.eqno) * 100 selectrate
from lectexq a
inner join lect a2 on a2.lectno=a.lectno and a2.userno=#userno#
inner join lectexq b on b.exno=a.exno and b.eqno=a.eqno
where a.lectno=#lectno# and a.exno=#exno#
group by a.eqno
</select>
<select id= "lect.myrecomm" parameterClass= "int" resultClass= "cm" >
select c.tyear,c.tseq,a.cmno,b.cshape,b.cname,b.rstime,b.retime,e.cgcode,b.isrefund
from (
select a.*
from (
select distinct b.ispre idx,c.cmno
from lect a
inner join cmrelay b on b.cmno=a.cmno
inner join cm c on c.ismaster=0 and c.pcmno=b.rcmno and c.rstime < now() and c.retime > now()
left outer join lect d on d.userno=a.userno and d.cmno=c.cmno
where a.userno=#userno# and a.status=1 and a.ischanged=0 and d.lectno is null
order by b.ispre,c.retime
limit 2
) a
union all
select a.*
from (
select 2 idx,c.cmno
from users a
inner join comcode b on b.ccode=a.ccposition
inner join cm c on c.ismaster=0 and c.rstime < now() and c.retime > now() and c.jobpositiongrade like concat('%',b.refcode,'%')
left outer join lect d on d.userno=a.userno and d.cmno=c.cmno
where a.userno=#userno# and d.lectno is null
order by c.retime
limit 2
) a
) a
inner join cm b on b.cmno=a.cmno
inner join term c on c.tmno=b.tmno
inner join cg d on d.cgno=b.cgno
inner join cg e on e.cgno=d.pcgno
order by a.idx,b.retime
limit 2
</select>
2020-11-17 16:57:10 +09:00
<update id= "lect.completetime.change" parameterClass= "hashtable" >
update lect set <include refid= "sql.up" > </include>
,completetime=#completetime#
where lectno=#lectno# and iscomplete=1;
</update>
2020-11-18 17:58:09 +09:00
<select id= "lect.lecture.document" parameterClass= "hashtable" resultClass= "lect" >
select a.*
from (
select a.lectno,a.userno,a.isrebate,a.iscomplete
,b.cmno,b.cname,b.cshape
,b.rstime,b.retime
,b.sstime,b.setime
,c.tyear,c.tseq
2020-11-26 13:35:01 +09:00
,u.username,u.userid
,ass.asname
,e.payno,e.pstatus,e.payamt,e.ptype,e.ispg
2020-11-18 17:58:09 +09:00
,f.estart,f.eend
,cc.cname studyplacename
2020-11-20 14:29:50 +09:00
,pt.taxno,pt.taxdate
2020-11-26 13:35:01 +09:00
,a.cdt
2020-11-18 17:58:09 +09:00
,row_number() over(order by a.cdt desc) rno
,count(a.lectno) over() pagetotalcount
from lect a
inner join cm b on b.cmno = a.cmno
inner join term c on c.tmno = b.tmno
inner join pay e on e.payno = a.payno
2020-11-26 13:35:01 +09:00
left outer join users u on u.userno = a.userno
left outer join assign ass on ass.asno = u.asno
2020-11-18 17:58:09 +09:00
left outer join cminningscd f on f.cmisno = a.cmisno
left outer join comcode cc on cc.ccode = b.studyplace
2020-11-20 14:29:50 +09:00
left outer join paytax pt on pt.payno = e.payno and ifnull(pt.iscancel,0) =0
2020-11-26 13:35:01 +09:00
where a.status=1 and a.ischanged=0
<isNotNull property= "cdts" > and a.cdt > = #cdts#</isNotNull>
<isNotNull property= "cdte" > and a.cdt < = #cdte#</isNotNull>
<isNotNull property= "asname" > and ass.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNull property= "userno" > and a.userno = #userno#</isNotNull>
<isNotNull property= "isrebate" > a.isrebate = #isrebate#</isNotNull>
<isNotNull property= "username" > u.username like concat('%',#username#,'%')</isNotNull>
<isNotNull property= "userid" > u.userid like concat('%',#userid#,'%')</isNotNull>
<isNotNull property= "cname" > b.cname like concat('%',#cname#,'%')</isNotNull>
<isNotNull property= "usernameiditemname" > and(u.username like concat('%',#usernameiditemname#,'%') or u.userid like concat('%',#usernameiditemname#,'%') or b.cname like concat('%',#usernameiditemname#,'%'))</isNotNull>
2020-11-18 17:58:09 +09:00
) a
<include refid= "sql.pagedynamic" > </include>
</select>
2020-11-24 13:19:48 +09:00
<update id= "lect.drop2day" parameterClass= "hashtable" >
update pay a
inner join lect b on b.payno = a.payno and b.cmno = #cmno# and b.ischanged=0 and ifnull(b.isready,0) = 1 and b.status = 4 and DATE_ADD(b.oktime, INTERVAL 2 DAY) < <include refid= "sql.now" > </include>
set a.pstatus = 52, a.udt = now(), a.uno = #uno#, a.uip = #uip#;
update payitem a
inner join pay b on b.payno = a.payno and b.pstatus = 52
inner join lect c on c.payno = b.payno and c.cmno = #cmno# and c.ischanged=0 and ifnull(c.isready,0) = 1 and c.status = 4 and DATE_ADD(c.oktime, INTERVAL 2 DAY) < <include refid= "sql.now" > </include>
set a.pstatus = b.pstatus, a.udt = now(), a.uno = #uno#, a.uip = #uip#;
update lect
set status = 5, oktime = now(), udt = now(), uno = #uno#, uip = #uip#
where cmno = #cmno# and ifnull(isready,0) = 1 and ischanged=0 and status = 4 and DATE_ADD(oktime, INTERVAL 2 DAY) < <include refid= "sql.now" > </include>
</update>
2020-10-12 14:39:23 +09:00
</statements>
</sqlMap>