신청중인 과정 정렬 기준 재정의

1. 상시가 아닐경우 : 신청기간 시작일~신청기간 종료일
2. 상시일 경우 : 신청일(입금전 신청일)~출결이력이 있을 경우
3. 정렬 순서
1) 미입금
2) 신청기간 종료일
3) 상시
This commit is contained in:
lch 2021-06-29 04:05:54 +00:00
parent b33191b56f
commit 3f97e6a788
2 changed files with 13 additions and 17 deletions

View File

@ -1105,26 +1105,19 @@
,l.lectno longval,a.payno longval2 ,l.lectno longval,a.payno longval2
,c.cname strval,null strval2,null strval3 ,c.cname strval,null strval2,null strval3
,c.rstime time,c.retime time2 ,c.rstime time,c.retime time2
,row_number() over(order by c.retime) rno ,case when b.pstatus = 1 then 99 else b.pstatus end as sortpstatus
,case when c.retime = '2099-12-31 23:59:59' then l.cdt else c.retime end as sortretime
,row_number() over(order by sortpstatus, sortretime, b.payno,a.pino) rno
from payitem a 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 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 &lt; <include refid="sql.now"></include> and c.retime &gt; <include refid="sql.now"></include> inner join cm c on c.cmno=a.itemno and c.rstime &lt; <include refid="sql.now"></include> and c.retime &gt; <include refid="sql.now"></include>
inner join lect l on l.cmno=c.cmno and (l.status &lt; 5 or l.status = 6) and l.ischanged=0 and l.userno=b.userno inner join lect l on l.cmno=c.cmno and (l.status &lt; 5 or l.status = 6) and l.ischanged=0 and l.userno=b.userno
inner join term d on d.tmno=c.tmno inner join term d on d.tmno=c.tmno
left outer join ( left outer join payrfd e on e.payno=a.payno and e.payno=a.payno and e.rstatus=0
select l.lectno where a.ptype in (0,1,4) and a.userno=#userno# and a.pstatus in (1,21,22,51,55) and a.rstatus=0
,count(li.cmino) cnt and 1 = case when c.retime = '2099-12-31 23:59:59' and l.stime is not null then 0 else 1 end
from payitem a order by sortpstatus, sortretime, b.payno,a.pino
inner join pay b on b.payno= a.payno and b.pstatus in (1,21,22,51,55) and b.rstatus &lt; 2 limit 3
inner join cm c on c.cmno = a.itemno and c.rstime &lt; <include refid="sql.now"></include> and c.retime &gt; <include refid="sql.now"></include>
inner join lect l on l.cmno = c.cmno and (l.status &lt; 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
left outer join payrfd e on e.payno=a.payno and e.payno=a.payno and e.rstatus=0
where a.ptype in (0,1,4) and a.userno=#userno# and a.pstatus in (1,21,22,51,55) and a.rstatus=0 and li.cnt = 0
order by rno
) a ) a
union all union all
select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8 select a.dtype,a.intval,a.intval2,a.intval3,a.intval4,a.intval5,a.intval6,a.intval7,a.intval8

View File

@ -542,6 +542,8 @@
,cmis.estart cmiestart,cmis.eend cmieend ,cmis.estart cmiestart,cmis.eend cmieend
,case when lect.sdate is null then c.sstime else lect.sdate end as sdate ,case when lect.sdate is null then c.sstime else lect.sdate end as sdate
,case when lect.edate is null then c.setime else lect.edate end as edate ,case when lect.edate is null then c.setime else lect.edate end as edate
,case when b.pstatus = 1 then 99 else b.pstatus end as sortpstatus
,case when c.retime = '2099-12-31 23:59:59' then lect.cdt else c.retime end as sortretime
from pay a from pay a
inner join payitem b on b.payno=a.payno and b.ptype in (0,1,4) and b.pstatus in (1,21,22,51,55) inner join payitem b on b.payno=a.payno and b.ptype in (0,1,4) and b.pstatus in (1,21,22,51,55)
inner join cm c on c.cmno=b.itemno and c.rstime &lt; now() and c.retime &gt; now() inner join cm c on c.cmno=b.itemno and c.rstime &lt; now() and c.retime &gt; now()
@ -555,6 +557,7 @@
left outer join lect lect on lect.pino=b.pino and lect.ischanged=0 left outer join lect lect on lect.pino=b.pino and lect.ischanged=0
left outer join cminningscd cmis on cmis.cmisno=lect.cmisno left outer join cminningscd cmis on cmis.cmisno=lect.cmisno
where a.userno=#userno# and a.pstatus in (1,21,22,51,55) and lect.status &lt; 8 where a.userno=#userno# and a.pstatus in (1,21,22,51,55) and lect.status &lt; 8
and 1 = case when c.retime = '2099-12-31 23:59:59' and lect.stime is not null then 0 else 1 end
group by a.payno,a.isgroup,a.pstatus,a.rstatus group by a.payno,a.isgroup,a.pstatus,a.rstatus
,b.pino,b.ptype,b.pcno,b.itemno,b.userno,b.pstatus,b.rstatus,b.isrebate ,b.pino,b.ptype,b.pcno,b.itemno,b.userno,b.pstatus,b.rstatus,b.isrebate
,c.cname,c.classno,c.rstime,c.retime,c.sstime,c.setime,c.cshape ,c.cname,c.classno,c.rstime,c.retime,c.sstime,c.setime,c.cshape
@ -566,7 +569,7 @@
,u.email ,u.email
,lect.cmisno ,lect.cmisno
,cmis.estart,cmis.eend ,cmis.estart,cmis.eend
order by c.retime,a.payno,b.pino order by sortpstatus, sortretime, a.payno,b.pino
</select> </select>
<update id="pay.paycancel" parameterClass="hashtable"> <update id="pay.paycancel" parameterClass="hashtable">
update pay set <include refid="sql.up"></include> update pay set <include refid="sql.up"></include>