추가개발01/06_1

This commit is contained in:
김한진 2026-01-06 08:58:17 +09:00
parent f838f54d08
commit ed5ed86f12
14 changed files with 543 additions and 207 deletions

View File

@ -94,7 +94,7 @@
}
@*최종평가*@
<td>@(d.ex1cnt < 1 ? "-" :d.ex1lectcnt < 1 && d.ex1cnt > 0 ? "미제출" : d.ex1lectpoint.ToString())</td>
<td>@(d.ex1cnt < 1 ? "-" : d.ex1lectcnt < 1 && d.ex1cnt > 0 ? "미제출" : d.ex1lectpoint.ToString())</td>
@*과제*@
<td>@(d.sd0cnt < 1 ? "-" :d.sd0lectcnt < 1 && d.sd0cnt > 0 ? "미제출" : d.sd0lectpoint.ToString())</td>

View File

@ -516,7 +516,8 @@ namespace NP.Base.Controllers
{
try
{
var ispass = Dao.Get<Lect>("grade.ispass", new Hashtable() { { "lectno", lect.lectno } }).FirstOrDefault().ispass;
//var ispass = Dao.Get<Lect>("grade.ispass", new Hashtable() { { "lectno", lect.lectno } }).FirstOrDefault().ispass;
var ispass = Dao.Get<Lect>("grade.ispass2", new Hashtable() { { "lectno", lect.lectno } }).FirstOrDefault().ispass;
if (ispass == 1)
{
if (lect.iscomplete == 0)

View File

@ -81,36 +81,39 @@
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
,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 &lt;= #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 &lt; 99
<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
select *
from (
select a.lectno
,0 ex0cnt,0 ex0lectcnt,0 ex0lectpoint,count(b.exno) ex1cnt,count(c.lectno) ex1lectcnt,avg(ifnull(c.tpoint, 0) / b.tpoint * 100) ex1lectpoint,0 sd0cnt
,0 sd0lectcnt,0 sd0lectpoint,0 sd1cnt,0 sd1lectcnt,0 sd1lectpoint,0 rs0cnt,0 rs0lectcnt,0 rs0lectpoint,0 at0cnt,0 at0lectcnt
,row_number() OVER (PARTITION BY a.lectno ORDER BY (c.estart IS NOT NULL) DESC) rn
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 &lt;= #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 &lt; 99
<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,b.exno
) a
where a.rn = 1
union all
select a.lectno
,0,0,0
@ -1021,6 +1024,24 @@
LEFT JOIN cmsd sd ON sd.cmno = fl.cmno AND sd.isdel = 0 LEFT JOIN lectsd lsd ON lsd.lectno = fl.lectno AND lsd.sdno = sd.sdno
LEFT JOIN cmrs rs ON rs.cmno = fl.cmno AND rs.rstype = 0 AND rs.isdel = 0 LEFT JOIN lectrs lrs ON lrs.lectno = fl.lectno AND lrs.rsno = rs.rsno
LEFT JOIN cminning ci ON ci.cmno = fl.cmno AND ci.isonline = 0 AND ci.isscd = 1 LEFT JOIN lectinning li ON li.cmino = ci.cmino AND li.lectno = fl.lectno AND li.istatus = 2
GROUP BY fl.lectno, fl.cmno, fl.isrebate, fl.attrate
UNION ALL
SELECT
fl.lectno, fl.cmno, fl.isrebate, fl.attrate
, COUNT(DISTINCT CASE WHEN ex.extype = 0 THEN ex.exno END) AS ex0cnt, COUNT(DISTINCT CASE WHEN ex.extype = 0 THEN lex.lectno END) AS ex0lectcnt, AVG(CASE WHEN ex.extype = 0 AND ex.tpoint > 0 THEN IFNULL(lex.tpoint, 0) / ex.tpoint * 100 ELSE 0 END) AS ex0lectpoint
, COUNT(DISTINCT CASE WHEN ex.extype = 1 THEN ex.exno END) AS ex1cnt, COUNT(DISTINCT CASE WHEN ex.extype = 1 THEN lex.lectno END) AS ex1lectcnt, AVG(CASE WHEN ex.extype = 1 AND ex.tpoint > 0 THEN IFNULL(lex.tpoint, 0) / ex.tpoint * 100 ELSE 0 END) AS ex1lectpoint
, COUNT(DISTINCT CASE WHEN sd.sdtype = 0 THEN sd.sdno END) AS sd0cnt, COUNT(DISTINCT CASE WHEN sd.sdtype = 0 THEN lsd.lectno END) AS sd0lectcnt, AVG(CASE WHEN sd.sdtype = 0 AND sd.tpoint > 0 THEN IFNULL(lsd.cpoint, 0) / sd.tpoint * 100 ELSE 0 END) AS sd0lectpoint
, COUNT(DISTINCT CASE WHEN sd.sdtype = 1 THEN sd.sdno END) AS sd1cnt, COUNT(DISTINCT CASE WHEN sd.sdtype = 1 THEN lsd.lectno END) AS sd1lectcnt, AVG(CASE WHEN sd.sdtype = 1 AND sd.tpoint > 0 THEN IFNULL(lsd.cpoint, 0) / sd.tpoint * 100 ELSE 0 END) AS sd1lectpoint
, COUNT(DISTINCT CASE WHEN rs.rstype = 0 THEN rs.rsno END) AS rs0cnt, COUNT(DISTINCT CASE WHEN rs.rstype = 0 THEN lrs.lectno END) AS rs0lectcnt
, COUNT(DISTINCT ci.cmino) AS at0cnt, COUNT(DISTINCT li.lectno) AS at0lectcnt
FROM filtered_lect fl
LEFT JOIN cmex ex ON ex.cmno = fl.cmno AND ex.isdel = 0 LEFT JOIN lectex lex ON lex.lectno = fl.lectno AND lex.exno = ex.exno
LEFT JOIN cmsd sd ON sd.cmno = fl.cmno AND sd.isdel = 0 LEFT JOIN lectsd lsd ON lsd.lectno = fl.lectno AND lsd.sdno = sd.sdno
LEFT JOIN cmrs rs ON rs.cmno = fl.cmno AND rs.rstype = 0 AND rs.isdel = 0 LEFT JOIN lectrs lrs ON lrs.lectno = fl.lectno AND lrs.rsno = rs.rsno
LEFT JOIN cminning ci ON ci.cmno = fl.cmno AND ci.isonline = 0 AND ci.isscd = 1 LEFT JOIN lectinning li ON li.cmino = ci.cmino AND li.lectno = fl.lectno AND li.istatus = 2
WHERE ex.cmisno > 0
GROUP BY fl.lectno, fl.cmno, fl.isrebate, fl.attrate
),
final_scores AS (
@ -1086,6 +1107,7 @@
LEFT OUTER JOIN comcode tg ON tg.ccode = ppl.typegrade
LEFT OUTER JOIN comcode tj ON tj.ccode = ppl.typejob
WHERE 1=1
AND fs.ex1cnt &lt; 2
<dynamic>
<isNotNull property="est1not"><![CDATA[AND fs.ex0lectcnt < fs.ex0cnt]]></isNotNull>
<isNotNull property="est2not"><![CDATA[AND fs.ex1lectcnt < fs.ex1cnt]]></isNotNull>
@ -1989,6 +2011,143 @@
<isNotNull property="lectno" prepend="and">a.lectno = #lectno#</isNotNull>
</dynamic>
</select>
<select id="grade.ispass2" parameterClass="hashtable" resultClass="lect">
SELECT a.*
FROM (
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) &lt;= b.attrate THEN 1 ELSE 0 END) ispassa
,(CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.midcutrfd ELSE d.midcut END ) &lt;= a.ex0lectpoint THEN 1 ELSE 0 END) ispassm
,(CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.finalcutrfd ELSE d.finalcut END) &lt;= a.ex1lectpoint THEN 1 ELSE 0 END) ispassf
,(CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.subjectcutrfd ELSE d.subjectcut END) &lt;= a.sd0lectpoint THEN 1 ELSE 0 END) ispasss
,(CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.discusscutrfd ELSE d.discusscut END) &lt;= a.sd1lectpoint THEN 1 ELSE 0 END) ispassd
,(CASE WHEN (CASE WHEN ifnull(d.isoffabs, 0) = 1 THEN ifnull(a.at0cnt, 0) ELSE 0 END) &lt;= ifnull(a.at0lectcnt, 0) THEN 1 ELSE 0 END) ispassat
,(CASE WHEN (CASE WHEN (CASE WHEN ifnull(d.isoffabs, 0) = 1 THEN ifnull(a.at0cnt, 0) ELSE 0 END) &lt;= ifnull(a.at0lectcnt, 0) THEN 1 ELSE 0 END) = 1 AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.attendcutrfd ELSE d.attendcut END) &lt;= b.attrate THEN 1 ELSE 0 END) = 1
AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.midcutrfd ELSE d.midcut END) &lt;= a.ex0lectpoint THEN 1 ELSE 0 END) = 1 AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.finalcutrfd ELSE d.finalcut END) &lt;= a.ex1lectpoint THEN 1 ELSE 0 END) = 1
AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.subjectcutrfd ELSE d.subjectcut END) &lt;= a.sd0lectpoint THEN 1 ELSE 0 END) = 1 AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.discusscutrfd ELSE d.discusscut END) &lt;= a.sd1lectpoint THEN 1 ELSE 0 END) = 1
AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.cutrfd ELSE d.cut END) &lt;= ((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,sum(at0cnt) at0cnt,sum(at0lectcnt) at0lectcnt
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,0 at0cnt,0 at0lectcnt
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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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
,a.ex0cnt,a.ex0lectcnt,a.ex0lectpoint,a.ex1cnt,a.ex1lectcnt,a.ex1lectpoint,a.sd0cnt
,a.sd0lectcnt,a.sd0lectpoint,a.sd1cnt,a.sd1lectcnt,a.sd1lectpoint,a.rs0cnt,a.rs0lectcnt,a.rs0lectpoint,a.at0cnt,a.at0lectcnt
FROM (
SELECT a.lectno
,0 ex0cnt,0 ex0lectcnt,0 ex0lectpoint,count(b.exno) ex1cnt,count(c.lectno) ex1lectcnt,avg(ifnull(c.tpoint, 0) / b.tpoint * 100) ex1lectpoint,0 sd0cnt
,0 sd0lectcnt,0 sd0lectpoint,0 sd1cnt,0 sd1lectcnt,0 sd1lectpoint,0 rs0cnt,0 rs0lectcnt,0 rs0lectpoint,0 at0cnt,0 at0lectcnt
,row_number() OVER (PARTITION BY a.lectno ORDER BY (c.estart IS NOT NULL) DESC) rn
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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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,b.exno
) a
WHERE a.rn = 1
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,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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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,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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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,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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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
UNION ALL
SELECT a.lectno
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,count(b.cmino),count(c.lectno)
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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 AND a.isdel = 0
) a
LEFT OUTER JOIN cminning b ON b.cmno = a.cmno AND b.isonline = 0 AND b.isscd = 1
LEFT OUTER JOIN lectinning c ON c.cmino = b.cmino AND c.lectno = a.lectno AND c.istatus = 2
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
) a
WHERE a.lectno = #lectno#
</select>
</statements>
</sqlMap>

