,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 <isNotNullproperty="orderby">$orderby$</isNotNull><isNullproperty="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
2020-12-28 16:13:14 +09:00
,sum(case when d.lectno is not null and p.pstatus = 55 then 1 else 0 end) countstanbyaccept
2020-10-12 14:39:23 +09:00
,count(a.cdt) over() pagetotalcount
from term a
inner join cm b on b.tmno=a.tmno <isNotNullproperty="cshape">and b.cshape=#cshape#</isNotNull><isNotNullproperty="cnamelike">and b.cname like concat('%',#cnamelike#,'%')</isNotNull>
inner join cg c on c.cgno=b.cgno
<isNotNullproperty="islect">
2020-12-28 16:13:14 +09:00
left outer join lect d on d.cmno=b.cmno and (d.status < 5 or d.status = 6) 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>
<isNullproperty="islect">
2020-12-28 16:13:14 +09:00
inner join lect d on d.cmno=b.cmno <isNotNullproperty="status">and d.status=#status#</isNotNull> and (d.status < 5 or d.status = 6) and d.ischanged=0
inner join payitem pi on pi.pino=d.pino
inner join pay p on p.payno=pi.payno
2020-10-12 14:39:23 +09:00
</isNull>
<isNotNullproperty="profno">
inner join cmprof pr on pr.cmno=b.cmno and pr.userno=#profno#
update lect set <includerefid="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);
<isGreaterThanproperty="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
update lect set <includerefid="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
<isGreaterThanproperty="status"compareValue="3">
2020-11-25 10:30:03 +09:00
<isLessThanproperty="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
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)
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=<includerefid="sql.now"></include>,a.uno=#uno#,a.uip=#uip#;
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="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#
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="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
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="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
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="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
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="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
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char),CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="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
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char),CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="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
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="sql.digest"></include>) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 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 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
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
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="sql.digest"></include>) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 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 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
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
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="sql.digest"></include>) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 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 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
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
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="sql.digest"></include>) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 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 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
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
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,null stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char) email,CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="sql.digest"></include>) AS char) mobile
from scdlect a
inner join cm b on b.ismaster=0 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 and date_format(c.edate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
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
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.cmno cmexno,b.cname,c.sdate stime
,c.edate etime,b.studyplace,b.studytime days
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char),CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="sql.digest"></include>) AS char)
from scdlect a
inner join cm b on b.ismaster=0 and b.cshape =1 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 and date_format(c.sdate,'%Y%m%d')=date_format(date_add(now(), interval a.dday day), '%Y%m%d')
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
select a.scdno,a.dday,a.istalk,a.isemail,a.issms
,d.userno,d.username
,b.exno cmexno,b.exname cname,b.estime stime
,null etime,null studyplace,null days
,CAST(AES_DECRYPT(UNHEX(d.email), <includerefid="sql.digest"></include>) AS char),CAST(AES_DECRYPT(UNHEX(d.mobile), <includerefid="sql.digest"></include>) AS char)
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
inner join cm b on b.ismaster=0 and b.tmno=a.tmno <isNotNullproperty="cshape">and b.cshape=#cshape#</isNotNull><isNotNullproperty="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 <isNotNullproperty="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
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,<includerefid="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),<includerefid="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>
<sqlid="lectexcreate">
insert into lectexq (lectno,exno,eqno,cpoint,dpoint,qseq,<includerefid="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),<includerefid="sql.inv"></include>
from (select #lectno# lectno, #exno# exno) a
<isNotNullproperty="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,<includerefid="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),<includerefid="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
<isNotNullproperty="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,<includerefid="sql.inc"></include>)
insert into edub2b (etype,userno,edate,esubject,etarget,ecount,eplace,ecomment,compname,ceoname,brno,addr,btype,bkind,manname,email,telno,fgno,<includerefid="sql.inc"></include>)
,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
2020-12-15 09:37:16 +09:00
inner join pay b on b.payno=a.payno and b.pstatus in (1,21,22,51,55) and b.rstatus < 2
2020-10-12 14:39:23 +09:00
inner join cm c on c.cmno=a.itemno and c.rstime <<includerefid="sql.now"></include> and c.retime ><includerefid="sql.now"></include>
2020-12-15 09:37:16 +09:00
inner join lect l on l.cmno=c.cmno and (l.status < 5 or l.status = 6) and l.ischanged=0 and l.userno=b.userno
2020-10-12 14:39:23 +09:00
inner join term d on d.tmno=c.tmno
2020-12-30 10:25:07 +09:00
left outer join (
select l.lectno
,count(li.cmino) cnt
from payitem a
inner join pay b on b.payno= a.payno and b.pstatus in (1,21,22,51,55) and b.rstatus < 2
inner join cm c on c.cmno = a.itemno and c.rstime <<includerefid="sql.now"></include> and c.retime ><includerefid="sql.now"></include>
inner join lect l on l.cmno = c.cmno and (l.status < 5 or l.status = 6) and l.ischanged =0 and l.userno = b.userno
left outer join lectinning li on li.lectno = l.lectno and li.istatus is not null
where a.ptype in (0,1,4) and a.userno=#userno# and a.pstatus in (1,21,22,51,55) and a.rstatus =0
group by l.lectno
)li on li.lectno = l.lectno
2020-10-12 14:39:23 +09:00
left outer join payrfd e on e.payno=a.payno and e.payno=a.payno and e.rstatus=0
2020-12-30 10:25:07 +09:00
where a.ptype in (0,1,4) and a.userno=#userno# and a.pstatus in (1,21,22,51,55) and a.rstatus=0 and li.cnt = 0
,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 <<includerefid="sql.now"></include> and b.setime ><includerefid="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-->
<isNotNullproperty="isrebates">and ifnull(a.isrebate,0) in ($isrebates$)</isNotNull>
<isNotNullproperty="username">and u.username like concat('%',#username#,'%')</isNotNull>
<isNotNullproperty="userid">and u.userid like concat('%',#userid#,'%')</isNotNull>
<isNotNullproperty="itemname">and b.cname like concat('%',#itemname#,'%')</isNotNull>
2020-11-26 13:35:01 +09:00
<isNotNullproperty="usernameiditemname">and(u.username like concat('%',#usernameiditemname#,'%') or u.userid like concat('%',#usernameiditemname#,'%') or b.cname like concat('%',#usernameiditemname#,'%'))</isNotNull>
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) <<includerefid="sql.now"></include>
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) <<includerefid="sql.now"></include>
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) <<includerefid="sql.now"></include>
insert into lectinning (lectno,cmino,totstudy,stime,etime,istatus,finishtime,sip,eip,ispcs,ispce,pseq,psec,isattcheck,<includerefid="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#,1,null,ctp.pseq,0,#isattcheck#,<includerefid="sql.inv"></include>
from cminning a
inner join ctpage ctp on ctp.ctno=a.ctno and ctp.isdel=0 and ctp.pseq=1
left outer join lectinning b on b.lectno=#lectno# and b.cmino=#cmino#