294 lines
17 KiB
XML
294 lines
17 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<sqlMap xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/tr/xmlschema-1/" namespace="">
|
|
<alias>
|
|
|
|
</alias>
|
|
<cacheModels>
|
|
<cacheModel id="attendCache" implementation="LRU" >
|
|
<flushInterval hours="1" />
|
|
<property name="CacheSize" value="1000" />
|
|
</cacheModel>
|
|
</cacheModels>
|
|
<resultMaps></resultMaps>
|
|
<statements>
|
|
<update id="att.attend.allin" parameterClass="hashtable">
|
|
update lectinning
|
|
set istatus=2
|
|
,stime=case when stime is null then <include refid="sql.now"></include> else stime end
|
|
,etime=case when etime is null then <include refid="sql.now"></include> else etime end
|
|
,sip=case when sip is null then #uip# else sip end
|
|
,eip=case when eip is null then #uip# else eip end
|
|
,ispcs=case when ispcs is null then 1 else ispcs end
|
|
,ispce=case when ispce is null then 1 else ispce end
|
|
,statustime=<include refid="sql.now"></include>
|
|
,statusreason=#statusreason#
|
|
,statususerno=#uno#
|
|
where lectno in ($lectnos$) and (istatus is null or istatus<2);
|
|
|
|
insert into lectinning(lectno,cmino,totstudy,stime,etime,istatus,statustime,statusreason,statususerno,<include refid="sql.inc"></include>)
|
|
select a.lectno,b.cmino,0,<include refid="sql.now"></include>,<include refid="sql.now"></include>,2,<include refid="sql.now"></include>,#statusreason#,#uno#,<include refid="sql.inv"></include>
|
|
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
|
|
where a.lectno in ($lectnos$) and a.status=1 and a.ischanged=0 and c.lectno is null;
|
|
|
|
update lect set <include refid="sql.up"></include>
|
|
,attrate=100
|
|
,stime=case when stime is null then <include refid="sql.now"></include> else stime end
|
|
,etime=case when etime is null then <include refid="sql.now"></include> else etime end
|
|
,sip=case when sip is null then #uip# else sip end
|
|
,eip=case when eip is null then #uip# else eip end
|
|
,ispcs=case when ispcs is null then 1 else ispcs end
|
|
,ispce=case when ispce is null then 1 else ispce end
|
|
where lectno in ($lectnos$)
|
|
</update>
|
|
<update id="att.off.save" parameterClass="cminning">
|
|
update lectinning a
|
|
inner join (
|
|
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].lectno# lectno,#Ds[].istatus# istatus </iterate>
|
|
) b on b.lectno=a.lectno
|
|
set a.uip=#uip#,a.uno=#uno#
|
|
,a.istatus=b.istatus
|
|
,a.stime = a.stime
|
|
,a.etime = a.etime
|
|
,a.sip = case when a.sip is null then #uip# else a.sip end
|
|
,a.eip = case when a.eip is null then #uip# else a.eip end
|
|
,a.ispcs = case when a.ispcs is null then 1 else a.ispcs end
|
|
,a.ispce = case when a.ispce is null then 1 else a.ispce end
|
|
where a.cmino=#cmino#;
|
|
|
|
insert into lectinning (lectno,cmino,totstudy<!--,stime,etime-->,istatus,statustime,statusreason,sip,eip,ispcs,ispce,<include refid="sql.inc"></include>)
|
|
select a.lectno,#cmino#,0
|
|
<!--,case when a.istatus is not null then <include refid="sql.now"></include> else NULL end
|
|
,case when a.istatus is not null then <include refid="sql.now"></include> else NULL end-->
|
|
,a.istatus,null,null,#uip#,#uip#,1,1,<include refid="sql.inv"></include>
|
|
from (
|
|
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].lectno# lectno,#Ds[].istatus# istatus </iterate>
|
|
) a
|
|
left outer join lectinning b on b.cmino=#cmino# and b.lectno=a.lectno
|
|
where b.lectno is null;
|
|
|
|
update lect a
|
|
inner join (
|
|
select a.lectno,convert(100*count(c.lectno)/count(b.cmino), int) attrate
|
|
from lect a
|
|
inner join cminning b on b.cmno=a.cmno and ifnull(b.isscd,0)=0
|
|
left outer join lectinning c on c.lectno=a.lectno and c.cmino=b.cmino and c.istatus in (1,2)
|
|
where a.lectno in ($lectnos$)
|
|
group by a.lectno
|
|
) b on b.lectno=a.lectno
|
|
set a.attrate=b.attrate
|
|
,a.stime=case when a.stime is null then <include refid="sql.now"></include> else a.stime end
|
|
,a.etime=case when a.etime is null then <include refid="sql.now"></include> else a.etime end
|
|
,a.sip=case when a.sip is null then #uip# else a.sip end
|
|
,a.eip=case when a.eip is null then #uip# else a.eip end
|
|
,a.ispcs=case when a.ispcs is null then 1 else a.ispcs end
|
|
,a.ispce=case when a.ispce is null then 1 else a.ispce end
|
|
</update>
|
|
|
|
<update id="att.scd.save" parameterClass="cminning">
|
|
update lectinning a
|
|
inner join (
|
|
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].lectno# lectno,#Ds[].cmino# cmino,#Ds[].istatus# istatus </iterate>
|
|
) b on b.lectno=a.lectno and b.cmino = a.cmino
|
|
set a.uip=#uip#,a.uno=#uno#
|
|
,a.istatus=b.istatus
|
|
,a.stime = a.stime
|
|
,a.etime = a.etime
|
|
,a.sip = case when a.sip is null then #uip# else a.sip end
|
|
,a.eip = case when a.eip is null then #uip# else a.eip end
|
|
,a.ispcs = case when a.ispcs is null then 1 else a.ispcs end
|
|
,a.ispce = case when a.ispce is null then 1 else a.ispce end;
|
|
|
|
insert into lectinning (lectno,cmino,totstudy<!--,stime,etime-->,istatus,statustime,statusreason,sip,eip,ispcs,ispce,<include refid="sql.inc"></include>)
|
|
select a.lectno,a.cmino,0
|
|
,a.istatus,null,null,#uip#,#uip#,1,1,<include refid="sql.inv"></include>
|
|
from (
|
|
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].lectno# lectno,#Ds[].cmino# cmino,#Ds[].istatus# istatus </iterate>
|
|
) a
|
|
left outer join lectinning b on b.cmino=a.cmino and b.lectno=a.lectno
|
|
where b.lectno is null;
|
|
|
|
update lect a
|
|
inner join (
|
|
select a.lectno,convert(100*count(c.lectno)/count(b.cmino), int) attrate
|
|
from lect a
|
|
inner join cminning b on b.cmno=a.cmno and ifnull(b.isscd,0)=0
|
|
left outer join lectinning c on c.lectno=a.lectno and c.cmino=b.cmino and c.istatus in (1,2)
|
|
where a.lectno in ($lectnos$)
|
|
group by a.lectno
|
|
) b on b.lectno=a.lectno
|
|
set a.attrate=b.attrate
|
|
,a.stime=case when a.stime is null then <include refid="sql.now"></include> else a.stime end
|
|
,a.etime=case when a.etime is null then <include refid="sql.now"></include> else a.etime end
|
|
,a.sip=case when a.sip is null then #uip# else a.sip end
|
|
,a.eip=case when a.eip is null then #uip# else a.eip end
|
|
,a.ispcs=case when a.ispcs is null then 1 else a.ispcs end
|
|
,a.ispce=case when a.ispce is null then 1 else a.ispce end;
|
|
</update>
|
|
|
|
<update id="att.scd.setattr" parameterClass="cminning">
|
|
insert into lectinning(lectno,cmino,totstudy,stime,etime,istatus,statustime,statusreason,statususerno,<include refid="sql.inc"></include>)
|
|
select a.lectno,b.cmino,0,<include refid="sql.now"></include>,<include refid="sql.now"></include>,#istatus#,<include refid="sql.now"></include>,null,#uno#,<include refid="sql.inv"></include>
|
|
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
|
|
where a.lectno in ($lectnos$) and a.status=1 and b.isonline = 0 and b.isscd = 1 and a.ischanged=0 and c.lectno is null;
|
|
|
|
update lectinning lni
|
|
inner join lect l on lni.lectno = l.lectno
|
|
inner join cminning cmi on lni.cmino = cmi.cmino
|
|
inner join (
|
|
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].lectno# lectno,#Ds[].cmino# cmino,#Ds[].istatus# istatus </iterate>
|
|
) a on lni.lectno = a.lectno and lni.cmino = a.cmino
|
|
set lni.stime=now(),lni.etime=now(), lni.istatus = #istatus#
|
|
where l.status = 1 and cmi.isonline = 0 and cmi.isscd = 1;
|
|
</update>
|
|
|
|
<update id="att.scd.setattrnull" parameterClass="cminning">
|
|
insert into lectinning(lectno,cmino,totstudy,stime,etime,istatus,statustime,statusreason,statususerno,<include refid="sql.inc"></include>)
|
|
select a.lectno,b.cmino,0,null,null,#istatus#,<include refid="sql.now"></include>,null,#uno#,<include refid="sql.inv"></include>
|
|
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
|
|
where a.lectno in ($lectnos$) and a.status=1 and b.isonline = 0 and b.isscd = 1 and a.ischanged=0 and c.lectno is null;
|
|
|
|
update lectinning lni
|
|
inner join lect l on lni.lectno = l.lectno
|
|
inner join cminning cmi on lni.cmino = cmi.cmino
|
|
inner join (
|
|
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].lectno# lectno,#Ds[].cmino# cmino,#Ds[].istatus# istatus </iterate>
|
|
) a on lni.lectno = a.lectno and lni.cmino = a.cmino
|
|
set lni.stime=null,lni.etime=null, lni.istatus = #istatus#
|
|
where l.status = 1 and cmi.isonline = 0 and cmi.isscd = 1;
|
|
</update>
|
|
|
|
<!--<update id="att.scd.nowdate" parameterClass="cminning">
|
|
insert into lectinning(lectno,cmino,totstudy,stime,etime,istatus,statustime,statusreason,statususerno,<include refid="sql.inc"></include>)
|
|
select a.lectno,b.cmino,0,<include refid="sql.now"></include>,<include refid="sql.now"></include>,2,<include refid="sql.now"></include>,null,#uno#,<include refid="sql.inv"></include>
|
|
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
|
|
where a.lectno in ($lectnos$) and a.status=1 and b.isonline = 0 and b.isscd = 1 and a.ischanged=0 and c.lectno is null;
|
|
|
|
update lectinning lni
|
|
inner join lect l on lni.lectno = l.lectno
|
|
inner join cminning cmi on lni.cmino = cmi.cmino
|
|
inner join (
|
|
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].lectno# lectno,#Ds[].cmino# cmino,#Ds[].istatus# istatus </iterate>
|
|
) a on lni.lectno = a.lectno and lni.cmino = a.cmino
|
|
set lni.stime=now(),lni.etime=now(), lni.istatus = 2
|
|
where l.status = 1 and cmi.isonline = 0 and cmi.isscd = 1;
|
|
</update>
|
|
<update id="att.scd.attrnull" parameterClass="cminning">
|
|
insert into lectinning(lectno,cmino,totstudy,stime,etime,istatus,statustime,statusreason,statususerno,<include refid="sql.inc"></include>)
|
|
select a.lectno,b.cmino,0,<include refid="sql.now"></include>,<include refid="sql.now"></include>,2,<include refid="sql.now"></include>,null,#uno#,<include refid="sql.inv"></include>
|
|
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
|
|
where a.lectno in ($lectnos$) and a.status=1 and b.isonline = 0 and b.isscd = 1 and a.ischanged=0 and c.lectno is null;
|
|
|
|
update lectinning lni
|
|
inner join lect l on lni.lectno = l.lectno
|
|
inner join cminning cmi on lni.cmino = cmi.cmino
|
|
inner join (
|
|
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].lectno# lectno,#Ds[].cmino# cmino,#Ds[].istatus# istatus </iterate>
|
|
) a on lni.lectno = a.lectno and lni.cmino = a.cmino
|
|
set lni.stime=null,lni.etime=null
|
|
|
|
<isEqual property="zstring0" compareValue="-1">, lni.istatus = null</isEqual>
|
|
<isEqual property="zstring0" compareValue="0">, lni.istatus = 0</isEqual>
|
|
|
|
where l.status = 1 and cmi.isonline = 0 and cmi.isscd = 1
|
|
</update>-->
|
|
|
|
<update id="att.att.in" parameterClass="hashtable">
|
|
update lectinning set <include refid="sql.up"></include>
|
|
,lectno=#lectno#,cmino=#cmino#,totstudy=0
|
|
,stime=<include refid="sql.now"></include>,etime=null
|
|
,istatus=1,statustime=null,statusreason=null
|
|
where lectno=#lectno# and cmino=#cmino# and istatus is null;
|
|
|
|
insert into lectinning (lectno,cmino,totstudy,stime,etime,istatus,statustime,statusreason,sip,eip,ispcs,ispce,<include refid="sql.inc"></include>)
|
|
select #lectno#,#cmino#,0,<include refid="sql.now"></include>,null,1,null,null,#uip#,null,1,null,<include refid="sql.inv"></include>
|
|
from (select 1 col1) a
|
|
left outer join lectinning b on b.lectno=#lectno# and b.cmino=#cmino#
|
|
where b.lectno is null;
|
|
|
|
update lect
|
|
set stime = case when stime is null then <include refid="sql.now"></include> else stime end
|
|
,sip = case when sip is null then #uip# else sip end
|
|
,ispcs = case when ispcs is null then 1 else ispcs end
|
|
where lectno=#lectno#
|
|
</update>
|
|
<update id="att.att.out" parameterClass="hashtable">
|
|
update lectinning set <include refid="sql.up"></include>
|
|
,totstudy=timestampdiff(SECOND, stime, <include refid="sql.now"></include>)
|
|
,etime=<include refid="sql.now"></include>
|
|
,eip=#uip#
|
|
,ispce=1
|
|
,istatus=2
|
|
where lectno=#lectno# and cmino=#cmino# and istatus=1;
|
|
|
|
update lect a
|
|
inner join (
|
|
select a.lectno,convert(100*count(c.lectno)/count(b.cmino), int) attrate
|
|
from lectinning a
|
|
inner join cminning b on b.cmino=a.cmino and ifnull(b.isscd,0)=0
|
|
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.cmino=#cmino# and a.istatus=2
|
|
group by a.lectno
|
|
) b on b.lectno=a.lectno
|
|
set a.attrate=b.attrate
|
|
,a.etime=<include refid="sql.now"></include>,a.eip=#uip#,a.ispce=1
|
|
</update>
|
|
<update id="att.abs" parameterClass="hashtable">
|
|
update lectinning
|
|
set istatus=2
|
|
,stime=case when stime is null then <include refid="sql.now"></include> else stime end
|
|
,etime=case when etime is null then <include refid="sql.now"></include> else etime end
|
|
,sip=case when sip is null then #uip# else sip end
|
|
,eip=case when eip is null then #uip# else eip end
|
|
,ispcs=case when ispcs is null then 1 else ispcs end
|
|
,ispce=case when ispce is null then 1 else ispce end
|
|
,statustime=<include refid="sql.now"></include>
|
|
,statusreason=#statusreason#
|
|
,statususerno=#uno#
|
|
where lectno=#lectno# and cmino=#cmino# and (istatus is null or istatus<2);
|
|
|
|
insert into lectinning(lectno,cmino,totstudy,stime,etime,istatus,statustime,statusreason,statususerno,<include refid="sql.inc"></include>)
|
|
select a.lectno,#cmino#,0,<include refid="sql.now"></include>,<include refid="sql.now"></include>,2,<include refid="sql.now"></include>,#statusreason#,#uno#,<include refid="sql.inv"></include>
|
|
from lect a
|
|
left outer join lectinning b on b.lectno=a.lectno and b.cmino=#cmino#
|
|
where a.lectno=#lectno# and a.status=1 and a.ischanged=0 and b.lectno is null;
|
|
|
|
<!--진도율, lect.apoint, 진도율 환산점수 update #xodus-->
|
|
update lect a
|
|
inner join (
|
|
select a.lectno,convert(100*count(c.lectno)/count(b.cmino), int) attrate
|
|
from lectinning a
|
|
inner join lect a2 on a2.lectno=a.lectno
|
|
inner join cminning b on b.cmno=a2.cmno and ifnull(b.isscd,0)=0
|
|
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.cmino=#cmino# and a.istatus=2
|
|
group by a.lectno
|
|
) b on b.lectno=a.lectno
|
|
inner join cmev ce on a.cmno = ce.cmno
|
|
set a.attrate=b.attrate
|
|
,a.apoint = (((b.attrate / 100) * ce.attend / 100)* 100)
|
|
,a.tpoint = round((((b.attrate / 100) * ce.attend / 100)* 100) + ifnull(a.mpoint, 0) + ifnull(a.fpoint, 0) + ifnull(a.spoint, 0) + ifnull(a.dpoint, 0),0)
|
|
,a.stime=case when a.stime is null then <include refid="sql.now"></include> else a.stime end
|
|
,a.etime=case when a.etime is null then <include refid="sql.now"></include> else a.etime end
|
|
,a.sip=case when a.sip is null then #uip# else a.sip end
|
|
,a.eip=case when a.eip is null then #uip# else a.eip end
|
|
,a.ispcs=case when a.ispcs is null then 1 else a.ispcs end
|
|
,a.ispce=case when a.ispce is null then 1 else a.ispce end
|
|
where a.lectno=#lectno#
|
|
</update>
|
|
</statements>
|
|
</sqlMap>
|
|
|
|
|
|
|
|
|