View File

@ -1125,80 +1125,85 @@
order by a.rno
</select>
<select id="lect.lectexes.all" parameterClass="hashtable" resultClass="lectex">
select a.*
select *
from (
select a.lectno,a.userno,a.cmno,a.isrebate
,p.payoktime,a.sdate,a.edate
,b.exno,b.exname,b.extype <!--#xodus 수정완료 성적처리관련 컬럼 추가-->
,b2.cshape,b2.cname
,c.estart,c.eend,c.eip,c.tpoint,c.recount,c.entercount,c.cblock,c.isbyadmin
,d.username,d.userid
,e.asname
,f.cmisno,f.estart lestart,f.eend leend,f.sseq
,g.cname studyplacename
,a.iscomplete
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">d.username</isNull>) rno
,count(a.cdt) over() pagetotalcount
,cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) as mobile
from lect a
inner join cmex b on b.isdel=0 and b.cmno = a.cmno
inner join cm b2 on b2.cmno = b.cmno
inner join pay p on p.payno = a.payno
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
left outer join cminningscd f on f.cmisno = a.cmisno
left outer join comcode g on g.ccode = f.studyplace and g.isuse =1
select a.*
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.username</isNull>) rno
,count(a.lectno) OVER () pagetotalcount
from (
select a.lectno,a.userno,a.cmno,a.isrebate
,p.payoktime,a.sdate,a.edate
,b.exno,b.exname,b.extype <!--#xodus 수정완료 성적처리관련 컬럼 추가-->
,b2.cshape,b2.cname
,c.estart,c.eend,c.eip,c.tpoint,c.recount,c.entercount,c.cblock,c.isbyadmin
,d.username,d.userid
,e.asname
,f.cmisno,f.estart lestart,f.eend leend,f.sseq
,g.cname studyplacename
,a.iscomplete
,row_number() OVER (PARTITION BY a.lectno ORDER BY (c.estart IS NOT NULL) DESC) rn
,cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) as mobile
from lect a
inner join cmex b on b.isdel=0 and b.cmno = a.cmno
inner join cm b2 on b2.cmno = b.cmno
inner join pay p on p.payno = a.payno
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
left outer join cminningscd f on f.cmisno = a.cmisno
left outer join comcode g on g.ccode = f.studyplace and g.isuse =1
left outer join cmev ce on b2.cmno=ce.cmno
left outer join lect l on a.lectno = l.lectno
left outer join cminningscd cis on l.cmisno = cis.cmisno
left outer join lectinning li on a.lectno = li.lectno and cis.cmino = li.cmino
left outer join cmev ce on b2.cmno=ce.cmno
left outer join lect l on a.lectno = l.lectno
left outer join cminningscd cis on l.cmisno = cis.cmisno
left outer join lectinning li on a.lectno = li.lectno and cis.cmino = li.cmino
where a.status = 1 and a.ischanged=0 and d.status &lt; 99
<isNotNull property="extype">and b.extype = #extype#</isNotNull>
<isNotNull property="cmno">and a.cmno = #cmno#</isNotNull>
<isNotNull property="isrebate">and a.isrebate=#isrebate#</isNotNull>
<isNotNull property="edate">and (date_format((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end),'%Y-%m-%d') = #edate#)</isNotNull>
<isNotNull property="edate1">and ((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end) >= #edate1#)</isNotNull>
<isNotNull property="edate2">and ((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end) &lt;= #edate2#)</isNotNull>
<isNotNull property="cshape">and b2.cshape = #cshape#</isNotNull>
<isNotEmpty property="cname">and b2.cname like concat('%',#cname#,'%')</isNotEmpty>
<isNotEmpty property="cnamestr">and b2.cname like concat('%',#cname#,'%')</isNotEmpty>
<isNotNull property="iscomplete">and ifnull(a.iscomplete,0) = #iscomplete#</isNotNull>
<isNotNull property="studyplace">and f.studyplace = #studyplace#</isNotNull>
<isNotEmpty property="usernamestr">and d.username like concat('%',#usernamestr#,'%')</isNotEmpty>
<isNotEmpty property="useridstr">and d.userid like concat('%',#useridstr#,'%')</isNotEmpty>
<isNotEmpty property="searchtext">
<isEqual property="searchtype" compareValue="usernamestr">and d.username like concat('%',#usernamestr#,'%')</isEqual>
<isEqual property="searchtype" compareValue="useridstr">and d.userid like concat('%',#useridstr#,'%')</isEqual>
</isNotEmpty>
<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>
<isNotEmpty property="sdateall">and (case when b2.cshape = 0 and a.isrebate = 0 then p.payoktime else a.sdate end) &gt;= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmpty property="edateall">and (case when b2.cshape = 2 then f.eend else a.edate end) &lt;= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotEmpty property="asname">and e.asname like concat('%',#asname#,'%')</isNotEmpty>
<isNotNull property="mobile">and (cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) like concat('%',#mobile#,'%'))</isNotNull>
<isNotNull property="attendance" >
<!--해당없음-->
<isEqual property="attendance" compareValue="1" prepend="and"> ifnull(ce.isoffabs,0) = 0</isEqual>
<!--대상자(미입력/출석/결석)-->
<isEqual property="attendance" compareValue="2" prepend="and"> ifnull(ce.isoffabs,0) = 1</isEqual>
<!--미입력-->
<isEqual property="attendance" compareValue="3" prepend="and">ifnull(ce.isoffabs,0) = 1 and li.istatus is null </isEqual>
<!--출석-->
<isEqual property="attendance" compareValue="4" prepend="and">ifnull(ce.isoffabs,0) = 1 and ifnull(li.istatus,-1) = 2</isEqual>
<!--결석-->
<isEqual property="attendance" compareValue="5" prepend="and">ifnull(ce.isoffabs,0) = 1 and ifnull(li.istatus,-1) = 0</isEqual>
</isNotNull>
<isNotNull property="isbyadmin">
<isEqual property="isbyadmin" compareValue="-1" prepend="and">(c.isbyadmin = 0 or c.isbyadmin is null) and c.estart is null</isEqual>
<isEqual property="isbyadmin" compareValue="0" prepend="and">c.isbyadmin = 0 and c.estart is not null</isEqual>
<isEqual property="isbyadmin" compareValue="1" prepend="and">c.isbyadmin = 1</isEqual>
</isNotNull>
where a.status = 1 and a.ischanged=0 and d.status &lt; 99
<isNotNull property="extype">and b.extype = #extype#</isNotNull>
<isNotNull property="cmno">and a.cmno = #cmno#</isNotNull>
<isNotNull property="isrebate">and a.isrebate=#isrebate#</isNotNull>
<isNotNull property="edate">and (date_format((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end),'%Y-%m-%d') = #edate#)</isNotNull>
<isNotNull property="edate1">and ((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end) >= #edate1#)</isNotNull>
<isNotNull property="edate2">and ((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end) &lt;= #edate2#)</isNotNull>
<isNotNull property="cshape">and b2.cshape = #cshape#</isNotNull>
<isNotEmpty property="cname">and b2.cname like concat('%',#cname#,'%')</isNotEmpty>
<isNotEmpty property="cnamestr">and b2.cname like concat('%',#cname#,'%')</isNotEmpty>
<isNotNull property="iscomplete">and ifnull(a.iscomplete,0) = #iscomplete#</isNotNull>
<isNotNull property="studyplace">and f.studyplace = #studyplace#</isNotNull>
<isNotEmpty property="usernamestr">and d.username like concat('%',#usernamestr#,'%')</isNotEmpty>
<isNotEmpty property="useridstr">and d.userid like concat('%',#useridstr#,'%')</isNotEmpty>
<isNotEmpty property="searchtext">
<isEqual property="searchtype" compareValue="usernamestr">and d.username like concat('%',#usernamestr#,'%')</isEqual>
<isEqual property="searchtype" compareValue="useridstr">and d.userid like concat('%',#useridstr#,'%')</isEqual>
</isNotEmpty>
<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>
<isNotEmpty property="sdateall">and (case when b2.cshape = 0 and a.isrebate = 0 then p.payoktime else a.sdate end) &gt;= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmpty property="edateall">and (case when b2.cshape = 2 then f.eend else a.edate end) &lt;= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotEmpty property="asname">and e.asname like concat('%',#asname#,'%')</isNotEmpty>
<isNotNull property="mobile">and (cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) like concat('%',#mobile#,'%'))</isNotNull>
<isNotNull property="attendance" >
<!--해당없음-->
<isEqual property="attendance" compareValue="1" prepend="and"> ifnull(ce.isoffabs,0) = 0</isEqual>
<!--대상자(미입력/출석/결석)-->
<isEqual property="attendance" compareValue="2" prepend="and"> ifnull(ce.isoffabs,0) = 1</isEqual>
<!--미입력-->
<isEqual property="attendance" compareValue="3" prepend="and">ifnull(ce.isoffabs,0) = 1 and li.istatus is null </isEqual>
<!--출석-->
<isEqual property="attendance" compareValue="4" prepend="and">ifnull(ce.isoffabs,0) = 1 and ifnull(li.istatus,-1) = 2</isEqual>
<!--결석-->
<isEqual property="attendance" compareValue="5" prepend="and">ifnull(ce.isoffabs,0) = 1 and ifnull(li.istatus,-1) = 0</isEqual>
</isNotNull>
<isNotNull property="isbyadmin">
<isEqual property="isbyadmin" compareValue="-1" prepend="and">(c.isbyadmin = 0 or c.isbyadmin is null) and c.estart is null</isEqual>
<isEqual property="isbyadmin" compareValue="0" prepend="and">c.isbyadmin = 0 and c.estart is not null</isEqual>
<isEqual property="isbyadmin" compareValue="1" prepend="and">c.isbyadmin = 1</isEqual>
</isNotNull>
) a
WHERE a.rn = 1
) a
<include refid="sql.pagedynamic"></include>
order by a.rno

View File

@ -81,36 +81,39 @@
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
,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 &lt;= #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 &lt; 99
<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
select *
from (
select a.lectno
,0 ex0cnt,0 ex0lectcnt,0 ex0lectpoint,count(b.exno) ex1cnt,count(c.lectno) ex1lectcnt,avg(ifnull(c.tpoint, 0) / b.tpoint * 100) ex1lectpoint,0 sd0cnt
,0 sd0lectcnt,0 sd0lectpoint,0 sd1cnt,0 sd1lectcnt,0 sd1lectpoint,0 rs0cnt,0 rs0lectcnt,0 rs0lectpoint,0 at0cnt,0 at0lectcnt
,row_number() OVER (PARTITION BY a.lectno ORDER BY (c.estart IS NOT NULL) DESC) rn
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 &lt;= #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 &lt; 99
<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,b.exno
) a
where a.rn = 1
union all
select a.lectno
,0,0,0
@ -1021,6 +1024,24 @@
LEFT JOIN cmsd sd ON sd.cmno = fl.cmno AND sd.isdel = 0 LEFT JOIN lectsd lsd ON lsd.lectno = fl.lectno AND lsd.sdno = sd.sdno
LEFT JOIN cmrs rs ON rs.cmno = fl.cmno AND rs.rstype = 0 AND rs.isdel = 0 LEFT JOIN lectrs lrs ON lrs.lectno = fl.lectno AND lrs.rsno = rs.rsno
LEFT JOIN cminning ci ON ci.cmno = fl.cmno AND ci.isonline = 0 AND ci.isscd = 1 LEFT JOIN lectinning li ON li.cmino = ci.cmino AND li.lectno = fl.lectno AND li.istatus = 2
GROUP BY fl.lectno, fl.cmno, fl.isrebate, fl.attrate
UNION ALL
SELECT
fl.lectno, fl.cmno, fl.isrebate, fl.attrate
, COUNT(DISTINCT CASE WHEN ex.extype = 0 THEN ex.exno END) AS ex0cnt, COUNT(DISTINCT CASE WHEN ex.extype = 0 THEN lex.lectno END) AS ex0lectcnt, AVG(CASE WHEN ex.extype = 0 AND ex.tpoint > 0 THEN IFNULL(lex.tpoint, 0) / ex.tpoint * 100 ELSE 0 END) AS ex0lectpoint
, COUNT(DISTINCT CASE WHEN ex.extype = 1 THEN ex.exno END) AS ex1cnt, COUNT(DISTINCT CASE WHEN ex.extype = 1 THEN lex.lectno END) AS ex1lectcnt, AVG(CASE WHEN ex.extype = 1 AND ex.tpoint > 0 THEN IFNULL(lex.tpoint, 0) / ex.tpoint * 100 ELSE 0 END) AS ex1lectpoint
, COUNT(DISTINCT CASE WHEN sd.sdtype = 0 THEN sd.sdno END) AS sd0cnt, COUNT(DISTINCT CASE WHEN sd.sdtype = 0 THEN lsd.lectno END) AS sd0lectcnt, AVG(CASE WHEN sd.sdtype = 0 AND sd.tpoint > 0 THEN IFNULL(lsd.cpoint, 0) / sd.tpoint * 100 ELSE 0 END) AS sd0lectpoint
, COUNT(DISTINCT CASE WHEN sd.sdtype = 1 THEN sd.sdno END) AS sd1cnt, COUNT(DISTINCT CASE WHEN sd.sdtype = 1 THEN lsd.lectno END) AS sd1lectcnt, AVG(CASE WHEN sd.sdtype = 1 AND sd.tpoint > 0 THEN IFNULL(lsd.cpoint, 0) / sd.tpoint * 100 ELSE 0 END) AS sd1lectpoint
, COUNT(DISTINCT CASE WHEN rs.rstype = 0 THEN rs.rsno END) AS rs0cnt, COUNT(DISTINCT CASE WHEN rs.rstype = 0 THEN lrs.lectno END) AS rs0lectcnt
, COUNT(DISTINCT ci.cmino) AS at0cnt, COUNT(DISTINCT li.lectno) AS at0lectcnt
FROM filtered_lect fl
LEFT JOIN cmex ex ON ex.cmno = fl.cmno AND ex.isdel = 0 LEFT JOIN lectex lex ON lex.lectno = fl.lectno AND lex.exno = ex.exno
LEFT JOIN cmsd sd ON sd.cmno = fl.cmno AND sd.isdel = 0 LEFT JOIN lectsd lsd ON lsd.lectno = fl.lectno AND lsd.sdno = sd.sdno
LEFT JOIN cmrs rs ON rs.cmno = fl.cmno AND rs.rstype = 0 AND rs.isdel = 0 LEFT JOIN lectrs lrs ON lrs.lectno = fl.lectno AND lrs.rsno = rs.rsno
LEFT JOIN cminning ci ON ci.cmno = fl.cmno AND ci.isonline = 0 AND ci.isscd = 1 LEFT JOIN lectinning li ON li.cmino = ci.cmino AND li.lectno = fl.lectno AND li.istatus = 2
WHERE ex.cmisno > 0
GROUP BY fl.lectno, fl.cmno, fl.isrebate, fl.attrate
),
final_scores AS (
@ -1086,6 +1107,7 @@
LEFT OUTER JOIN comcode tg ON tg.ccode = ppl.typegrade
LEFT OUTER JOIN comcode tj ON tj.ccode = ppl.typejob
WHERE 1=1
AND fs.ex1cnt &lt; 2
<dynamic>
<isNotNull property="est1not"><![CDATA[AND fs.ex0lectcnt < fs.ex0cnt]]></isNotNull>
<isNotNull property="est2not"><![CDATA[AND fs.ex1lectcnt < fs.ex1cnt]]></isNotNull>
@ -1989,6 +2011,143 @@
<isNotNull property="lectno" prepend="and">a.lectno = #lectno#</isNotNull>
</dynamic>
</select>
<select id="grade.ispass2" parameterClass="hashtable" resultClass="lect">
SELECT a.*
FROM (
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) &lt;= b.attrate THEN 1 ELSE 0 END) ispassa
,(CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.midcutrfd ELSE d.midcut END ) &lt;= a.ex0lectpoint THEN 1 ELSE 0 END) ispassm
,(CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.finalcutrfd ELSE d.finalcut END) &lt;= a.ex1lectpoint THEN 1 ELSE 0 END) ispassf
,(CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.subjectcutrfd ELSE d.subjectcut END) &lt;= a.sd0lectpoint THEN 1 ELSE 0 END) ispasss
,(CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.discusscutrfd ELSE d.discusscut END) &lt;= a.sd1lectpoint THEN 1 ELSE 0 END) ispassd
,(CASE WHEN (CASE WHEN ifnull(d.isoffabs, 0) = 1 THEN ifnull(a.at0cnt, 0) ELSE 0 END) &lt;= ifnull(a.at0lectcnt, 0) THEN 1 ELSE 0 END) ispassat
,(CASE WHEN (CASE WHEN (CASE WHEN ifnull(d.isoffabs, 0) = 1 THEN ifnull(a.at0cnt, 0) ELSE 0 END) &lt;= ifnull(a.at0lectcnt, 0) THEN 1 ELSE 0 END) = 1 AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.attendcutrfd ELSE d.attendcut END) &lt;= b.attrate THEN 1 ELSE 0 END) = 1
AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.midcutrfd ELSE d.midcut END) &lt;= a.ex0lectpoint THEN 1 ELSE 0 END) = 1 AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.finalcutrfd ELSE d.finalcut END) &lt;= a.ex1lectpoint THEN 1 ELSE 0 END) = 1
AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.subjectcutrfd ELSE d.subjectcut END) &lt;= a.sd0lectpoint THEN 1 ELSE 0 END) = 1 AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.discusscutrfd ELSE d.discusscut END) &lt;= a.sd1lectpoint THEN 1 ELSE 0 END) = 1
AND (CASE WHEN (CASE WHEN b.isrebate = 1 THEN d.cutrfd ELSE d.cut END) &lt;= ((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,sum(at0cnt) at0cnt,sum(at0lectcnt) at0lectcnt
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,0 at0cnt,0 at0lectcnt
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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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
,a.ex0cnt,a.ex0lectcnt,a.ex0lectpoint,a.ex1cnt,a.ex1lectcnt,a.ex1lectpoint,a.sd0cnt
,a.sd0lectcnt,a.sd0lectpoint,a.sd1cnt,a.sd1lectcnt,a.sd1lectpoint,a.rs0cnt,a.rs0lectcnt,a.rs0lectpoint,a.at0cnt,a.at0lectcnt
FROM (
SELECT a.lectno
,0 ex0cnt,0 ex0lectcnt,0 ex0lectpoint,count(b.exno) ex1cnt,count(c.lectno) ex1lectcnt,avg(ifnull(c.tpoint, 0) / b.tpoint * 100) ex1lectpoint,0 sd0cnt
,0 sd0lectcnt,0 sd0lectpoint,0 sd1cnt,0 sd1lectcnt,0 sd1lectpoint,0 rs0cnt,0 rs0lectcnt,0 rs0lectpoint,0 at0cnt,0 at0lectcnt
,row_number() OVER (PARTITION BY a.lectno ORDER BY (c.estart IS NOT NULL) DESC) rn
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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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,b.exno
) a
WHERE a.rn = 1
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,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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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,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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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,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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 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
UNION ALL
SELECT a.lectno
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,count(b.cmino),count(c.lectno)
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 AND b.lectno = #lectno#
INNER JOIN users c ON c.userno = b.userno AND c.STATUS &lt; 99
WHERE a.ismaster = 0 AND a.isdel = 0
) a
LEFT OUTER JOIN cminning b ON b.cmno = a.cmno AND b.isonline = 0 AND b.isscd = 1
LEFT OUTER JOIN lectinning c ON c.cmino = b.cmino AND c.lectno = a.lectno AND c.istatus = 2
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
) a
WHERE a.lectno = #lectno#
</select>
</statements>
</sqlMap>

View File

@ -1125,80 +1125,85 @@
order by a.rno
</select>
<select id="lect.lectexes.all" parameterClass="hashtable" resultClass="lectex">
select a.*
select *
from (
select a.lectno,a.userno,a.cmno,a.isrebate
,p.payoktime,a.sdate,a.edate
,b.exno,b.exname,b.extype <!--#xodus 수정완료 성적처리관련 컬럼 추가-->
,b2.cshape,b2.cname
,c.estart,c.eend,c.eip,c.tpoint,c.recount,c.entercount,c.cblock,c.isbyadmin
,d.username,d.userid
,e.asname
,f.cmisno,f.estart lestart,f.eend leend,f.sseq
,g.cname studyplacename
,a.iscomplete
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">d.username</isNull>) rno
,count(a.cdt) over() pagetotalcount
,cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) as mobile
from lect a
inner join cmex b on b.isdel=0 and b.cmno = a.cmno
inner join cm b2 on b2.cmno = b.cmno
inner join pay p on p.payno = a.payno
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
left outer join cminningscd f on f.cmisno = a.cmisno
left outer join comcode g on g.ccode = f.studyplace and g.isuse =1
select a.*
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.username</isNull>) rno
,count(a.lectno) OVER () pagetotalcount
from (
select a.lectno,a.userno,a.cmno,a.isrebate
,p.payoktime,a.sdate,a.edate
,b.exno,b.exname,b.extype <!--#xodus 수정완료 성적처리관련 컬럼 추가-->
,b2.cshape,b2.cname
,c.estart,c.eend,c.eip,c.tpoint,c.recount,c.entercount,c.cblock,c.isbyadmin
,d.username,d.userid
,e.asname
,f.cmisno,f.estart lestart,f.eend leend,f.sseq
,g.cname studyplacename
,a.iscomplete
,row_number() OVER (PARTITION BY a.lectno ORDER BY (c.estart IS NOT NULL) DESC) rn
,cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) as mobile
from lect a
inner join cmex b on b.isdel=0 and b.cmno = a.cmno
inner join cm b2 on b2.cmno = b.cmno
inner join pay p on p.payno = a.payno
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
left outer join cminningscd f on f.cmisno = a.cmisno
left outer join comcode g on g.ccode = f.studyplace and g.isuse =1
left outer join cmev ce on b2.cmno=ce.cmno
left outer join lect l on a.lectno = l.lectno
left outer join cminningscd cis on l.cmisno = cis.cmisno
left outer join lectinning li on a.lectno = li.lectno and cis.cmino = li.cmino
left outer join cmev ce on b2.cmno=ce.cmno
left outer join lect l on a.lectno = l.lectno
left outer join cminningscd cis on l.cmisno = cis.cmisno
left outer join lectinning li on a.lectno = li.lectno and cis.cmino = li.cmino
where a.status = 1 and a.ischanged=0 and d.status &lt; 99
<isNotNull property="extype">and b.extype = #extype#</isNotNull>
<isNotNull property="cmno">and a.cmno = #cmno#</isNotNull>
<isNotNull property="isrebate">and a.isrebate=#isrebate#</isNotNull>
<isNotNull property="edate">and (date_format((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end),'%Y-%m-%d') = #edate#)</isNotNull>
<isNotNull property="edate1">and ((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end) >= #edate1#)</isNotNull>
<isNotNull property="edate2">and ((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end) &lt;= #edate2#)</isNotNull>
<isNotNull property="cshape">and b2.cshape = #cshape#</isNotNull>
<isNotEmpty property="cname">and b2.cname like concat('%',#cname#,'%')</isNotEmpty>
<isNotEmpty property="cnamestr">and b2.cname like concat('%',#cname#,'%')</isNotEmpty>
<isNotNull property="iscomplete">and ifnull(a.iscomplete,0) = #iscomplete#</isNotNull>
<isNotNull property="studyplace">and f.studyplace = #studyplace#</isNotNull>
<isNotEmpty property="usernamestr">and d.username like concat('%',#usernamestr#,'%')</isNotEmpty>
<isNotEmpty property="useridstr">and d.userid like concat('%',#useridstr#,'%')</isNotEmpty>
<isNotEmpty property="searchtext">
<isEqual property="searchtype" compareValue="usernamestr">and d.username like concat('%',#usernamestr#,'%')</isEqual>
<isEqual property="searchtype" compareValue="useridstr">and d.userid like concat('%',#useridstr#,'%')</isEqual>
</isNotEmpty>
<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>
<isNotEmpty property="sdateall">and (case when b2.cshape = 0 and a.isrebate = 0 then p.payoktime else a.sdate end) &gt;= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmpty property="edateall">and (case when b2.cshape = 2 then f.eend else a.edate end) &lt;= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotEmpty property="asname">and e.asname like concat('%',#asname#,'%')</isNotEmpty>
<isNotNull property="mobile">and (cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) like concat('%',#mobile#,'%'))</isNotNull>
<isNotNull property="attendance" >
<!--해당없음-->
<isEqual property="attendance" compareValue="1" prepend="and"> ifnull(ce.isoffabs,0) = 0</isEqual>
<!--대상자(미입력/출석/결석)-->
<isEqual property="attendance" compareValue="2" prepend="and"> ifnull(ce.isoffabs,0) = 1</isEqual>
<!--미입력-->
<isEqual property="attendance" compareValue="3" prepend="and">ifnull(ce.isoffabs,0) = 1 and li.istatus is null </isEqual>
<!--출석-->
<isEqual property="attendance" compareValue="4" prepend="and">ifnull(ce.isoffabs,0) = 1 and ifnull(li.istatus,-1) = 2</isEqual>
<!--결석-->
<isEqual property="attendance" compareValue="5" prepend="and">ifnull(ce.isoffabs,0) = 1 and ifnull(li.istatus,-1) = 0</isEqual>
</isNotNull>
<isNotNull property="isbyadmin">
<isEqual property="isbyadmin" compareValue="-1" prepend="and">(c.isbyadmin = 0 or c.isbyadmin is null) and c.estart is null</isEqual>
<isEqual property="isbyadmin" compareValue="0" prepend="and">c.isbyadmin = 0 and c.estart is not null</isEqual>
<isEqual property="isbyadmin" compareValue="1" prepend="and">c.isbyadmin = 1</isEqual>
</isNotNull>
where a.status = 1 and a.ischanged=0 and d.status &lt; 99
<isNotNull property="extype">and b.extype = #extype#</isNotNull>
<isNotNull property="cmno">and a.cmno = #cmno#</isNotNull>
<isNotNull property="isrebate">and a.isrebate=#isrebate#</isNotNull>
<isNotNull property="edate">and (date_format((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end),'%Y-%m-%d') = #edate#)</isNotNull>
<isNotNull property="edate1">and ((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end) >= #edate1#)</isNotNull>
<isNotNull property="edate2">and ((case when b2.cshape = 2 and f.eend is not null then f.eend else a.edate end) &lt;= #edate2#)</isNotNull>
<isNotNull property="cshape">and b2.cshape = #cshape#</isNotNull>
<isNotEmpty property="cname">and b2.cname like concat('%',#cname#,'%')</isNotEmpty>
<isNotEmpty property="cnamestr">and b2.cname like concat('%',#cname#,'%')</isNotEmpty>
<isNotNull property="iscomplete">and ifnull(a.iscomplete,0) = #iscomplete#</isNotNull>
<isNotNull property="studyplace">and f.studyplace = #studyplace#</isNotNull>
<isNotEmpty property="usernamestr">and d.username like concat('%',#usernamestr#,'%')</isNotEmpty>
<isNotEmpty property="useridstr">and d.userid like concat('%',#useridstr#,'%')</isNotEmpty>
<isNotEmpty property="searchtext">
<isEqual property="searchtype" compareValue="usernamestr">and d.username like concat('%',#usernamestr#,'%')</isEqual>
<isEqual property="searchtype" compareValue="useridstr">and d.userid like concat('%',#useridstr#,'%')</isEqual>
</isNotEmpty>
<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>
<isNotEmpty property="sdateall">and (case when b2.cshape = 0 and a.isrebate = 0 then p.payoktime else a.sdate end) &gt;= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmpty property="edateall">and (case when b2.cshape = 2 then f.eend else a.edate end) &lt;= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotEmpty property="asname">and e.asname like concat('%',#asname#,'%')</isNotEmpty>
<isNotNull property="mobile">and (cast(AES_DECRYPT(UNHEX(d.mobile), 'np123@!' ) as char) like concat('%',#mobile#,'%'))</isNotNull>
<isNotNull property="attendance" >
<!--해당없음-->
<isEqual property="attendance" compareValue="1" prepend="and"> ifnull(ce.isoffabs,0) = 0</isEqual>
<!--대상자(미입력/출석/결석)-->
<isEqual property="attendance" compareValue="2" prepend="and"> ifnull(ce.isoffabs,0) = 1</isEqual>
<!--미입력-->
<isEqual property="attendance" compareValue="3" prepend="and">ifnull(ce.isoffabs,0) = 1 and li.istatus is null </isEqual>
<!--출석-->
<isEqual property="attendance" compareValue="4" prepend="and">ifnull(ce.isoffabs,0) = 1 and ifnull(li.istatus,-1) = 2</isEqual>
<!--결석-->
<isEqual property="attendance" compareValue="5" prepend="and">ifnull(ce.isoffabs,0) = 1 and ifnull(li.istatus,-1) = 0</isEqual>
</isNotNull>
<isNotNull property="isbyadmin">
<isEqual property="isbyadmin" compareValue="-1" prepend="and">(c.isbyadmin = 0 or c.isbyadmin is null) and c.estart is null</isEqual>
<isEqual property="isbyadmin" compareValue="0" prepend="and">c.isbyadmin = 0 and c.estart is not null</isEqual>
<isEqual property="isbyadmin" compareValue="1" prepend="and">c.isbyadmin = 1</isEqual>
</isNotNull>
) a
WHERE a.rn = 1
) a
<include refid="sql.pagedynamic"></include>
order by a.rno

Binary file not shown.

Binary file not shown.

View File

@ -68,13 +68,19 @@
@{
string trainingDateText = d.intval6 != 16 ? string.Format("/ 집체교육 참석일 ({0}) 전 까지", d.time.ToShortDateString()) : "";
//string trainingDateText = d.intval6 != 16 ? string.Format("/ 집체교육 참석일 ({0}) 전 까지", d.time.ToShortDateString()) : "";
string trainingDateText = "";
if (d.intval6 != 16 && d.intval6 != 14) {
trainingDateText = string.Format("/ 집체교육 참석일 ({0}) 전 까지", d.time.ToShortDateString());
} else {
trainingDateText = "";
}
}
@if (d.dtype == 1)
{ // 최종평가
if (d.intval6 == 16 || (d.time2 < Convert.ToDateTime("2024-08-19")))
if ((d.intval6 == 16 || d.intval6 == 14) || (d.time2 < Convert.ToDateTime("2024-08-19")))
{
<p>참여조건 : 진도율 @(d.intval2)% 이상 @trainingDateText</p>
}
@ -140,7 +146,7 @@
</td>
}
} else {
if ((currentProgresRate >= d.intval2) && IsDateInRange(d.time3, d.time4)) {
if ((currentProgresRate >= d.intval2) && IsDateInRange(d.time3, d.time4) && (ViewBag.exCheck || (d.intval6 == 16 || d.intval6 == 14))) {
<td>
<input type="hidden" name="cmEcondition" value="@d.intval2" />
@*<input type="hidden" name="lectSDate" value="@d.time2" />

Binary file not shown.

Binary file not shown.

View File

@ -3,3 +3,4 @@ D:\Project\git\git_YNICTE\Model\bin\Debug\NP.Model.pdb
D:\Project\git\git_YNICTE\Model\obj\Debug\Model.csproj.CoreCompileInputs.cache
D:\Project\git\git_YNICTE\Model\obj\Debug\NP.Model.dll
D:\Project\git\git_YNICTE\Model\obj\Debug\NP.Model.pdb
D:\Project\git\git_YNICTE\Model\obj\Debug\Model.csproj.AssemblyReference.cache

Binary file not shown.

Binary file not shown.