275 lines
18 KiB
XML
275 lines
18 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="gradeCache" implementation="LRU" >
|
|
<flushInterval hours="1" />
|
|
<property name="CacheSize" value="1000" />
|
|
</cacheModel>
|
|
</cacheModels>
|
|
<resultMaps></resultMaps>
|
|
<statements>
|
|
<sql id="grade.query">
|
|
select a.lectno
|
|
,(b.attrate / 100) * (case when b.isrebate=1 then d.attendrfd else d.attend end / 100) * 100 apoint
|
|
,a.ex0cnt,a.ex0lectcnt,a.ex0lectpoint,(a.ex0lectpoint / 100) * (case when b.isrebate=1 then d.midrfd else d.mid end / 100) * 100 mpoint
|
|
,a.ex1cnt,a.ex1lectcnt,a.ex1lectpoint,(a.ex1lectpoint / 100) * (case when b.isrebate=1 then d.finalrfd else d.final end / 100) * 100 fpoint
|
|
,a.sd0cnt,a.sd0lectcnt,a.sd0lectpoint,(a.sd0lectpoint / 100) * (case when b.isrebate=1 then d.subjectrfd else d.subject end / 100) * 100 spoint
|
|
,a.sd1cnt,a.sd1lectcnt,a.sd1lectpoint,(a.sd1lectpoint / 100) * (case when b.isrebate=1 then d.discussrfd else d.discuss end / 100) * 100 dpoint
|
|
,a.rs0cnt,a.rs0lectcnt,a.rs0lectpoint
|
|
|
|
,case when case when b.isrebate=1 then d.attendcutrfd else d.attendcut end <= b.attrate then 1 else 0 end ispassa
|
|
,case when case when b.isrebate=1 then d.midcutrfd else d.midcut end <= a.ex0lectpoint then 1 else 0 end ispassm
|
|
,case when case when b.isrebate=1 then d.finalcutrfd else d.finalcut end <= a.ex1lectpoint then 1 else 0 end ispassf
|
|
,case when case when b.isrebate=1 then d.subjectcutrfd else d.subjectcut end <= a.sd0lectpoint then 1 else 0 end ispasss
|
|
,case when case when b.isrebate=1 then d.discusscutrfd else d.discusscut end <= a.sd1lectpoint then 1 else 0 end ispassd
|
|
|
|
,case when
|
|
case when case when b.isrebate=1 then d.attendcutrfd else d.attendcut end <= b.attrate then 1 else 0 end =1 and
|
|
case when case when b.isrebate=1 then d.midcutrfd else d.midcut end <= a.ex0lectpoint then 1 else 0 end =1 and
|
|
case when case when b.isrebate=1 then d.finalcutrfd else d.finalcut end <= a.ex1lectpoint then 1 else 0 end =1 and
|
|
case when case when b.isrebate=1 then d.subjectcutrfd else d.subjectcut end <= a.sd0lectpoint then 1 else 0 end =1 and
|
|
case when case when b.isrebate=1 then d.discusscutrfd else d.discusscut end <= a.sd1lectpoint then 1 else 0 end =1 and
|
|
|
|
case when case when b.isrebate=1 then d.cutrfd else d.cut end <=
|
|
((b.attrate / 100) * (case when b.isrebate=1 then d.attendrfd else d.attend end / 100 * 100))
|
|
+((a.ex0lectpoint / 100) * (case when b.isrebate=1 then d.midrfd else d.mid end / 100)* 100)
|
|
+((a.ex1lectpoint / 100) * (case when b.isrebate=1 then d.finalrfd else d.final end / 100)* 100)
|
|
+((a.sd0lectpoint / 100) * (case when b.isrebate=1 then d.subjectrfd else d.subject end / 100)* 100)
|
|
+((a.sd1lectpoint / 100) * (case when b.isrebate=1 then d.discussrfd else d.discuss end / 100)* 100) then 1 else 0 end = 1 then 1 else 0 end ispass
|
|
from (
|
|
select a.lectno
|
|
,sum(ex0cnt) ex0cnt,sum(ex0lectcnt) ex0lectcnt,sum(ex0lectpoint) ex0lectpoint
|
|
,sum(ex1cnt) ex1cnt,sum(ex1lectcnt) ex1lectcnt,sum(ex1lectpoint) ex1lectpoint
|
|
,sum(sd0cnt) sd0cnt,sum(sd0lectcnt) sd0lectcnt,sum(sd0lectpoint) sd0lectpoint
|
|
,sum(sd1cnt) sd1cnt,sum(sd1lectcnt) sd1lectcnt,sum(sd1lectpoint) sd1lectpoint
|
|
,sum(rs0cnt) rs0cnt,sum(rs0lectcnt) rs0lectcnt,sum(rs0lectpoint) rs0lectpoint
|
|
from (
|
|
select a.lectno
|
|
,count(b.exno) ex0cnt,count(c.lectno) ex0lectcnt,avg(ifnull(c.tpoint,0) / b.tpoint * 100) ex0lectpoint
|
|
,0 ex1cnt,0 ex1lectcnt,0 ex1lectpoint
|
|
,0 sd0cnt,0 sd0lectcnt,0 sd0lectpoint
|
|
,0 sd1cnt,0 sd1lectcnt,0 sd1lectpoint
|
|
,0 rs0cnt,0 rs0lectcnt,0 rs0lectpoint
|
|
from (
|
|
select b.lectno,a.cmno
|
|
from cm a
|
|
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
|
|
<isNotNull property="lectno">and b.lectno=#lectno#</isNotNull>
|
|
<isNotNull property="userno">and b.userno=#userno#</isNotNull>
|
|
<isNotNull property="attrateunder">and b.attrate <= #attrateunder#</isNotNull>
|
|
<isNotNull property="isrebate">and b.isrebate=#isrebate#</isNotNull>
|
|
<isNotNull property="lectnos">and b.lectno in ($lectnos$)</isNotNull>
|
|
inner join users c on c.userno=b.userno and c.status=1
|
|
<isNotNull property="userid">and c.userid=#userid#</isNotNull>
|
|
<isNotNull property="username">and c.username=#username#</isNotNull>
|
|
where a.ismaster=0
|
|
<isNotNull property="cgno">and a.cgno=#cgno#</isNotNull>
|
|
<isNotNull property="tmno">and a.tmno=#tmno#</isNotNull>
|
|
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
|
|
<isNotNull property="cmnos">and a.cmno in ($cmnos$)</isNotNull>
|
|
<isNotNull property="cshapes">and a.cshape in ($cshapes$)</isNotNull>
|
|
and <!--a.isuse=1 and--> a.isdel=0
|
|
) a
|
|
left outer join cmex b on b.cmno=a.cmno and b.extype=0 and b.isdel=0
|
|
left outer join lectex c on c.lectno=a.lectno and c.exno=b.exno
|
|
group by a.lectno
|
|
union all
|
|
select a.lectno
|
|
,0,0,0
|
|
,count(b.exno),count(c.lectno),avg(ifnull(c.tpoint,0) / b.tpoint * 100)
|
|
,0,0,0
|
|
,0,0,0
|
|
,0,0,0
|
|
from (
|
|
select b.lectno,a.cmno
|
|
from cm a
|
|
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
|
|
<isNotNull property="lectno">and b.lectno=#lectno#</isNotNull>
|
|
<isNotNull property="userno">and b.userno=#userno#</isNotNull>
|
|
<isNotNull property="attrateunder">and b.attrate <= #attrateunder#</isNotNull>
|
|
<isNotNull property="isrebate">and b.isrebate=#isrebate#</isNotNull>
|
|
<isNotNull property="lectnos">and b.lectno in ($lectnos$)</isNotNull>
|
|
inner join users c on c.userno=b.userno and c.status=1
|
|
<isNotNull property="userid">and c.userid=#userid#</isNotNull>
|
|
<isNotNull property="username">and c.username=#username#</isNotNull>
|
|
where a.ismaster=0
|
|
<isNotNull property="cgno">and a.cgno=#cgno#</isNotNull>
|
|
<isNotNull property="tmno">and a.tmno=#tmno#</isNotNull>
|
|
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
|
|
<isNotNull property="cmnos">and a.cmno in ($cmnos$)</isNotNull>
|
|
<isNotNull property="cshapes">and a.cshape in ($cshapes$)</isNotNull>
|
|
<!--and a.isuse=1--> and a.isdel=0
|
|
) a
|
|
left outer join cmex b on b.cmno=a.cmno and b.extype=1 and b.isdel=0
|
|
left outer join lectex c on c.lectno=a.lectno and c.exno=b.exno
|
|
group by a.lectno
|
|
union all
|
|
select a.lectno
|
|
,0,0,0
|
|
,0,0,0
|
|
,count(b.sdno),count(c.lectno),avg(ifnull(c.cpoint,0) / b.tpoint * 100)
|
|
,0,0,0
|
|
,0,0,0
|
|
from (
|
|
select b.lectno,a.cmno
|
|
from cm a
|
|
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
|
|
<isNotNull property="lectno">and b.lectno=#lectno#</isNotNull>
|
|
<isNotNull property="userno">and b.userno=#userno#</isNotNull>
|
|
<isNotNull property="attrateunder">and b.attrate <= #attrateunder#</isNotNull>
|
|
<isNotNull property="isrebate">and b.isrebate=#isrebate#</isNotNull>
|
|
<isNotNull property="lectnos">and b.lectno in ($lectnos$)</isNotNull>
|
|
inner join users c on c.userno=b.userno and c.status=1
|
|
<isNotNull property="userid">and c.userid=#userid#</isNotNull>
|
|
<isNotNull property="username">and c.username=#username#</isNotNull>
|
|
where a.ismaster=0
|
|
<isNotNull property="cgno">and a.cgno=#cgno#</isNotNull>
|
|
<isNotNull property="tmno">and a.tmno=#tmno#</isNotNull>
|
|
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
|
|
<isNotNull property="cmnos">and a.cmno in ($cmnos$)</isNotNull>
|
|
<isNotNull property="cshapes">and a.cshape in ($cshapes$)</isNotNull>
|
|
<!--and a.isuse=1--> and a.isdel=0
|
|
) a
|
|
left outer join cmsd b on b.cmno=a.cmno and b.sdtype=0 and b.isdel=0
|
|
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
|
|
group by a.lectno
|
|
union all
|
|
select a.lectno
|
|
,0,0,0
|
|
,0,0,0
|
|
,0,0,0
|
|
,count(b.sdno),count(c.lectno),avg(ifnull(c.cpoint,0) / b.tpoint * 100)
|
|
,0,0,0
|
|
from (
|
|
select b.lectno,a.cmno
|
|
from cm a
|
|
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
|
|
<isNotNull property="lectno">and b.lectno=#lectno#</isNotNull>
|
|
<isNotNull property="userno">and b.userno=#userno#</isNotNull>
|
|
<isNotNull property="attrateunder">and b.attrate <= #attrateunder#</isNotNull>
|
|
<isNotNull property="isrebate">and b.isrebate=#isrebate#</isNotNull>
|
|
<isNotNull property="lectnos">and b.lectno in ($lectnos$)</isNotNull>
|
|
inner join users c on c.userno=b.userno and c.status=1
|
|
<isNotNull property="userid">and c.userid=#userid#</isNotNull>
|
|
<isNotNull property="username">and c.username=#username#</isNotNull>
|
|
where a.ismaster=0
|
|
<isNotNull property="cgno">and a.cgno=#cgno#</isNotNull>
|
|
<isNotNull property="tmno">and a.tmno=#tmno#</isNotNull>
|
|
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
|
|
<isNotNull property="cmnos">and a.cmno in ($cmnos$)</isNotNull>
|
|
<isNotNull property="cshapes">and a.cshape in ($cshapes$)</isNotNull>
|
|
<!--and a.isuse=1--> and a.isdel=0
|
|
) a
|
|
left outer join cmsd b on b.cmno=a.cmno and b.sdtype=1 and b.isdel=0
|
|
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
|
|
group by a.lectno
|
|
union all
|
|
select a.lectno
|
|
,0,0,0
|
|
,0,0,0
|
|
,0,0,0
|
|
,0,0,0
|
|
,count(b.rsno),count(c.lectno),0
|
|
from (
|
|
select b.lectno,a.cmno
|
|
from cm a
|
|
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
|
|
<isNotNull property="lectno">and b.lectno=#lectno#</isNotNull>
|
|
<isNotNull property="userno">and b.userno=#userno#</isNotNull>
|
|
<isNotNull property="attrateunder">and b.attrate <= #attrateunder#</isNotNull>
|
|
<isNotNull property="isrebate">and b.isrebate=#isrebate#</isNotNull>
|
|
<isNotNull property="lectnos">and b.lectno in ($lectnos$)</isNotNull>
|
|
inner join users c on c.userno=b.userno and c.status=1
|
|
<isNotNull property="userid">and c.userid=#userid#</isNotNull>
|
|
<isNotNull property="username">and c.username=#username#</isNotNull>
|
|
where a.ismaster=0
|
|
<isNotNull property="cgno">and a.cgno=#cgno#</isNotNull>
|
|
<isNotNull property="tmno">and a.tmno=#tmno#</isNotNull>
|
|
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
|
|
<isNotNull property="cmnos">and a.cmno in ($cmnos$)</isNotNull>
|
|
<isNotNull property="cshapes">and a.cshape in ($cshapes$)</isNotNull>
|
|
<!--and a.isuse=1--> and a.isdel=0
|
|
) a
|
|
left outer join cmrs b on b.cmno=a.cmno and b.rstype=0 and b.isdel=0
|
|
left outer join lectrs c on c.lectno=a.lectno and c.rsno=b.rsno
|
|
group by a.lectno
|
|
) a
|
|
group by a.lectno
|
|
) a
|
|
inner join lect b on b.lectno=a.lectno
|
|
inner join cmev d on d.cmno=b.cmno
|
|
</sql>
|
|
<select id="grade.lectgrades" parameterClass="hashtable" resultClass="lect">
|
|
select a.lectno,b.userno
|
|
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">c.cname,c.cmno,u.username</isNull> ) rno
|
|
,count(a.lectno) over() pagetotalcount
|
|
,b.isrebate,ua.asname,u.username,u.userid,b.iscomplete
|
|
,p.payoktime
|
|
,c.sstime,c.cmno,c.cname,c.classno
|
|
,b.attrate
|
|
,a.apoint
|
|
,a.ex0cnt,a.ex0lectcnt,a.ex0lectpoint,a.mpoint
|
|
,a.ex1cnt,a.ex1lectcnt,a.ex1lectpoint,a.fpoint
|
|
,a.sd0cnt,a.sd0lectcnt,a.sd0lectpoint,a.spoint
|
|
,a.sd1cnt,a.sd1lectcnt,a.sd1lectpoint,a.dpoint
|
|
,a.rs0cnt,a.rs0lectcnt,a.rs0lectpoint
|
|
from (
|
|
<include refid="grade.query"></include>
|
|
) a
|
|
inner join lect b on b.lectno=a.lectno
|
|
inner join pay p on p.payno=b.payno
|
|
inner join users u on u.userno=b.userno <isNotNull property="ustatus">and u.status=#ustatus#</isNotNull>
|
|
left outer join assign ua on ua.asno=u.asno
|
|
inner join cm c on c.cmno=b.cmno
|
|
inner join cm c2 on c2.cmno=c.pcmno
|
|
inner join cmev d on d.cmno=c.cmno
|
|
<dynamic prepend="where">
|
|
<isNotNull property="est1not" prepend="and">a.ex0lectcnt < a.ex0cnt</isNotNull>
|
|
<isNotNull property="est2not" prepend="and">a.ex1lectcnt < a.ex1cnt</isNotNull>
|
|
<isNotNull property="est11not" prepend="and">a.sd0lectcnt < a.sd0cnt</isNotNull>
|
|
<isNotNull property="est12not" prepend="and">a.sd1lectcnt < a.sd1cnt</isNotNull>
|
|
<isNotNull property="est21not" prepend="and">a.rs0lectcnt < a.rs0cnt</isNotNull>
|
|
<isNotNull property="cname" prepend="and">c2.cname like concat('%',#cname#,'%')</isNotNull>
|
|
</dynamic>
|
|
order by rno
|
|
</select>
|
|
<update id="grade.lectcomplete.abs" parameterClass="hashtable">
|
|
update lect set <include refid="sql.up"></include>
|
|
,iscomplete=1
|
|
where lectno in ($lectnos$)
|
|
</update>
|
|
<update id="grade.lectcomplete" parameterClass="hashtable">
|
|
update lect a
|
|
inner join (
|
|
<include refid="grade.query"></include>
|
|
) b on b.lectno=a.lectno
|
|
set a.udt=<include refid="sql.now"></include>,a.uno=#uno#,a.uip=#uip#
|
|
,a.iscomplete=b.ispass
|
|
,a.apoint=b.apoint
|
|
,a.mpoint=a.mpoint
|
|
,a.fpoint=b.fpoint
|
|
,a.spoint=b.spoint
|
|
,a.dpoint=b.dpoint
|
|
,a.tpoint=b.apoint+b.mpoint+b.fpoint+b.spoint+b.dpoint
|
|
where a.status=1 and a.ischanged=0
|
|
<isNotNull property="cmnos">and a.cmno in ($cmnos$)</isNotNull>
|
|
<isNotNull property="lectnos">and a.lectno in ($lectnos$)</isNotNull>
|
|
</update>
|
|
<select id="grade.nocompletecm" parameterClass="string" resultClass="cm">
|
|
select a.cmno, max(a.iscomplete)
|
|
from lect a
|
|
inner join users b on b.userno=a.userno and b.status=1
|
|
where a.cmno in ($cmnos$) and a.status=1 and a.ischanged=0
|
|
group by a.cmno
|
|
having ifnull(max(a.iscomplete),0) <>1
|
|
</select>
|
|
</statements>
|
|
</sqlMap>
|
|
|
|
|
|
|
|
|