YNICTE/Dao/MyBatis/Maps/CM.xml

2213 lines
126 KiB
XML
Raw Normal View History

2020-10-12 14:39:23 +09:00
<?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>
<typeAlias alias="term" type="NP.Model.Term, NP.Model" />
<typeAlias alias="cg" type="NP.Model.CG, NP.Model" />
<typeAlias alias="cm" type="NP.Model.CM, NP.Model" />
<typeAlias alias="cminning" type="NP.Model.CMInning, NP.Model" />
2020-10-23 17:42:52 +09:00
<typeAlias alias="cminningscd" type="NP.Model.CMInningscd, NP.Model" />
2020-10-12 14:39:23 +09:00
<typeAlias alias="cmpr" type="NP.Model.CMPR, NP.Model" />
<typeAlias alias="book" type="NP.Model.Book, NP.Model" />
<typeAlias alias="ct" type="NP.Model.CT, NP.Model" />
<typeAlias alias="ctp" type="NP.Model.CTPage, NP.Model" />
<typeAlias alias="cmev" type="NP.Model.CMEV, NP.Model" />
<typeAlias alias="est" type="NP.Model.EST, NP.Model" />
<typeAlias alias="cmex" type="NP.Model.CMEX, NP.Model" />
<typeAlias alias="cmsd" type="NP.Model.CMSD, NP.Model" />
<typeAlias alias="cmrs" type="NP.Model.CMRS, NP.Model" />
<typeAlias alias="cmmenu" type="NP.Model.CMMenu, NP.Model" />
<typeAlias alias="cmexq" type="NP.Model.CMEXQ, NP.Model" />
<typeAlias alias="cmexlayer" type="NP.Model.CMEXLayer, NP.Model" />
<typeAlias alias="question" type="NP.Model.Question, NP.Model" />
<typeAlias alias="questionitem" type="NP.Model.QuestionItem, NP.Model" />
<typeAlias alias="rsc" type="NP.Model.RSC, NP.Model" />
<typeAlias alias="rscq" type="NP.Model.RSCQ, NP.Model" />
2020-11-12 16:28:05 +09:00
<typeAlias alias="pplog" type="NP.Model.PPLog, NP.Model" />
2020-10-12 14:39:23 +09:00
</alias>
<cacheModels>
<cacheModel id="cmCache" implementation="LRU" >
<flushInterval hours="1" />
<property name="CacheSize" value="1000" />
</cacheModel>
</cacheModels>
<resultMaps></resultMaps>
<statements>
<select id="cm.terms" parameterClass="hashtable" resultClass="term">
select a.*
from (
select a.tmno,a.tyear,a.tseq,a.rstime,a.retime,a.sstime,a.setime,a.gstime,a.getime
,a.tmno value,a.tseq text
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.tyear desc,a.tseq desc</isNull>) rno
,count(a.tmno) over() pagetotalcount
from term a
<dynamic prepend="where">
<isNotNull property="tyear" prepend="and">a.tyear=#tyear#</isNotNull>
<isNotNull property="tseq" prepend="and">a.tseq=#tseq#</isNotNull>
<isNotNull property="tmnonot" prepend="and">a.tmno&lt;&gt;#tmnonot#</isNotNull>
<isNotNull property="tmno" prepend="and">a.tmno=#tmno#</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<update id="cm.term.in" parameterClass="hashtable">
insert into term (tyear,tseq,rstime,retime,sstime,setime,gstime,getime,<include refid="sql.inc"></include>)
values (#tyear#,#tseq#,#rstime#,#retime#,#sstime#,#setime#,#gstime#,#getime#,<include refid="sql.inv"></include>)
</update>
<update id="cm.term.up" parameterClass="hashtable">
update term set <include refid="sql.up"></include>,tyear =#tyear#,tseq =#tseq#,rstime=#rstime#,retime=#retime#,sstime=#sstime#,setime=#setime#,gstime=#gstime#,getime=#getime# where tmno=#tmno#
</update>
<select id="cm.myterm" parameterClass="int" resultClass="term">
select distinct c.tmno,c.tyear,c.tseq
from cmprof a
inner join cm b on b.cmno=a.cmno and b.ismaster=0 and b.isdel=0
inner join term c on c.tmno=b.tmno
where a.userno=#userno#
order by c.tyear desc,c.tseq
</select>
<select id="cm.term.ys" parameterClass="hashtable" resultClass="term">
select distinct tmno,tyear,tseq
from term
order by tyear desc,tseq
</select>
<select id="cm.mycms" parameterClass="hashtable" resultClass="cm">
select b.cmno,b.cname,b.classno,b.cmno value,b.cname text
from cmprof a
inner join cm b on b.cmno=a.cmno and b.ismaster=0 and b.isdel=0 <isNotNull property="tmno">and b.tmno=#tmno#</isNotNull>
where a.userno=#userno#
order by b.cname, b.classno
</select>
<select id="cm.cgs" parameterClass="hashtable" resultClass="cg">
select a.*
from (
select a.cgno,a.pcgno,a.cgname,a.cgcode,a.isuse,a.iscover,a.isdel,a.cdt
,b.cgname pcgname
,a.cgno value,a.cgname text
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.cdt desc</isNull>) rno
,count(a.cdt) over() pagetotalcount
from cg a
left outer join cg b on b.cgno=a.pcgno
<dynamic prepend="where">
<isNotNull property="isdel" prepend="and">a.isdel=#isdel#</isNotNull>
<isNotNull property="cgnamecode" prepend="and">a.cgname like concat('%',#cgnamecode#,'%') or a.cgcode like concat('%',#cgnamecode#,'%')</isNotNull>
<isNotNull property="cgcode" prepend="and">a.cgcode=#cgcode#</isNotNull>
<isNotNull property="pcgcodeall" prepend="and">((a.pcgno is null and a.cgcode=#pcgcodeall#) or (a.pcgno is not null and b.cgcode=#pcgcodeall#))</isNotNull>
<isNotNull property="cgnonot" prepend="and">a.cgno&lt;&gt;#cgnonot#</isNotNull>
<isNotNull property="cgno" prepend="and">a.cgno=#cgno#</isNotNull>
<isNotNull property="isuse" prepend="and">a.isuse=#isuse#</isNotNull>
<isNotNull property="istop" prepend="and">a.pcgno is null</isNotNull>
<isNotNull property="issecond" prepend="and">a.pcgno is not null</isNotNull>
<isNotNull property="pcgno" prepend="and">a.pcgno=#pcgno#</isNotNull>
<isNotNull property="includepcgno" prepend="and">((a.pcgno=#includepcgno# or a.cgno=#includecgno#) or (a.isuse=1 and a.isdel=0 and (a.pcgno is null or a.pcgno=#includepcgno#)))</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<update id="cm.cg.in" parameterClass="hashtable">
insert into cg (pcgno,cgname,cgcode,isuse,iscover,isdel,<include refid="sql.inc"></include>)
values (#pcgno#,#cgname#,#cgcode#,#isuse#,#iscover#,0,<include refid="sql.inv"></include>)
</update>
<update id="cm.cg.up" parameterClass="hashtable">
update cg set <include refid="sql.up"></include>
<isNull property="saveflag">,pcgno=#pcgno#,cgname=#cgname#,cgcode=#cgcode#,isuse=#isuse#,iscover=#iscover#</isNull>
<isNotNull property="saveflag">,isdel=1,isuse=0</isNotNull>
where cgno=#cgno#
</update>
<select id="cm.cms" parameterClass="hashtable" resultClass="cm">
select a.*
from (
select a.cmno,case when a.ismaster=2 then a.cmno else 0 end pcno,a.ismaster,a.cgno,a.pcmno,a.cname,a.kname
,a.tmno,a.classno,a.rstime,a.retime,a.sstime,a.setime,a.gstime,a.getime
2021-01-05 14:00:46 +09:00
,a.cshape,a.infee,a.outfee,a.quota,a.accommofee
2020-10-12 14:39:23 +09:00
,a.introhtml,a.targethtml,a.goalhtml,a.contenthtml
,a.studytime,a.studyplace,a.certcc,a.certgradecc,a.jobcc,a.jobpositiongrade,a.difficulty,a.isrefund,a.isuse,a.isseq,a.fgnocm,a.studydays,a.isaccommodation
,a.typeman,a.typeedu,a.typegrade,a.typejob,a.iscertificate, a.typejobitem
2020-10-12 14:39:23 +09:00
,b.pcgno,b.cgcode cgcode
,b.cgname,c.cgname pcgname
,c.cgcode pcgcode
,t.tyear,t.tseq
,d.cname pcname
2020-11-05 17:02:05 +09:00
,e.ccode,e.cname studyplacename
2021-01-19 15:57:17 +09:00
,(select count(l.lectno) cnt from lect l where l.cmno = a.cmno and l.status =1 and l.ischanged=0) lectcnt
,a.ischkatt,a.daylectinninglimit
,case when date_format(a.retime,'%Y%m%d') = '20991231' then 1 else 0 end isalldays
2020-10-12 14:39:23 +09:00
,a.cdt,a.udt
,a.cmno value,a.cname text
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.udt desc</isNull>) rno
,count(a.cdt) over() pagetotalcount
from cm a
inner join cg b on b.cgno=a.cgno
inner join cg c on c.cgno=b.pcgno
left outer join term t on t.tmno=a.tmno
left outer join cm d on a.ismaster=0 and d.cmno=a.pcmno
2020-11-05 17:02:05 +09:00
left outer join comcode e on a.studyplace = e.ccode
2020-10-12 14:39:23 +09:00
where a.isdel=0
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
<isNotNull property="notcmno">and a.cmno &lt;&gt; #notcmno#</isNotNull>
<isNotNull property="notcmnos">and a.cmno not in ($notcmnos$)</isNotNull>
<isNotNull property="pcgno">and b.pcgno=#pcgno#</isNotNull>
<isNotNull property="cgno">and a.cgno=#cgno#</isNotNull>
<isNotNull property="cshape">and a.cshape=#cshape#</isNotNull>
2020-10-21 17:23:55 +09:00
<isNotNull property="typeman">and a.typeman like concat('%',#typeman#,'%')</isNotNull>
<isNotNull property="typeedu">and a.typeedu like concat('%',#typeedu#,'%')</isNotNull>
<isNotNull property="typegrade">and a.typegrade like concat('%',#typegrade#,'%')</isNotNull>
<isNotNull property="typejob">and a.typejob like concat('%',#typejob#,'%')</isNotNull>
<isNotNull property="typejobitem">and a.typejobitem like concat('%',#typejobitem#,'%')</isNotNull>
<isNotNull property="studyplace">and a.studyplace=#studyplace#</isNotNull>
2020-10-12 14:39:23 +09:00
<isNotNull property="cshapes">and a.cshape in ($cshapes$)</isNotNull>
<isNotEmpty property="cname">and a.cname like concat('%',#cname#,'%')</isNotEmpty>
<isNotNull property="ismaster">and a.ismaster=#ismaster#</isNotNull>
<isNotNull property="ismaster02">and a.ismaster in (0,2)</isNotNull>
2021-01-19 15:57:17 +09:00
<isNotNull property="isuse">and a.isuse=#isuse#</isNotNull>
2020-10-12 14:39:23 +09:00
<isNotNull property="tyear" prepend="and">t.tyear=#tyear#</isNotNull>
<isNotNull property="tseq" prepend="and">t.tseq=#tseq#</isNotNull>
<isNotNull property="tmno" prepend="and">a.tmno=#tmno#</isNotNull>
<isNotNull property="iscurrent" prepend="and">a.setime &gt; now()</isNotNull>
2020-11-02 10:27:11 +09:00
<isNotNull property="sstime" prepend="and">a.sstime &gt;= #sstime#</isNotNull>
<isNotNull property="setime" prepend="and">a.setime &lt;= #setime#</isNotNull>
2020-11-04 17:04:10 +09:00
<isNotNull property="cgcode">and b.cgcode=#cgcode#</isNotNull>
2021-01-19 15:57:17 +09:00
<isNotNull property="iscurrent">and (date_format(a.retime,'%Y%m%d') != '20991231' and a.rstime &lt; now() and a.getime &gt; now()) or date_format(a.retime,'%Y%m%d') = '20991231' and a.isuse=#isuse#</isNotNull>
2020-10-12 14:39:23 +09:00
) a
<include refid="sql.pagedynamic"></include>
2021-01-22 10:59:21 +09:00
order by a.rno
2020-10-12 14:39:23 +09:00
</select>
2020-10-12 14:39:23 +09:00
<select id="cm.cm" parameterClass="hashtable" resultClass="cm">
select a.cmno,a.cshape,a.cname,a.classno,a.rstime,a.retime,a.sstime,a.setime,a.certcc,a.cgno,a.quota,a.studydays,a.isaccommodation,a.daylectinninglimit
2020-10-12 14:39:23 +09:00
,b.tyear,b.tseq,a.isrefund
,a3.cgcode pcgcode
2020-11-24 13:19:48 +09:00
,e.countlect,e.countstandby
2020-10-12 14:39:23 +09:00
<isNotNull property="htmlcolumns">$htmlcolumns$</isNotNull>
from cm a
inner join cg a2 on a2.cgno=a.cgno
inner join cg a3 on a3.cgno=a2.pcgno
inner join term b on b.tmno=a.tmno
2020-10-13 16:10:18 +09:00
left outer join comcode cc on cc.ccode=a.studyplace
2020-11-24 13:19:48 +09:00
left outer join (
select l.cmno
,sum(case when l.status &lt; 3 then 1 else 0 end) countlect
,sum(case when ifnull(l.isready,0) = 1 and l.status=3 then 1 else 0 end) countstandby
from lect l
inner join users u on u.userno = l.userno
where l.cmno = #cmno# and l.ischanged=0
group by l.cmno
) e on e.cmno = a.cmno
2020-10-12 14:39:23 +09:00
where a.cmno=#cmno#
</select>
<!--비공개인 강좌여도 수강생등록 가능-->
<select id="cm.cmsbycmnos" parameterClass="hashtable" resultClass="cm">
select a.cmno,a.cname
from cm a
where <!--a.isuse=1 and--> a.isdel=0
<isNotNull property="cmnos">and a.cmno in ($cmnos$)</isNotNull>
<isNotNull property="ismaster">and a.ismaster=#ismaster#</isNotNull>
<isNotNull property="ismasters">and a.ismaster in ($ismasters$)</isNotNull>
</select>
<select id="cm.pcms" parameterClass="hashtable" resultClass="cm">
select a.pcno,a.cmno,a.dseq,a.orginfee,a.orgoutfee,a.drate,a.infee,a.outfee
,b.cname,b.classno,b.cshape
,t.tmno,t.tyear,t.tseq
from cmpc a
inner join cm b on b.cmno=a.cmno
inner join term t on t.tmno=b.tmno
<dynamic prepend="where">
<isNotNull property="pcnos" prepend="and">a.pcno in ($pcnos$)</isNotNull>
<isNotNull property="pcno" prepend="and">a.pcno = #pcno#</isNotNull>
</dynamic>
order by a.pcno, a.dseq
</select>
<select id="cm.count.cmlect" parameterClass="hashtable" resultClass="data">
select a.intval,count(a.status) intval2
from (
select a.cmno intval,case when u.status > 1 then null else u.status end status
from cm a
left outer join lect b on b.cmno=a.cmno and b.status &lt; 5
left outer join users u on u.userno = b.userno
<dynamic prepend="where">
<isNotNull property="cmnos" prepend="and">a.cmno in ($cmnos$)</isNotNull>
<isNotNull property="ischanged" prepend="and">b.ischanged = #ischanged#</isNotNull>
</dynamic>
) a
group by a.intval
</select>
<select id="cm.cm.checklect" parameterClass="string" resultClass="cm">
select distinct a.cmno
from lect a
where a.cmno in ($cmnos$)
</select>
<insert id="cm.cmin" parameterClass="cm">
insert into cm(ismaster,cgno,pcmno,cname,kname,tmno,classno,rstime,retime,sstime,setime,gstime,getime,cshape
2021-01-05 14:00:46 +09:00
,infee,outfee,accommofee,quota
2020-10-12 14:39:23 +09:00
,introhtml,targethtml,goalhtml,contenthtml,studyplace,studytime
,certcc,certgradecc,jobcc,jobpositiongrade,difficulty,isrefund,isuse,isdel,isseq,fgnocm,typeman,typeedu,typegrade,typejob,typejobitem,iscertificate,ischkatt,isaccommodation,daylectinninglimit,<include refid="sql.inc"></include>)
2020-10-12 14:39:23 +09:00
values (#ismaster#,#cgno#,#pcmno#,#cname#,#kname#,#tmno#,#classno#,#rstime#,#retime#,#sstime#,#setime#,#gstime#,#getime#,#cshape#
2021-01-05 14:00:46 +09:00
,#infee#,#outfee#,#accommofee#,#quota#
2020-10-12 14:39:23 +09:00
,#introhtml#,#targethtml#,#goalhtml#,#contenthtml#
,#studyplace#,#studytime#,#certcc#,#certgradecc#,#jobcc#,#jobpositiongrade#,#difficulty#,#isrefund#,#isuse#,0,#isseq#,#fgnocm#,#typeman#,#typeedu#,#typegrade#,#typejob#,#typejobitem#,#iscertificate#,#ischkatt#,#isaccommodation#,10,<include refid="sql.inv"></include>);
2020-10-12 14:39:23 +09:00
<selectKey type="post" property="cmno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.cmup" parameterClass="hashtable">
update cm set <include refid="sql.up"></include>
,cgno =#cgno#
,pcmno =#pcmno#
,cname =#cname#
,kname =#kname#
,rstime =#rstime#
,retime =#retime#
,sstime =#sstime#
,setime =#setime#
,gstime =#gstime#
,getime =#getime#
,cshape =#cshape#
,infee =#infee#
,outfee =#outfee#
,accommofee =#accommofee#
,quota =#quota#
,introhtml =#introhtml#
,targethtml =#targethtml#
,goalhtml =#goalhtml#
,contenthtml =#contenthtml#
,studyplace =#studyplace#
,studytime =#studytime#
,certcc =#certcc#
,certgradecc =#certgradecc#
,jobcc =#jobcc#
,jobpositiongrade =#jobpositiongrade#
,difficulty =#difficulty#
,isrefund =#isrefund#
,isuse =#isuse#
,fgnocm =#fgnocm#
,typeman =#typeman#
,typeedu =#typeedu#
,typegrade =#typegrade#
,typejob =#typejob#
,typejobitem =#typejobitem#
,iscertificate =#iscertificate#
,ischkatt =#ischkatt#
,studydays =#studydays#
,isaccommodation =#isaccommodation#
<!--,daylectinninglimit =#daylectinninglimit#-->
2020-10-21 17:23:55 +09:00
where cmno=#cmno#
2020-10-12 14:39:23 +09:00
</update>
<update id="cm.data.delete" parameterClass="hashtable">
delete from cmprof where cmno=#cmno# <isNotNull property="usernos">and userno not in($usernos$)</isNotNull>;
delete from cmbook where cmno=#cmno# <isNotNull property="bknos">and bkno not in($bknos$)</isNotNull>;
delete from cmrelay where cmno=#cmno# and ispre=1 <isNotNull property="rcmnospre">and rcmno not in($rcmnospre$)</isNotNull>;
delete from cmrelay where cmno=#cmno# and ispre=0 <isNotNull property="rcmnosnext">and rcmno not in($rcmnosnext$)</isNotNull>;
delete from cmncsd where cmno=#cmno# <isNotNull property="ndnos">and ndno not in($ndnos$)</isNotNull>;
</update>
<update id="cm.data.save" parameterClass="hashtable">
insert into cmprof (cmno,userno,pfee,<include refid="sql.inc"></include>)
select #cmno#,a.userno,0,<include refid="sql.inv"></include>
from users a
left outer join cmprof b on b.cmno=#cmno# and b.userno=a.userno
where a.userno in ($usernos$) and b.userno is null;
insert into cmbook (cmno,bkno,<include refid="sql.inc"></include>)
select #cmno#,a.bkno,<include refid="sql.inv"></include>
from book a
left outer join cmbook b on b.cmno=#cmno# and b.bkno=a.bkno
where a.bkno in ($bknos$) and b.bkno is null;
insert into cmrelay (cmno,rcmno,ispre,<include refid="sql.inc"></include>)
select #cmno#,a.cmno,1,<include refid="sql.inv"></include>
from cm a
left outer join cmrelay b on b.cmno=#cmno# and b.ispre=1 and b.rcmno=a.cmno
where a.cmno in ($rcmnospre$) and b.cmno is null;
insert into cmrelay (cmno,rcmno,ispre,<include refid="sql.inc"></include>)
select #cmno#,a.cmno,0,<include refid="sql.inv"></include>
from cm a
left outer join cmrelay b on b.cmno=#cmno# and b.ispre=0 and b.rcmno=a.cmno
where a.cmno in ($rcmnosnext$) and b.cmno is null;
insert into cmncsd (cmno,ndno,<include refid="sql.inc"></include>)
select #cmno#,a.ndno,<include refid="sql.inv"></include>
from ncsd a
left outer join cmncsd b on b.cmno=#cmno# and b.ndno=a.ndno
where a.ndno in ($ndnos$) and b.cmno is null
</update>
<update id="cm.cminning.profclear" parameterClass="int">
update cminning a
inner join (
select a.cmino
from cminning a
left outer join cmprof b on b.cmno=a.cmno and a.userno=b.userno
where a.cmno=#cmno# and b.userno is null
) b on b.cmino=a.cmino
set a.userno=null
where a.cmno=#cmno#
</update>
<update id="cm.del" parameterClass="int">
update cm a
left outer join (select count(a.rcmno) cnt from cmrelay a where a.rcmno=#cmno#) b on 1 = 1
left outer join (select count(a.pcmno) cnt from cm a where a.pcmno=#cmno# and a.isdel=0) c on 1 = 1
left outer join (select count(a.cmno) cnt from ct a where a.cmno=#cmno# and a.isdel=0) d on 1 = 1
left outer join (select count(a.lectno) cnt from lect a where a.cmno=#cmno# and a.status &lt; 5 and a.ischanged=0) e on 1 = 1
left outer join (select count(a.cmno) cnt from cmpc a where a.cmno=#cmno#) f on 1 = 1
set a.isdel=1,a.isuse=0,<include refid="sql.up"></include>
where <isNotNull property="cmno">a.cmno=#cmno#</isNotNull><isNotNull property="cmnos">a.cmno in ($cmnos$)</isNotNull> and b.cnt+c.cnt+d.cnt+e.cnt+f.cnt &lt; 1
</update>
<update id="cm.cminning.del" parameterClass="long">
delete from cminning where cmino = (
select a.cmino from (
select case when count(c.lectno) &lt; 1 then #cmino# else 0 end cmino
from (select 1 col1) a
left outer join cminning b on b.cmino=#cmino#
left outer join lect c on c.cmno=b.cmno) a
)
</update>
<update id="cm.cminning.del2" parameterClass="long">
delete from cminning where cmino = #cmino#
</update>
2020-10-23 17:42:52 +09:00
<update id="cm.cminning.del3" parameterClass="long">
delete from cminning where cmino = (
select a.cmino from (
2020-12-23 15:07:24 +09:00
select case when count(b.cmino) &lt; 1 then #cmino# else 0 end cmino
2020-10-23 17:42:52 +09:00
from (select 1 col1) a
left outer join cminningscd b on b.cmino=#cmino#) a
)
</update>
<update id="cm.cminningscd.del" parameterClass="long">
delete from cminningscd where cmisno = (
select a.cmisno from (
select case when count(c.lectno) &lt; 1 then #cmisno# else 0 end cmisno
from (select 1 col1) a
left outer join cminningscd b on b.cmisno=#cmisno#
left outer join lect c on c.cmisno=b.cmisno and c.status=1 and c.ischanged=0
) a
)
</update>
2020-10-12 14:39:23 +09:00
<update id="cm.cmseqsave" parameterClass="hashtable">
update cm set isseq=#isseq#,<include refid="sql.up"></include> where cmno=#cmno#
</update>
<select id="cm.cmdatas" parameterClass="int" resultClass="data">
select a.dtype,a.intval,a.intval2,a.intval3
,a.strval,a.strval2
from(
select 1 dtype
,a.userno intval,b.usertype intval2
,row_number() over (order by b.username desc) intval3
,b.username strval,null strval2
from cmprof a
inner join users b on b.userno=a.userno
where a.cmno=#cmno#
order by b.username desc
) a
union all
select 2
,b.bkno,0
,row_number() over (order by b.bkno) intval3
,b.bkname,null
from cmbook a
inner join book b on b.bkno=a.bkno
where a.cmno=#cmno#
union all
select 3 dtype
,b.cmno,a.ispre
,row_number() over (order by b.cmno) intval3
,b.cname,null
from cmrelay a
inner join cm b on b.cmno=a.rcmno
where a.cmno=#cmno#
union all
select 4
,b.ndno,0
,row_number() over (order by b.ndno) intval3
,b.dname,b.acode
from cmncsd a
inner join ncsd b on b.ndno=a.ndno
where a.cmno=#cmno#
order by dtype,intval3
</select>
<select id="cm.datacreatecmbycmmaster" parameterClass="int" resultClass="cm">
select a.cmno,a.cname,row_number() over(order by a.udt desc) rno
from cm a
where a.ismaster=1 and a.isdel=0 and a.cgno=#cgno#
order by rno
</select>
<select id="cm.cmprs" parameterClass="hashtable" resultClass="cmpr">
select a.cmno,a.pfee,a.userno,a.userno value
,c.tyear,c.tseq
,cg.cgname
,b.cname,b.classno,b.sstime,b.setime,b.isdel
,d.username,d.username text,d.introhtml
,e.fileurl
,count(a.cno) over() pagetotalcount
,row_number() over(order by d.username desc) rno
from cmprof a
inner join cm b on b.cmno=a.cmno <isNotNull property="ismaster"> and b.ismaster=#ismaster#</isNotNull> <isNotNull property="cmisdel">and b.isdel=0</isNotNull>
inner join cg cg on cg.cgno=b.cgno
left outer join term c on c.tmno=b.tmno
inner join users d on d.userno=a.userno <isNotNull property="usertype">and d.usertype=#usertype#</isNotNull>
left outer join fileinfo e on e.fgno=d.fgnoprofile and e.isdel=0
<dynamic prepend="where">
<isNotNull property="userno" prepend="and">a.userno=#userno#</isNotNull>
<isNotNull property="cmno" prepend="and">a.cmno=#cmno#</isNotNull>
</dynamic>
order by rno
</select>
<update id="cm.cmprpfee" parameterClass="cmpr">
update cmprof a
inner join (
<iterate property="CMPRs" open="" conjunction="union all" close=""> select #CMPRs[].cmno# cmno, #CMPRs[].pfee# pfee </iterate>
) b on b.cmno=a.cmno
set a.pfee=b.pfee,<include refid="sql.up"></include>
where a.userno=#userno#
</update>
<select id="cm.books" parameterClass="hashtable" resultClass="book">
select a.*
from (
select a.bkno,a.bkname,a.author,a.publisher,a.pubdate,a.fgnothumb,a.fgno,a.price,a.introhtml,a.contents,a.isuse,a.cdt,a.udt
,a.bkno value,a.bkname text
,b.fileurl
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.udt desc</isNull>) rno
,count(a.cdt) over() pagetotalcount
from book a
<isNull property="isdetail">left outer join fileinfo b on b.fgno=a.fgnothumb and b.isdel=0</isNull>
<isNotNull property="isdetail">left outer join fileinfo b on b.fgno=a.fgno and b.isdel=0</isNotNull>
<dynamic prepend="where">
<isNotNull property="bknamelike" prepend="and">a.bkname like concat('%',#bknamelike#,'%')</isNotNull>
<isNotNull property="isuse" prepend="and">a.isuse=#isuse#</isNotNull>
<isNotNull property="bkno" prepend="and">a.bkno=#bkno#</isNotNull>
<isNotNull property="bknos" prepend="and">a.bkno in ($bknos$)</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<update id="cm.bookin" parameterClass="hashtable">
insert into book(bkname,author,publisher,pubdate,fgnothumb,fgno,price,introhtml,contents,isuse,<include refid="sql.inc"></include>)
values (#bkname#,#author#,#publisher#,#pubdate#,#fgnothumb#,#fgno#,#price#,#introhtml#,#contents#,#isuse#,<include refid="sql.inv"></include>)
</update>
<update id="cm.bookup" parameterClass="hashtable">
update book set <include refid="sql.up"></include>
,bkname =#bkname#
,author =#author#
,publisher =#publisher#
,pubdate =#pubdate#
,fgnothumb =#fgnothumb#
,fgno =#fgno#
,price =#price#
,introhtml =#introhtml#
,contents =#contents#
,isuse =#isuse#
where bkno=#bkno#
</update>
<update id="cm.bookdel" parameterClass="hashtable">
delete from book
where not bkno in (
select distinct(a.bkno)
from cmbook a
) and bkno = #bkno#
</update>
<select id="cm.cminnings" parameterClass="hashtable" resultClass="cminning">
2021-11-03 15:19:08 +09:00
select distinct a.cmino,a.cmno,a2.cshape,a.week,a.iseq,a.isonline,a.ititle,a.icontent,a.idate,a.iday,a.ist,a.iet,a.ctno,a.istaste,a.sttime,a.atime,a.mstime,a.metime,a.fgnotf
,a.userno,a.fgno,a.fgnotf,a.fgnooff,a.scdtype,a.isscd,a.cdt,a.udt
2020-10-12 14:39:23 +09:00
,b.ctname,b.ccode,b.ctype,b.ismenu
,b2.srcp,b2.srcm
,c.username
,d.fileno,d.fileurl,d.orgname
,e.fileno fileno2,e.fileurl fileurl2,e.orgname orgname2
2021-11-03 15:19:08 +09:00
,g.fileno fileno3,g.fileurl fileulr3,g.orgname orgname3
2020-10-12 14:39:23 +09:00
from cminning a
2021-11-03 15:19:08 +09:00
inner join cm a2 on a2.cmno = a.cmno
2020-10-12 14:39:23 +09:00
left outer join ct b on b.ctno=a.ctno and b.isdel=0
left outer join ctpage b2 on b2.ctno=b.ctno and b2.pseq=1
left outer join users c on c.userno=a.userno and c.status = 1
left outer join fileinfo d on d.fgno=a.fgno and d.isdel=0
left outer join fileinfo e on e.fgno=a.fgnotf and e.isdel=0
2021-11-03 15:19:08 +09:00
left outer join fileinfo g on g.fgno=a.fgnooff and g.isdel=0
<isNotNull property="cmisno">
left outer join cminningscd f on f.cmino = a.cmino
</isNotNull>
2020-10-12 14:39:23 +09:00
<dynamic prepend="where">
<isNotNull property="cmno" prepend="and">a.cmno=#cmno#</isNotNull>
<isNotNull property="cmino" prepend="and">a.cmino=#cmino#</isNotNull>
2021-11-03 15:19:08 +09:00
<isNotNull property="cmisno" prepend="and">f.cmisno=#cmisno#</isNotNull>
2020-10-12 14:39:23 +09:00
<isNotNull property="isonline" prepend="and">a.isonline=#isonline#</isNotNull>
2021-11-03 15:19:08 +09:00
<isNotNull property="isscd" prepend="and">a.isscd=#isscd#</isNotNull>
2020-10-12 14:39:23 +09:00
</dynamic>
order by a.week,a.iseq
</select>
2020-10-23 17:42:52 +09:00
<select id="cm.cminningscds" parameterClass="hashtable" resultClass="cminningscd">
select a.*
from (
select a.cmisno,a.cmino,a.estart,a.eend,a.quota,a.cdt,a.udt,a.studyplace,a.sseq
,a.cmisno value,date_format(a.estart,'%Y-%m-%d') text, a.comment
,b.scdtype
,case when b.scdtype =1 then '온라인' else c.cname end studyplacename
,(select count(z.lectno) cnt from lect z where a.cmisno = z.cmisno and z.status =1 and z.ischanged=0) regmem
,(select count(z.lectno) cnt from lect z where a.cmisno = z.cmisno and z.status =2 and z.ischanged=0) zstring0
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.estart</isNull>) scdseq
2020-11-10 17:29:53 +09:00
,count(a.cmisno) over() totalnum
2020-10-23 17:42:52 +09:00
from cminningscd a
2021-11-03 15:19:08 +09:00
inner join cminning b on b.cmino = a.cmino
inner join cm d on d.cmno = b.cmno
left outer join comcode c on c.ccode = a.studyplace
2020-10-23 17:42:52 +09:00
<dynamic prepend="where">
<isNotNull property="cmino" prepend="and">a.cmino=#cmino#</isNotNull>
<isNotNull property="cmisno" prepend="and">a.cmisno=#cmisno#</isNotNull>
2021-11-03 15:19:08 +09:00
<isNotNull property="cmno" prepend="and">d.cmno=#cmno#</isNotNull>
2020-10-23 17:42:52 +09:00
</dynamic>
) a
order by a.scdseq
</select>
2020-10-12 14:39:23 +09:00
<update id="cm.cminning.batch" parameterClass="cminning">
delete from cminning where cmno=#cmno#;
insert into cminning (cmno,week,iseq,isonline,ititle,icontent,idate,iday,ist,iet,ctno,istaste,sttime,atime,mstime,metime,userno,<include refid="sql.inc"></include>)
<iterate property="Ds" open="" conjunction="union all" close="">
select #cmno#,#Ds[].week#,#Ds[].iseq#,#Ds[].isonline#,#Ds[].ititle#,#Ds[].icontent#,#Ds[].idate#,#Ds[].iday#,#Ds[].ist#,#Ds[].iet#,#Ds[].ctno#,#Ds[].istaste#,#Ds[].sttime#,#Ds[].atime#,#Ds[].mstime#,#Ds[].metime#,#Ds[].userno#,now(),#uno#,now(),#uno#,#uip#
</iterate>
</update>
<insert id="cm.cminnings.in" parameterClass="cminning">
SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0;
2021-11-03 15:19:08 +09:00
insert into cminning (cmno,week,iseq,isonline,ititle,icontent,idate,iday,ist,iet,fgnotf,ctno,istaste,sttime,atime,mstime,metime,userno,isscd,scdtype,<include refid="sql.inc"></include>)
select #cmno#,#week#,#iseq#,#isonline#,#ititle#,#icontent#,#idate#,#iday#,#ist#,#iet#,#fgnotf#,#ctno#,#istaste#,#sttime#,#atime#,#mstime#,#metime#,#userno#,#isscd#,#scdtype#,<include refid="sql.inv"></include>
2020-10-12 14:39:23 +09:00
from (select 1 col1) a
left outer join cminning b on b.cmno=#cmno# and b.iseq=#iseq#
where b.cmino is null
<selectKey type="post" property="cmino" resultClass="long">SELECT last_insert_id()</selectKey>
</insert>
2020-10-23 17:42:52 +09:00
<insert id="cm.cminningscd.in" parameterClass="cminningscd">
SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0;
insert into cminningscd(cmino,estart,eend,quota,studyplace,sseq,comment,<include refid="sql.inc"></include>)
values(#cmino#,#estart#,#eend#,#quota#,#studyplace#,#sseq#,#comment#,<include refid="sql.inv"></include>)
2020-10-23 17:42:52 +09:00
<selectKey type="post" property="cmisno" resultClass="long">SELECT last_insert_id()</selectKey>
</insert>
<update id="cm.cminningscd.up" parameterClass="cminningscd">
update cminningscd a
set <include refid="sql.up"></include>,cmino=#cmino#,estart=#estart#,eend=#eend#,quota=#quota#
,studyplace=#studyplace#,sseq=#sseq#,comment=#comment#
where a.cmisno=#cmisno#
</update>
2020-10-12 14:39:23 +09:00
<update id="cm.cminnings.up" parameterClass="cminning">
update cminning a
left outer join (
select cmino, cmno from cminning where cmino &lt;&gt; #cmino# and cmno=#cmno# and iseq=#iseq#
) b on b.cmno=a.cmno
set <include refid="sql.up"></include>
,week =#week#,iseq =#iseq#,isonline =#isonline#,ititle =#ititle#,icontent =#icontent#
,idate=#idate#,iday =#iday#,ist =#ist#,iet =#iet#,fgnotf=#fgnotf#
,ctno =#ctno#,istaste =#istaste#,sttime=#sttime#,atime =#atime#,mstime =#mstime#,metime =#metime#,userno =#userno#
2021-11-03 15:19:08 +09:00
,isscd = #isscd#,scdtype=#scdtype#
2020-10-12 14:39:23 +09:00
where a.cmino=#cmino# and b.cmino is null
</update>
2021-11-03 15:19:08 +09:00
<update id="cm.cminningscd.clear" parameterClass="cminning">
update cminningscd a
set <include refid="sql.up"></include>,quota=99999,studyplace=null
where a.cmino = #cmino#
</update>
<update id="cm.cminningscd.up.lect" parameterClass="cminningscd">
update lect a
left outer join cminningscd b on b.cmisno = a.cmisno
set a.edate = date_format(b.eend,'%Y-%m-%d 23:59:59')
2021-11-03 15:19:08 +09:00
where a.cmisno = #cmisno#;
</update>
<update id="cm.cmev.clear" parameterClass="cminning">
update cmev a
set <include refid="sql.up"></include>,isoffabs=null
where a.cmno = #cmno#
</update>
2020-10-12 14:39:23 +09:00
<update id="cm.cminnings.istasteclear" parameterClass="hashtable">
update cminning set istaste=0 where cmno=#cmno# and cmino &lt;&gt; #cmino#
</update>
<select id="cm.datafor.cminningcheck" parameterClass="hashtable" resultClass="data">
select 1 dtype,b.userno intval,0 intval2,0 intval3,b.userid strval,null strval2,null strval3,null isuse
from cmprof a
inner join users b on b.userno=a.userno
where a.cmno=#cmno#
union all
select 2 dtype,a.ctno,0,0,a.ccode,null,null,a.isuse
from ct a
where #ccode# &lt;&gt; '박효동박건' and a.ccode in ($ccode$) and a.isuse=#isuse#
order by dtype
</select>
2020-12-24 12:44:27 +09:00
<select id="cm.cminnigscd.exists" parameterClass="hashtable" resultClass="int">
select count(*)
from cminning a
inner join cminningscd b on a.cmino = b.cmino
where cmno = #cmno#
</select>
2020-10-12 14:39:23 +09:00
<select id="cm.contents" parameterClass="hashtable" resultClass="ct">
select a.*
from (
select a.ctno,a.cmno,a.qdiff,a.cc1,a.cc2,a.cc3,a.cc4,a.cc5,a.ctype,a.ccode,a.ctname,a.fgnotf,a.ismenu,a.isuse
,b.cname
,c1.cname ccname1
,c2.cname ccname2
,c3.cname ccname3
,c4.cname ccname4
,c5.cname ccname5
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.ctname</isNull>) rno
,count(a.cno) over() pagetotalcount
from ct a
left outer join cm b on b.cmno=a.cmno
left outer join comcode c1 on c1.ccode=a.cc1
left outer join comcode c2 on c2.ccode=a.cc2
left outer join comcode c3 on c3.ccode=a.cc3
left outer join comcode c4 on c4.ccode=a.cc4
left outer join comcode c5 on c5.ccode=a.cc5
where a.isdel=0
<isNotNull property="cmno" prepend="and">a.cmno=#cmno#</isNotNull>
<isNotNull property="ctname" prepend="and">a.ctname like concat('%',#ctname#,'%')</isNotNull>
<isNotNull property="isuse" prepend="and">a.isuse=#isuse#</isNotNull>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.cmev" parameterClass="int" resultClass="cmev">
select a.cmno,a.attend,a.attendcut,a.attendrfd,a.attendcutrfd,a.mid,a.midcut,a.midrfd,a.midcutrfd,a.final,a.finalcut,a.finalrfd,a.finalcutrfd,a.subject,a.subjectcut,a.subjectrfd
2020-10-20 17:44:00 +09:00
,a.subjectcutrfd,a.discuss,a.discusscut,a.discussrfd,a.discusscutrfd,a.etc,a.etccut,a.etcrfd,a.etccutrfd,a.cut,a.cutrfd,a.isoffabs
2021-11-03 15:19:08 +09:00
,b.scdtype
,c.cshape
from cmev a
inner join cm c on c.cmno = a.cmno
left outer join cminning b on b.cmno = a.cmno and b.isscd = 1
where a.cmno=#cmno#
2020-10-12 14:39:23 +09:00
</select>
<select id="cm.est" parameterClass="int" resultClass="est">
select 0 gubun,case when a.extype = 0 then 1 else 2 end estkind
,a.exno,a.cmno,a.extype,a.exname,a.edesc,a.etime,a.econdition,a.evtype,a.eqtype,a.israndq,a.israndqi,a.qcount,a.isblur,a.tpoint,a.relaylimit,a.isusebackup,a.isseq
,null sdno,null sdtype,null sdname,null sddesc,null sdcondition
,null rsno,null rscno,null rstype,null rsname,null rscondition
, row_number() over(partition by a.extype order by a.cdt) rno
from cmex a
where a.cmno=#cmno# and a.isdel=0
union all
select 1 gubun,case when a.sdtype = 0 then 11 else 21 end estkind
,a.sdno exno,a.cmno,a.sdtype extype,a.sdname exname,a.sddesc edesc,null etime,a.sdcondition econdition,null evtype,null eqtype,null israndq,null israndqi,null qcount,null isblur,a.tpoint,null relaylimit,null isusebackup,null isseq
,a.sdno,a.sdtype,a.sdname,a.sddesc,a.sdcondition
,null rsno,null rscno,null rstype,null rsname,null rscondition
, row_number() over(partition by a.sdtype order by a.cdt) rno
from cmsd a
where a.cmno=#cmno# and a.isdel=0
union all
select 2 gubun,case when a.rstype = 0 then 32 else 31 end estkind
,a.rsno exno,a.cmno,a.rstype extype,a.rsname exname,null edesc,null etime,a.rscondition econdition,null evtype,null eqtype,null israndq,null israndqi,null qcount,null isblur,null tpoint,null relaylimit,null isusebackup,null isseq
,null sdno,null sdtype,null sdname,null sddesc,null sdcondition
,a.rsno,a.rscno,a.rstype,a.rsname,a.rscondition
, row_number() over(partition by a.rstype order by a.cdt) rno
from cmrs a
where a.cmno=#cmno# and a.isdel=0
order by estkind,rno
</select>
<update id="cm.cmevsave" parameterClass="hashtable">
2020-10-20 17:44:00 +09:00
insert into cmev (cmno,attend,attendcut,attendrfd,attendcutrfd,mid,midcut,midrfd,midcutrfd,final,finalcut,finalrfd,finalcutrfd,subject,subjectcut,subjectrfd,subjectcutrfd,discuss,discusscut,discussrfd,discusscutrfd,etc,etccut,etcrfd,etccutrfd,cut,cutrfd,isoffabs,<include refid="sql.inc"></include>)
select #cmno#,#attend#,#attendcut#,#attendrfd#,#attendcutrfd#,#mid#,#midcut#,#midrfd#,#midcutrfd#,#final#,#finalcut#,#finalrfd#,#finalcutrfd#,#subject#,#subjectcut#,#subjectrfd#,#subjectcutrfd#,#discuss#,#discusscut#,#discussrfd#,#discusscutrfd#,#etc#,#etccut#,#etcrfd#,#etccutrfd#,#cut#,#cutrfd#,#isoffabs#,<include refid="sql.inv"></include>
2020-10-12 14:39:23 +09:00
from (select 1 col1) a
left outer join cmev b on b.cmno=#cmno#
where b.cmno is null;
update cmev set <include refid="sql.up"></include>
,attend =#attend#
,attendcut =#attendcut#
,attendrfd =#attendrfd#
,attendcutrfd =#attendcutrfd#
,mid =#mid#
,midcut =#midcut#
,midrfd =#midrfd#
,midcutrfd =#midcutrfd#
,final =#final#
,finalcut =#finalcut#
,finalrfd =#finalrfd#
,finalcutrfd =#finalcutrfd#
,subject =#subject#
,subjectcut =#subjectcut#
,subjectrfd =#subjectrfd#
,subjectcutrfd =#subjectcutrfd#
,discuss =#discuss#
,discusscut =#discusscut#
,discussrfd =#discussrfd#
,discusscutrfd =#discusscutrfd#
,etc =#etc#
,etccut =#etccut#
,etcrfd =#etcrfd#
,etccutrfd =#etccutrfd#
,cut =#cut#
,cutrfd =#cutrfd#
2020-10-20 17:44:00 +09:00
,isoffabs =#isoffabs#
2020-10-12 14:39:23 +09:00
where #cmno# &gt; 0 and cmno=#cmno#
</update>
<select id="cm.cmexes" parameterClass="hashtable" resultClass="cmex">
select a.*
from (
select a.exno,a.cmno,a.extype,a.exname,a.edesc,a.etime,a.econdition,a.evtype,a.eqtype,a.israndq,a.israndqi,a.qcount,a.isblur,a.tpoint,a.relaylimit,a.isusebackup,a.isseq,a.isresultopen,a.isreexamable,a.cdt,a.udt
2020-10-12 14:39:23 +09:00
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.cdt</isNull>) rno
,count(a.cno) over() pagetotalcount
from cmex a
where a.isdel=0
<isNotNull property="exno">and a.exno=#exno#</isNotNull>
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
<isNotNull property="extype">and a.extype=#extype#</isNotNull>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.cmexqs" parameterClass="int" resultClass="cmexq">
select a.eqno,a.exno,a.qseq,a.qno,a.rpoint
, b.qtextstring, b.dpoint, b.qdiff, b.cc1, b.cc2, b.cc3, b.cc4, b.cc5,b.atype
, cc.cname qdiffname, cc1.cname ccname1, cc2.cname ccname2, cc3.cname ccname3, cc4.cname ccname4, cc5.cname ccname5
from cmexq a
inner join question b on b.qno=a.qno
left outer join comcode cc on cc.ccode = b.qdiff
left outer join comcode cc1 on cc1.ccode = b.cc1
left outer join comcode cc2 on cc2.ccode = b.cc2
left outer join comcode cc3 on cc3.ccode = b.cc3
left outer join comcode cc4 on cc4.ccode = b.cc4
left outer join comcode cc5 on cc5.ccode = b.cc5
where a.exno=#exno#
order by a.qseq
</select>
<select id="cm.exsave.valid" parameterClass="int" resultClass="int">
select count(d.exno)
from (select 1 as col1) a
left outer join lectex d on d.exno=#exno#
</select>
<select id="cm.sdsave.valid" parameterClass="int" resultClass="int">
select sum(cnt)
from (
select count(d.sdno) cnt
from (select 1 as col1) a
left outer join lectsd d on d.sdno=#sdno#
union all
select count(d.sdno)
from (select 1 as col1) a
left outer join lectsdboard d on d.sdno=#sdno#
) a
</select>
<select id="cm.rssave.valid" parameterClass="int" resultClass="int">
select count(d.rsno)
from (select 1 as col1) a
left outer join lectrs d on d.rsno=#rsno#
</select>
<select id="cm.rscsave.valid" parameterClass="int" resultClass="int">
select count(d.rscno)
from (select 1 as col1) a
left outer join cmrs d on d.rscno=#rscno#
</select>
<select id="cm.cmexlayers" parameterClass="int" resultClass="cmexlayer">
select a.exno
,case when a.qdiff = 1 then null else a.qdiff end qdiff
,case when a.cc1 = 1 then null else a.cc1 end cc1
,case when a.cc2 = 1 then null else a.cc2 end cc2
,case when a.cc3 = 1 then null else a.cc3 end cc3
,case when a.cc4 = 1 then null else a.cc4 end cc4
,case when a.cc5 = 1 then null else a.cc5 end cc5
,a.qcount,a.rpoint
, cc.cname qdiffname, cc1.cname ccname1, cc2.cname ccname2, cc3.cname ccname3, cc4.cname ccname4, cc5.cname ccname5
from cmexlayer a
left outer join comcode cc on cc.ccode = a.qdiff and cc.ccode &gt; 0
left outer join comcode cc1 on cc1.ccode = a.cc1 and cc1.ccode &gt; 0
left outer join comcode cc2 on cc2.ccode = a.cc2 and cc2.ccode &gt; 0
left outer join comcode cc3 on cc3.ccode = a.cc3 and cc3.ccode &gt; 0
left outer join comcode cc4 on cc4.ccode = a.cc4 and cc4.ccode &gt; 0
left outer join comcode cc5 on cc5.ccode = a.cc5 and cc5.ccode &gt; 0
where a.exno=#exno#
order by cc.corder, cc1.corder, cc2.corder
</select>
<update id="cm.cmex.savetop" parameterClass="cmex">
UPDATE cmex SET <include refid="sql.up"></include>,exname=#exname#,edesc=#edesc#,econdition=#econdition#,isblur=#isblur#,isusebackup=#isusebackup#
,isseq=#isseq#,isreexamable=#isreexamable#,isresultopen=#isresultopen#,etime=#etime#
2020-10-12 14:39:23 +09:00
where exno=#exno#
</update>
<select id="cm.cmex.extype1count" parameterClass="hashtable" resultClass="int">
select count(b.exno)
from (select 1 col1) a
left outer join cmex b on b.cmno=#cmno# and b.isdel=0 and b.exno &lt;&gt; #exno# and b.extype=1
</select>
<insert id="cm.cmex.in" parameterClass="cmex">
INSERT INTO cmex
(cmno,extype,exname,edesc,etime,econdition,evtype,eqtype,israndq,israndqi,qcount,isblur,tpoint,relaylimit,isusebackup,isseq,isreexamable,isresultopen,isdel,<include refid="sql.inc"></include>)
values (#cmno#,#extype#,#exname#,#edesc#,#etime#,#econdition#,#evtype#,#eqtype#,#israndq#,#israndqi#,#qcount#,#isblur#,#tpoint#,#relaylimit#,#isusebackup#,#isseq#,#isreexamable#,#isresultopen#,0,<include refid="sql.inv"></include>)
2020-10-12 14:39:23 +09:00
<selectKey type="post" property="exno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.cmex.up" parameterClass="cmex">
update cmex set <include refid="sql.up"></include>
,extype =#extype#
,exname =#exname#
,edesc =#edesc#
,etime =#etime#
,econdition =#econdition#
,evtype =#evtype#
,eqtype =#eqtype#
,israndq =#israndq#
,israndqi =#israndqi#
,qcount =#qcount#
,isblur =#isblur#
,tpoint =#tpoint#
,relaylimit =#relaylimit#
,isusebackup =#isusebackup#
,isseq =#isseq#
,isreexamable =#isreexamable#
2020-10-12 14:39:23 +09:00
,isresultopen=#isresultopen#
where exno=#exno#
</update>
<update id="cm.cmexq.deleteall" parameterClass="int">
delete from cmexq where exno=#exno#
</update>
<update id="cm.cmexq.delete" parameterClass="string">
delete from cmexq where exno=#exno# and eqno not in ($eqnos$)
</update>
<update id="cm.cmexlayer.del" parameterClass="int">
delete from cmexlayer where exno=#exno#
</update>
<update id="cm.cmexlayer.in" parameterClass="cmex">
INSERT INTO cmexlayer(exno,qdiff,cc1,cc2,cc3,cc4,cc5,qcount,rpoint,<include refid="sql.inc"></include>)
values
<iterate property="cmexlayers" open="" conjunction="," close="">
(#exno#,#cmexlayers[].qdiff#,#cmexlayers[].cc1#,#cmexlayers[].cc2#,#cmexlayers[].cc3#,#cmexlayers[].cc4#,#cmexlayers[].cc5#,#cmexlayers[].qcount#,#cmexlayers[].rpoint#, now(), #uno#, now(), #uno#, #uip#)
</iterate>
</update>
<update id="cm.cmexq.in" parameterClass="cmex">
INSERT INTO cmexq(exno,qseq,qno,rpoint,<include refid="sql.inc"></include>)
values
<iterate property="cmexqs" open="" conjunction="," close="">
(#exno#,#cmexqs[].qseq#,#cmexqs[].qno#,#cmexqs[].rpoint#, now(), #uno#, now(), #uno#, #uip#)
</iterate>
</update>
<update id="cm.cmexq.up" parameterClass="cmex">
update cmexq a
inner join (
<iterate property="cmexqs" open="" conjunction="union all" close="">
select #cmexqs[].eqno# eqno, #cmexqs[].qseq# qseq, #cmexqs[].rpoint# rpoint
</iterate>
) b on b.eqno=a.eqno
set a.qseq=b.qseq, a.rpoint = b.rpoint, a.udt=now(), a.uno=#uno#, a.uip=#uip#
where a.exno=#exno#
</update>
<update id="cm.cmex.del" parameterClass="int">
update cmex set isdel=1 where exno=#exno#
</update>
<update id="cm.cmsd.del" parameterClass="int">
update cmsd set isdel=1 where sdno=#sdno#
</update>
<update id="cm.cmrs.del" parameterClass="int">
update cmrs set isdel=1 where rsno=#rsno#
</update>
<select id="cm.cmrs.check" parameterClass="hashtable" resultClass="int">
select count(b.rsno)
from (select 1 col1) a
left outer join cmrs b on b.cmno=#cmno# and b.rsno &lt;&gt; #rsno# and b.rstype=#rstype# and b.isdel=0
</select>
<select id="cm.questions" parameterClass="hashtable" resultClass="question">
select a.qno,a.qdiff,a.cc1,a.cc2,a.cc3,a.cc4,a.cc5,a.isuse,a.atype,a.dpoint,a.qtext,a.qtextstring,a.qdesc,a.cmno,a.cname
,a.qdiffname,a.ccname1,a.ccname2,a.ccname3,a.ccname4,a.ccname5,a.rno,a.pagetotalcount,a.cdt,a.udt,a.ispassspace,a.isignorecase
,count(ued.exno) qcount
,sum(case when ued.atext is not null then 1 else 0 end) ecount
,case when sum(case when ued.atext is not null then 1 else 0 end) &lt; 1 then 0 else sum(ued.iscorrect) / sum(case when ued.atext is not null then 1 else 0 end) * 100 end rrate
from (
select a.*,b.cname
from (
select a.qno,a.cmno,a.qdiff,a.cc1,a.cc2,a.cc3,a.cc4,a.cc5,a.isuse,a.atype,a.dpoint,a.qtext,a.qtextstring,a.qdesc, cc.cname qdiffname, cc1.cname ccname1, cc2.cname ccname2, cc3.cname ccname3, cc4.cname ccname4, cc5.cname ccname5, a.cdt,a.udt
,a.ispassspace,a.isignorecase
, Row_Number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.qtextstring</isNull> ) rno
,<include refid="sql.prc"></include>
from question a
left outer join comcode cc on cc.ccode = a.qdiff
left outer join comcode cc1 on cc1.ccode = a.cc1
left outer join comcode cc2 on cc2.ccode = a.cc2
left outer join comcode cc3 on cc3.ccode = a.cc3
left outer join comcode cc4 on cc4.ccode = a.cc4
left outer join comcode cc5 on cc5.ccode = a.cc5
<dynamic prepend="where">
<isNotNull property="cmno" prepend="and">a.cmno=#cmno#</isNotNull>
<isNotNull property="qdiff" prepend="and">a.qdiff=#qdiff#</isNotNull>
<isNotNull property="ccdiff" prepend="and">a.qdiff=#ccdiff#</isNotNull>
2020-10-12 14:39:23 +09:00
<isNotNull property="cc1" prepend="and">a.cc1=#cc1#</isNotNull>
<isNotNull property="cc2" prepend="and">a.cc2=#cc2#</isNotNull>
<isNotNull property="cc3" prepend="and">a.cc3=#cc3#</isNotNull>
<isNotNull property="cc4" prepend="and">a.cc4=#cc4#</isNotNull>
<isNotNull property="cc5" prepend="and">a.cc5=#cc5#</isNotNull>
<isNotNull property="isuse" prepend="and">a.isuse=#isuse#</isNotNull>
<isNotNull property="qtextstring" prepend="and">a.qtextstring like concat('%', #searchtext#,'%')</isNotNull>
<isNotNull property="qno" prepend="and">a.qno=#qno#</isNotNull>
</dynamic>
) a
left outer join cm b on b.cmno=a.cmno
<include refid="sql.pagedynamic"></include>
) a
left outer join cmexq eq on eq.qno=a.qno
left outer join lectexq ued on ued.eqno=eq.eqno
group by a.qno,a.cmno,a.cname,a.qdiff,a.cc1,a.cc2,a.cc3,a.cc4,a.cc5,a.isuse,a.atype,a.dpoint,a.qtext,a.qtextstring,a.qdesc,a.qdiffname,a.ccname1,a.ccname2,a.ccname3,a.ccname4,a.ccname5,a.rno,a.pagetotalcount,a.cdt,a.ispassspace,a.isignorecase
order by a.RNO
</select>
<select id="cm.questions2" parameterClass="hashtable" resultClass="question">
select a.cmno,a.cname,a.qno,a.qdiff,a.cc1,a.cc2,a.cc3,a.cc4,a.cc5,a.isuse,a.atype,a.dpoint,a.qtext,a.qtextstring,a.qdesc
,a.qdiffname,a.ccname1,a.ccname2,a.ccname3,a.ccname4,a.ccname5,a.rno,a.pagetotalcount,a.cdt,a.udt
,count(ued.exno) qcount
,sum(case when ued.atext is not null then 1 else 0 end) ecount
,case when sum(case when ued.atext is not null then 1 else 0 end) &lt; 1 then 0 else sum(ued.iscorrect) / sum(case when ued.atext is not null then 1 else 0 end) * 100 end rrate
from (
select a.*
from (
select a.qno,a.cmno,a.qdiff,a.cc1,a.cc2,a.cc3,a.cc4,a.cc5,a.isuse,a.atype,a.dpoint,a.qtext,a.qtextstring,a.qdesc,a.cdt,a.udt
,b.cname
, cc.cname qdiffname, cc1.cname ccname1, cc2.cname ccname2, cc3.cname ccname3, cc4.cname ccname4, cc5.cname ccname5
, Row_Number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.qtextstring</isNull> ) rno
,<include refid="sql.prc"></include>
from question a
left outer join cm b on b.cmno=a.cmno
left outer join comcode cc on cc.ccode = a.qdiff
left outer join comcode cc1 on cc1.ccode = a.cc1
left outer join comcode cc2 on cc2.ccode = a.cc2
left outer join comcode cc3 on cc3.ccode = a.cc3
left outer join comcode cc4 on cc4.ccode = a.cc4
left outer join comcode cc5 on cc5.ccode = a.cc5
<dynamic prepend="where">
<isNotNull property="cmno" prepend="and">a.cmno=#cmno#</isNotNull>
<isNotNull property="qdiff" prepend="and">a.qdiff=#qdiff#</isNotNull>
<isNotNull property="cc1" prepend="and">a.cc1=#cc1#</isNotNull>
<isNotNull property="cc2" prepend="and">a.cc2=#cc2#</isNotNull>
<isNotNull property="cc3" prepend="and">a.cc3=#cc3#</isNotNull>
<isNotNull property="cc4" prepend="and">a.cc4=#cc4#</isNotNull>
<isNotNull property="cc5" prepend="and">a.cc5=#cc5#</isNotNull>
<isNotNull property="isuse" prepend="and">a.isuse=#isuse#</isNotNull>
<isNotNull property="atypes" prepend="and">a.atype in ($atypes$)</isNotNull>
<isNotNull property="searchtext">
<isEqual property="searchtype" compareValue="qtextstring" prepend="and">a.qtextstring like concat('%', #searchtext#,'%')</isEqual>
<isEqual property="searchtype" compareValue="qno" prepend="and">a.qno = #searchtext#</isEqual>
</isNotNull>
<isNotNull property="qno" prepend="and">a.qno=#qno#</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
) a
left outer join cmexq eq on eq.qno=a.qno
left outer join lectexq ued on ued.eqno=eq.eqno
group by a.qno,a.cmno,a.cname,a.qdiff,a.cc1,a.cc2,a.cc3,a.cc4,a.cc5,a.isuse,a.atype,a.dpoint,a.qtext,a.qtextstring,a.qdesc
,a.qdiffname,a.ccname1,a.ccname2,a.ccname3,a.ccname4,a.ccname5,a.rno,a.pagetotalcount,a.cdt,a.udt
<dynamic prepend="having">
<isNotNull property="qcount" prepend="and">count(ued.examno)=#qcount#</isNotNull>
<isNotNull property="ecount" prepend="and">sum(case when ued.atext is not null then 1 else 0 end)=#ecount#</isNotNull>
<isNotNull property="rrate" prepend="and">case when sum(case when ued.atext is not null then 1 else 0 end) &lt; 1 then 0 else sum(ued.iscorrect) / sum(case when ued.atext is not null then 1 else 0 end) * 100 end=#rrate#</isNotNull>
</dynamic>
order by a.rno
</select>
<insert id="cm.question.in" parameterClass="question">
INSERT INTO question (cmno, qdiff, cc1, cc2, cc3, cc4, cc5, isuse, atype, dpoint, qtext, qtextstring, qdesc, rightcount,ispassspace,isignorecase, <include refid="sql.inc"></include>)
values (#cmno#, #qdiff#, #cc1#, #cc2#, #cc3#, #cc4#, #cc5#, #isuse#, #atype#, #dpoint#, #qtext#, #qtextstring#, #qdesc#, #rightcount#,#ispassspace#,#isignorecase#, <include refid="sql.inv"></include>);
<selectKey type="post" property="qno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.questionitem.in" parameterClass="question">
INSERT INTO questionitem (qno, fgno, isright, qitext, isdel, <include refid="sql.inc"></include>)
values
<iterate property="QIs" open="" conjunction="," close="">
(#qno#, #QIs[].fgno#, #QIs[].isright#, #QIs[].qitext#, 0, now(), #uno#, now(), #uno#, #uip#)
</iterate>
</update>
<update id="cm.question.del" parameterClass="hashtable">
delete from questionitem where qno in (
select distinct qno
from (
select distinct a.qno
from question a
left outer join cmexq b on b.qno=a.qno
where a.qno in ($qnos$) and b.eqno is null
union all
select distinct a.qno
from question a
left outer join rscq b on b.qno=a.qno
where a.qno in ($qnos$) and b.rscqno is null
) a
);
delete from question where qno in (
select distinct qno from (
select distinct a.qno
from question a
left outer join cmexq b on b.qno=a.qno
where a.qno in ($qnos$) and b.eqno is null
union all
select distinct a.qno
from question a
left outer join rscq b on b.qno=a.qno
where a.qno in ($qnos$) and b.rscqno is null
) a
)
</update>
<update id="cm.question.isusechange" parameterClass="hashtable">
update question set isuse=#isuse# where qno in ($qnos$)
</update>
<select id="cm.questionusings" parameterClass="int" resultClass="int">
select sum(cnt)
from (
select 0 as cnt
union all
select count(qno) from cmexq where qno=#qno#
union all
select count(qno) from rscq where qno=#qno#
) a
</select>
<select id="cm.questionitems" parameterClass="int" resultClass="questionitem">
select a.qino,a.qno,a.fgno,a.isright,a.qitext, b.fileno, b.orgname, b.fileurl
from questionitem a
left outer join fileinfo b on b.fgno=a.fgno and b.isdel= 0
<dynamic prepend="where">
<isNotNull property="qno" prepend="and">a.qno = #qno#</isNotNull>
<isNotNull property="isdel" prepend="and">a.isdel = #isdel#</isNotNull>
<isNotNull property="qnos" prepend="and">a.qno in ($qnos$)</isNotNull>
<isNotNull property="isright" prepend="and">a.isright = #isright#</isNotNull>
</dynamic>
order by a.qno, a.qino
</select>
<select id="cm.questionitem.valid" parameterClass="int" resultClass="int">
select sum(cnt)
from (
select 0 as cnt
union all
select a.qno from (
select b.qno
from questionitem a
inner join cmexq b on b.qno=a.qno
where a.qino=#qino# limit 1) a
union all
select a.qno from (
select b.qno
from questionitem a
inner join rscq b on b.qno=a.qno
where a.qino=#qino#
limit 1) a
) a
</select>
<update id="cm.questionitem.del" parameterClass="questionitem">
update question a
inner join questionitem b on b.qino=#qino# and b.qno=a.qno
set a.rightcount = a.rightcount - b.isright;
update questionitem set <include refid="sql.up"></include>
,isdel=1
where qino=#qino#
</update>
<update id="cm.question.up" parameterClass="question">
UPDATE question SET <include refid="sql.up"></include>
,cmno=#cmno#,qdiff=#qdiff#,cc1=#cc1#,cc2=#cc2#,cc3=#cc3#,cc4=#cc4#,cc5=#cc5#,isuse=#isuse#,dpoint=#dpoint#,qtext=#qtext#,qtextstring=#qtextstring#,qdesc=#qdesc#,rightcount=#rightcount#
,ispassspace=#ispassspace#,isignorecase=#isignorecase#
where qno=#qno#
</update>
<update id="cm.question.uptop" parameterClass="question">
UPDATE question SET <include refid="sql.up"></include>
,cmno=#cmno#,isuse=#isuse#,qtext=#qtext#,qtextstring=#qtextstring#,qdesc=#qdesc#,rightcount=#rightcount#
where qno=#qno#
</update>
<update id="cm.questionitem.up" parameterClass="questionitem">
UPDATE questionitem SET <include refid="sql.up"></include>
,fgno=#fgno#,isright=#isright#,qitext=#qitext#
where qino=#qino#
</update>
<select id="cm.cmsds" parameterClass="hashtable" resultClass="cmsd">
select a.*
from (
select a.sdno,a.sdtype,a.cmno,a.sdname,a.sddesc,a.tpoint,a.sdcondition,a.fgno,a.isdel,a.cdt,a.udt
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.cdt</isNull>) rno
,count(a.cno) over() pagetotalcount
from cmsd a
where a.isdel=0
<isNotNull property="sdno">and a.sdno=#sdno#</isNotNull>
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
<isNotNull property="sdtype">and a.sdtype=#sdtype#</isNotNull>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<insert id="cm.cmsd.in" parameterClass="hashtable">
insert into cmsd(sdtype,cmno,sdname,sddesc,tpoint,sdcondition,fgno,isdel,<include refid="sql.inc"></include>)
values(#sdtype#,#cmno#,#sdname#,#sddesc#,#tpoint#,#sdcondition#,#fgno#,0,<include refid="sql.inv"></include>);
<selectKey type="post" property="sdno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.cmsd.up" parameterClass="hashtable">
update cmsd set <include refid="sql.up"></include>
,sdtype =#sdtype#
,sdname =#sdname#
,sddesc =#sddesc#
,tpoint =#tpoint#
,sdcondition =#sdcondition#
,fgno =#fgno#
where sdno=#sdno#
</update>
<update id="cm.cmsd.uplock" parameterClass="hashtable">
update cmsd set <include refid="sql.up"></include>
,sdname =#sdname#
,sddesc =#sddesc#
,tpoint =#tpoint#
,sdcondition =#sdcondition#
,fgno =#fgno#
where sdno=#sdno#
</update>
<select id="cm.cmrss" parameterClass="hashtable" resultClass="cmrs">
select a.*
from (
select a.rsno,a.rstype,a.cmno,a.rsname,a.rscondition,a.rscno,a.isdel,a.cdt,a.udt
,b.rscname
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.cdt</isNull>) rno
,count(a.cno) over() pagetotalcount
from cmrs a
inner join rsc b on b.rscno=a.rscno
where a.isdel=0 <isNotNull property="rsno">and a.rsno=#rsno#</isNotNull>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<insert id="cm.cmrs.in" parameterClass="hashtable">
insert into cmrs(rstype,cmno,rsname,rscondition,rscno,isdel,<include refid="sql.inc"></include>)
values(#rstype#,#cmno#,#rsname#,#rscondition#,#rscno#,0,<include refid="sql.inv"></include>);
<selectKey type="post" property="rsno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.cmrs.up" parameterClass="hashtable">
update cmrs set <include refid="sql.up"></include>
,rstype =#rstype#
,rsname =#rsname#
,rscondition =#rscondition#
,rscno =#rscno#
where rsno=#rsno#
</update>
<update id="cm.cmrs.uplock" parameterClass="hashtable">
update cmrs set <include refid="sql.up"></include>
,rsname =#rsname#
,rscondition =#rscondition#
where rsno=#rsno#
</update>
<select id="cm.cmmenus" parameterClass="int" resultClass="cmmenu">
select a.cmno,a.isplan,a.iscontent,a.isev,a.isrs,a.isgrade
,b.bmno
from cmmenu a
left outer join cmmenubm b on b.cmno=a.cmno
where a.cmno=#cmno#
</select>
<select id="cm.rscs" parameterClass="hashtable" resultClass="rsc">
select *
from (
select a.rscno,a.rstype,a.rscname,a.isuse, a.cdt,a.udt
,a.rscno value,a.rscname text
, Row_Number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.udt desc</isNull> ) rno
,<include refid="sql.prc"></include>
from rsc a
<dynamic prepend="where">
<isNotNull property="rstype" prepend="and">a.rstype=#rstype#</isNotNull>
<isNotNull property="rscname" prepend="and">a.rscname like concat('%', #rscname#,'%')</isNotNull>
<isNotNull property="rscno" prepend="and">a.rscno=#rscno#</isNotNull>
<isNotNull property="isuse" prepend="and">a.isuse=#isuse#</isNotNull>
<isNotNull property="isuseorrsno" prepend="and">(a.rsno=#isuseorrsno# or a.isuse=1)</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.RNO
</select>
<select id="cm.rscqs" parameterClass="int" resultClass="rscq">
select a.rscqno,a.rscno,a.qno,a.dseq
, b.qtextstring, b.dpoint, b.qdiff, b.cc1, b.cc2, b.cc3, b.cc4, b.cc5,b.atype
, cc.cname qdiffname, cc1.cname ccname1, cc2.cname ccname2, cc3.cname ccname3, cc4.cname ccname4, cc5.cname ccname5
,row_number() over(order by a.dseq, a.rscqno) rno
from rscq a
inner join question b on b.qno=a.qno
left outer join comcode cc on cc.ccode = b.qdiff
left outer join comcode cc1 on cc1.ccode = b.cc1
left outer join comcode cc2 on cc2.ccode = b.cc2
left outer join comcode cc3 on cc3.ccode = b.cc3
left outer join comcode cc4 on cc4.ccode = b.cc4
left outer join comcode cc5 on cc5.ccode = b.cc5
where a.rscno=#rscno#
order by rno
</select>
<insert id="cm.rsc.in" parameterClass="hashtable">
insert into rsc(rstype,rscname,isuse,<include refid="sql.inc"></include>)
values(#rstype#,#rscname#,#isuse#,<include refid="sql.inv"></include>);
<selectKey type="post" property="rscno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.rsc.up" parameterClass="hashtable">
update rsc set <include refid="sql.up"></include>
,rstype =#rstype#
,rscname =#rscname#
,isuse =#isuse#
where rscno=#rscno#;
delete from rscq where rscno=#rscno# <isNotEmpty property="QNosup">and qno not in ($QNosup$)</isNotEmpty>;
<isNotEmpty property="QNosup">
update rscq a
inner join (
<iterate property="Dsup" open="" conjunction="union all" close="">
select #Dsup[].rscqno# rscqno,#Dsup[].dseq# dseq
</iterate>
) b on b.rscqno=a.rscqno
set a.dseq=b.dseq,a.udt=now(),a.uno=#uno#,a.uip=#uip#
where a.rscno=#rscno#;
</isNotEmpty>
<isNotEmpty property="QNosin">
insert into rscq(rscno,qno,dseq,cdt,cno,udt,uno,uip)
values <iterate property="Dsin" open="" conjunction="," close="">(#rscno#,#Dsin[].qno#,#Dsin[].dseq#,now(),#uno#,now(),#uno#,#uip#)</iterate>
</isNotEmpty>
</update>
<update id="cm.rsc.uplock" parameterClass="hashtable">
update rsc set <include refid="sql.up"></include>
,rscname =#rscname#
,isuse =#isuse#
where rscno=#rscno#;
<iterate property ="Dsup" open="" conjunction="" close="">
update rscq set <include refid="sql.up"></include>
,dseq = #Dsup[].dseq#
where rscno=#rscno# and rscqno = #Dsup[].rscqno#;
</iterate>
</update>
<update id="cm.rscq.in" parameterClass="rsc">
insert into rscq(rscno,qno,dseq,<include refid="sql.inc"></include>)
values <iterate property="Ds" open="" conjunction="," close="">(#rscno#,#Ds[].qno#,#Ds[].dseq#,now(),#uno#,now(),#uno#,#uip#)</iterate>
</update>
<update id="cm.cmev.in" parameterClass="hashtable">
insert into cmev (cmno,attend,attendcut,attendrfd,attendcutrfd,mid,midcut,midrfd,midcutrfd,final,finalcut,finalrfd,finalcutrfd,subject,subjectcut,subjectrfd
,subjectcutrfd,discuss,discusscut,discussrfd,discusscutrfd,etc,etccut,etcrfd,etccutrfd,cut,cutrfd,<include refid="sql.inc"></include>)
values (#cmno#,100,100,100,100,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,0,100,100,<include refid="sql.inv"></include>)
</update>
<update id="cm.cmmenu.in" parameterClass="hashtable">
insert into cmmenu (cmno,isplan,iscontent,isev,isrs,isgrade,<include refid="sql.inc"></include>)
values(#cmno#,1,1,1,1,1,<include refid="sql.inv"></include>);
insert into cmmenubm (cmno,bmno,<include refid="sql.inc"></include>)
select #cmno#,a.bmno,<include refid="sql.inv"></include>
from boardmaster a
where a.bmposition=1 and a.isopen=1 and a.isdefault=1
</update>
<update id="cm.cmmenu.up" parameterClass="hashtable">
update cmmenu set <include refid="sql.up"></include>,isplan=#isplan#,iscontent=#iscontent#,isev=#isev#,isrs=#isrs#,isgrade=#isgrade#
where cmno=#cmno#;
<isEmpty property="bmnos">
delete from cmmenubm where cmno=#cmno#;
</isEmpty>
<isNotEmpty property="bmnos">
2020-10-12 14:39:23 +09:00
delete from cmmenubm where cmno=#cmno# and bmno not in ($bmnos$);
insert into cmmenubm (cmno,bmno,<include refid="sql.inc"></include>)
select #cmno#,a.bmno,<include refid="sql.inv"></include>
from boardmaster a
left outer join cmmenubm b on b.cmno=#cmno# and b.bmno=a.bmno
where a.bmno in ($bmnos$) and b.bmno is null;
</isNotEmpty>
2020-10-12 14:39:23 +09:00
</update>
<select id="cm.cminfile" parameterClass="int" resultClass="data">
select 1 dtype,a.sdno intval,a.fgno longval,b.fileno longval2,0 longval4,b.fileurl strval
from cmsd a
inner join fileinfo b on b.fgno=a.fgno and b.isdel=0
where a.cmno=#cmno#
union all
select 0,exno,null,null,null,null
from cmex
where cmno=#cmno# and isdel=0
union all
select 2,0,a.fgnotf,b.fileno,a.cmino,b.fileurl
from cminning a
inner join fileinfo b on b.fgno=a.fgnotf and b.isdel=0
where a.cmno=#cmno#
union all
select 3,a.cmno,a.fgnocm,b.fileno,0,b.fileurl
from cm a
inner join fileinfo b on b.fgno=a.fgnocm and b.isdel=0
where a.cmno=#cmno#
order by dtype,intval,longval2
</select>
<insert id="cm.cmcopy0" parameterClass="cm">
insert into cm(ismaster,cgno,pcmno,cname,kname,tmno,classno,rstime,retime,sstime,setime,gstime,getime,cshape,typeman,typeedu,typegrade,typejob,typejobItem,infee,outfee,accommofee,quota,introhtml,targethtml,goalhtml,contenthtml,studyplace,studytime
,certcc,certgradecc,jobcc,jobpositiongrade,difficulty,isrefund,isuse,isseq,iscertificate,isdel,studydays,isaccommodation,daylectinninglimit,<include refid="sql.inc"></include>)
2020-10-12 14:39:23 +09:00
select #ismaster#,cgno,case when a.ismaster = 1 and #ismaster# = 0 then a.cmno else a.pcmno end,ifnull(#cname#, concat('사본_', cname)),a.kname,#tmno#
,case when #tmno# is null then null else ifnull(b.classno,0)+1 end
2021-01-20 14:59:32 +09:00
,t.rstime
,case when date_format(a.retime,'%Y-%m-%d')='2099-12-31' then '2099-12-31 23:59:59' else date_format(t.retime,'%Y-%m-%d 23:59:59') end
,case when date_format(a.retime,'%Y-%m-%d')='2099-12-31' then null else t.sstime end
,case when date_format(a.retime,'%Y-%m-%d')='2099-12-31' then null else date_format(t.setime,'%Y-%m-%d 23:59:59') end
,case when date_format(a.retime,'%Y-%m-%d')='2099-12-31' then null else t.gstime end
,case when date_format(a.retime,'%Y-%m-%d')='2099-12-31' then null else date_format(t.getime,'%Y-%m-%d 23:59:59') end
,a.cshape,a.typeman,a.typeedu,a.typegrade,a.typejob, a.typejobItem,infee,outfee,accommofee,quota,introhtml,targethtml,goalhtml,contenthtml,studyplace,studytime
,certcc,certgradecc,jobcc,jobpositiongrade,difficulty,isrefund,1,isseq,a.iscertificate,0,studydays,isaccommodation,daylectinninglimit,<include refid="sql.inv"></include>
2020-10-12 14:39:23 +09:00
from cm a
left outer join (
select max(b.classno) classno
from cm a
inner join cm b on b.ismaster=0 and b.pcmno=case when a.ismaster=1 then a.cmno else a.pcmno end and b.isdel=0 and b.tmno=ifnull(#tmno#,0)
where a.cmno=#orgcmno#
) b on b.classno is not null
left outer join term t on t.tmno=#tmno#
where a.cmno=#orgcmno#;
<selectKey type="post" property="cmno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.cmcopy" parameterClass="cm">
insert into cmprof(cmno,userno,pfee,<include refid="sql.inc"></include>)
select #cmno#,a.userno,0,<include refid="sql.inv"></include>
from cmprof a
where a.cmno=#orgcmno#;
insert into cmbook(cmno,bkno,<include refid="sql.inc"></include>)
select #cmno#,a.bkno,<include refid="sql.inv"></include>
from cmbook a
where a.cmno=#orgcmno#;
insert into cmrelay(cmno,rcmno,ispre,<include refid="sql.inc"></include>)
select #cmno#,a.rcmno,a.ispre,<include refid="sql.inv"></include>
from cmrelay a
where a.cmno=#orgcmno#;
insert into cmncsd(cmno,ndno,<include refid="sql.inc"></include>)
select #cmno#,a.ndno,<include refid="sql.inv"></include>
from cmncsd a
where a.cmno=#orgcmno#;
insert into cminning(cmno,week,iseq,isonline,ititle,icontent,iday,idate,ist,iet,ctno,istaste,sttime,atime,mstime,metime,userno,orgcmino,isscd,<include refid="sql.inc"></include>)
2020-10-12 14:39:23 +09:00
select #cmno#,a.week,a.iseq,a.isonline,a.ititle,a.icontent,a.iday
,case when a.isonline=1 or b.sstime is null or a.iday is null then null else date_add(b.sstime, interval (a.iday - 1) day) end
,a.ist,a.iet,a.ctno,a.istaste,a.sttime,a.atime,a.mstime,a.metime,a.userno,cmino,a.isscd,<include refid="sql.inv"></include>
2020-10-12 14:39:23 +09:00
from cminning a
inner join cm b on b.cmno=#cmno#
where a.cmno=#orgcmno#;
2021-11-03 15:19:08 +09:00
insert into cminningscd(cmino,estart,eend,quota,studyplace,sseq,<include refid="sql.inc"></include>)
select c.cmino,b.estart,b.eend,b.quota,b.studyplace,sseq,<include refid="sql.inv"></include>
2020-10-14 13:05:43 +09:00
from cminning a
inner join cminningscd b on b.cmino=a.cmino
inner join cminning c on c.cmno=#cmno# and c.isonline=0
where a.cmno=#orgcmno# and a.isonline=0;
2020-10-12 14:39:23 +09:00
insert into cmev(cmno,attend,attendcut,attendrfd,attendcutrfd,mid,midcut,midrfd,midcutrfd,final,finalcut,finalrfd,finalcutrfd,subject,subjectcut,subjectrfd,subjectcutrfd
2020-10-20 17:15:59 +09:00
,discuss,discusscut,discussrfd,discusscutrfd,etc,etccut,etcrfd,etccutrfd,cut,cutrfd,isoffabs,<include refid="sql.inc"></include>)
2020-10-12 14:39:23 +09:00
select #cmno#,attend,attendcut,attendrfd,attendcutrfd,mid,midcut,midrfd,midcutrfd,final,finalcut,finalrfd,finalcutrfd,subject,subjectcut,subjectrfd,subjectcutrfd
2020-10-20 17:15:59 +09:00
,discuss,discusscut,discussrfd,discusscutrfd,etc,etccut,etcrfd,etccutrfd,cut,cutrfd,isoffabs,<include refid="sql.inv"></include>
2020-10-12 14:39:23 +09:00
from cmev a
where a.cmno=#orgcmno#;
insert into cmsd(sdtype,cmno,sdname,sddesc,tpoint,sdcondition,fgno,isdel,orgsdno,<include refid="sql.inc"></include>)
select sdtype,#cmno#,sdname,sddesc,tpoint,sdcondition,null,0,sdno,<include refid="sql.inv"></include>
from cmsd a
where a.cmno=#orgcmno# and a.isdel=0;
insert into cmrs(cmno,rscno,rstype,rsname,rscondition,isdel,<include refid="sql.inc"></include>)
select #cmno#,rscno,rstype,rsname,rscondition,0,<include refid="sql.inv"></include>
from cmrs a
where a.cmno=#orgcmno# and a.isdel=0;
insert into cmmenu(cmno,isplan,iscontent,isev,isrs,isgrade,<include refid="sql.inc"></include>)
select #cmno#,isplan,iscontent,isev,isrs,isgrade,<include refid="sql.inv"></include>
from cmmenu a
where a.cmno=#orgcmno#;
insert into cmmenubm(cmno,bmno,<include refid="sql.inc"></include>)
select #cmno#,a.bmno,<include refid="sql.inv"></include>
from cmmenubm a
where a.cmno=#orgcmno#
</update>
<insert id="cm.cmcopy.ex0" parameterClass="cmex">
2021-07-13 16:48:24 +09:00
insert into cmex (cmno,extype,exname,edesc,etime,econdition,evtype,eqtype,israndq,israndqi,qcount,isblur,tpoint,relaylimit,isusebackup,isseq,isresultopen,isreexamable,isdel,<include refid="sql.inc"></include>)
select #cmno#,extype,exname,edesc,etime,econdition,evtype,eqtype,israndq,israndqi,qcount,isblur,tpoint,relaylimit,isusebackup,isseq,isresultopen,isreexamable,0,<include refid="sql.inv"></include>
2020-10-12 14:39:23 +09:00
from cmex a
where a.exno=#orgexno#;
<selectKey type="post" property="exno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.cmcopy.ex" parameterClass="cmex">
insert into cmexlayer(exno,qdiff,cc1,cc2,cc3,cc4,cc5,qcount,rpoint,<include refid="sql.inc"></include>)
select #exno#,qdiff,cc1,cc2,cc3,cc4,cc5,qcount,rpoint,<include refid="sql.inv"></include>
from cmexlayer a
where a.exno=#orgexno#;
insert into cmexq(exno,qseq,qno,rpoint,<include refid="sql.inc"></include>)
select #exno#,qseq,qno,rpoint,<include refid="sql.inv"></include>
from cmexq a
where a.exno=#orgexno#;
</update>
<update id="cm.cmsd.fgnoup" parameterClass="hashtable">
update cmsd set fgno=#fgno# where cmno=#cmno# and orgsdno=#orgsdno#
</update>
<update id="cm.cminning.fgnoup" parameterClass="hashtable">
update cminning set fgnotf=#fgno# where cmno=#cmno# and orgcmino=#orgcmino#
</update>
<update id="cm.cm.fgnocmup" parameterClass="hashtable">
update cm set fgnocm=#fgnocm# where cmno=#cmno#
</update>
<select id="cm.check.cmpcpay" parameterClass="int" resultClass="int">
select count(b.pino)
from (select 1 as col1) a
left outer join payitem b on b.ptype=1 and b.pcno = #cmno#
</select>
<insert id="cm.cmpcin" parameterClass="cm">
insert into cm (ismaster,cgno,pcmno,cname,tmno,classno,rstime,retime,sstime,setime,gstime,getime,cshape,infee,outfee,quota,introhtml,targethtml,goalhtml,contenthtml,studyplace,studytime
,certcc,certgradecc,jobcc,jobpositiongrade,difficulty,isrefund,isuse,isseq,isdel,<include refid="sql.inc"></include>)
values (#ismaster#,#cgno#,null,#cname#,#tmno#,#classno#,#rstime#,#retime#,#sstime#,#setime#,#gstime#,#getime#,#cshape#,#infee#,#outfee#,#quota#,#introhtml#,#targethtml#,#goalhtml#,#contenthtml#,#studyplace#,#studytime#
,#certcc#,#certgradecc#,#jobcc#,#jobpositiongrade#,#difficulty#,#isrefund#,1,0,0,<include refid="sql.inv"></include>);
<selectKey type="post" property="cmno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.cmpcup" parameterClass="hashtable">
update cm set <include refid="sql.up"></include>
,cgno =#cgno#
,cname =#cname#
,sstime =#sstime#
,setime =#setime#
,introhtml =#introhtml#
where cmno=#cmno#
</update>
<update id="cm.cmpccm.save" parameterClass="cm">
delete from cmpc where pcno=#cmno# and cmno not in ($cmnos$);
<isNotNull property="inquery">
insert into cmpc(pcno,cmno,dseq,orginfee,orgoutfee,drate,infee,outfee,cdt,cno,udt,uno,uip)
values $inquery$;
</isNotNull>
<isNotNull property="upquery">
update cmpc a
inner join (
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].cmno# cmno, #Ds[].dseq# dseq, #Ds[].orginfee# orginfee,#Ds[].orgoutfee# orgoutfee,#Ds[].drate# drate,#Ds[].infee# infee,#Ds[].outfee# outfee </iterate>
) b on b.cmno=a.cmno
set a.drate=b.drate,a.infee=b.infee,a.outfee=b.outfee,a.dseq=b.dseq
,udt=now(),uno=#uno#,uip=#uip#
where a.pcno=#cmno#;
</isNotNull>
update cm a
inner join (
select pcno cmno,sum(infee) infee,sum(outfee) outfee
from cmpc
where pcno=#cmno#
group by pcno
) b on b.cmno=a.cmno
set a.infee=b.infee,a.outfee=b.outfee
where a.cmno=#cmno#
</update>
<select id="cm.cts" parameterClass="hashtable" resultClass="ct">
select *
from (
select a.ctno,a.cmno,a.qdiff,a.cc1,a.cc2,a.cc3,a.cc4,a.cc5,a.ctype,a.ccode,a.ctname,a.fgnothumb,a.fgno,a.fgnotf,a.ismenu,a.tfurl
,a.isdel,a.isuse,a.cdt,a.udt
,b.cname
, Row_Number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.udt desc</isNull> ) rno
,<include refid="sql.prc"></include>
from ct a
inner join cm b on b.cmno=a.cmno
where a.isdel=0
<isNotNull property="ctno" prepend="and">a.ctno=#ctno#</isNotNull>
<isNotNull property="cmno" prepend="and">a.cmno=#cmno#</isNotNull>
<isNotNull property="qdiff" prepend="and">a.qdiff=#qdiff#</isNotNull>
<isNotNull property="cc1" prepend="and">a.cc1=#cc1#</isNotNull>
<isNotNull property="cc2" prepend="and">a.cc2=#cc2#</isNotNull>
<isNotNull property="cc3" prepend="and">a.cc3=#cc3#</isNotNull>
<isNotNull property="cc4" prepend="and">a.cc4=#cc4#</isNotNull>
<isNotNull property="cc5" prepend="and">a.cc5=#cc5#</isNotNull>
<isNotNull property="isuse" prepend="and">a.isuse=#isuse#</isNotNull>
<isNotNull property="ctname" prepend="and">a.ctname like concat('%', #ctname#,'%')</isNotNull>
) a
<include refid="sql.pagedynamic"></include>
order by a.RNO
</select>
<select id="cm.ct.check" parameterClass="string" resultClass="ct">
select distinct a.ctno
from cminning a
where a.ctno in ($ctnos$)
</select>
<select id="cm.check.ctccode" parameterClass="hashtable" resultClass="data">
select ccode strval
from ct
<dynamic prepend="where">
<isNotNull property="ctnonot" prepend="and">ctno&lt;&gt;#ctnonot#</isNotNull>
<isNotNull property="ccodes" prepend="and">ccode in ($ccodes$)</isNotNull>
<isNotNull property="ccode" prepend="and">ccode=#ccode#</isNotNull>
</dynamic>
</select>
<insert id="cm.ct.in" parameterClass="ct">
INSERT INTO ct (cmno,qdiff,cc1,cc2,cc3,cc4,cc5,ctype,ccode,ccodedel,ctname,fgnothumb,fgnotf,tfurl,ismenu,isdel,isuse,isoversize,<include refid="sql.inc"></include>)
values (#cmno#,#qdiff#,#cc1#,#cc2#,#cc3#,#cc4#,#cc5#,#ctype#,#ccode#,#ccode#,#ctname#,#fgnothumb#,#fgnotf#,#tfurl#,#ismenu#,0,#isuse#,#isoversize#,<include refid="sql.inv"></include>);
<selectKey type="post" property="ctno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.ctpage.in" parameterClass="ct">
INSERT INTO ctpage (ctno,pseq,cpname,srcp,srcm,isdel,<include refid="sql.inc"></include>)
values
<iterate property="Ds" open="" conjunction="," close="">
(#ctno#, #Ds[].pseq#, #Ds[].cpname#, #Ds[].srcp#,#Ds[].srcm#,0,now(),#uno#,now(),#uno#,#uip#)
</iterate>
</update>
<select id="cm.ctps" parameterClass="hashtable" resultClass="ctp">
select a.cpno,a.ctno,a.pseq,a.cpname,a.srcp,a.srcm
from ctpage a
where a.isdel=0
<isNotNull property="ctno" prepend="and">a.ctno=#ctno#</isNotNull>
order by a.pseq
</select>
<update id="cm.ctpdel" parameterClass="hashtable">
update ctpage a
inner join (
select a.ctno,count(b.cmino) dcnt
from ct a
left outer join cminning b on b.ctno=a.ctno
where a.ctno=#ctno#
group by a.ctno
) b on b.ctno=a.ctno and b.dcnt = 0
set a.isdel=1,<include refid="sql.up"></include>
where a.cpno=#cpno#
</update>
<update id="cm.ctpage.in2" parameterClass="ct">
insert into ctpage (ctno,pseq,cpname,srcp,srcm,isdel,<include refid="sql.inc"></include>)
values $inquery$
</update>
<update id="cm.ct.up" parameterClass="ct">
update ct set <include refid="sql.up"></include>
,cmno =#cmno#,qdiff =#qdiff#,cc1 =#cc1#,cc2 =#cc2#,cc3 =#cc3#,cc4 =#cc4#,cc5 =#cc5#,ctype =#ctype#
,ccode =#ccode#,ccodedel=#ccode#
,ctname=#ctname#,fgno =#fgno#,fgnotf=#fgnotf#,tfurl =#tfurl#,ismenu=#ismenu#,isuse=#isuse#
,fgnothumb=#fgnothumb#
<isNotNull property="isoversize2">,isoversize=#isoversize2#</isNotNull>
where ctno=#ctno#
</update>
<select id="cm.ct.checkcmi" parameterClass="int" resultClass="int">
select count(b.cmino) dcnt
from ct a
left outer join cminning b on b.ctno=a.ctno
where a.ctno=#ctno#
group by a.ctno
</select>
<update id="cm.ctp.up" parameterClass="ct">
update ctpage a
inner join (
<iterate property="Ds" open="" conjunction="union all" close=""> select #Ds[].cpno# cpno, #Ds[].pseq# pseq, #Ds[].cpname# cpname, #Ds[].srcp# srcp,#Ds[].srcm# srcm </iterate>
) b on b.cpno=a.cpno
set <include refid="sql.up"></include>,a.pseq=b.pseq,a.cpname=b.cpname,a.srcp=b.srcp,a.srcm=b.srcm
where a.ctno=#ctno#
</update>
<update id="cm.ct.del" parameterClass="hashtable">
update ct a
inner join (
select a.ctno,count(b.cmino) dcnt
from ct a
left outer join cminning b on b.ctno=a.ctno
where a.ctno=#ctno#
group by a.ctno
) b on b.ctno=a.ctno and b.dcnt=0
set <include refid="sql.up"></include>
,a.ccode=null,a.isdel=1
where b.dcnt=0 and a.ctno=#ctno#
</update>
<update id="cm.ct.del2" parameterClass="hashtable">
update ct a
inner join (
select a.ctno,count(b.cmino) dcnt
from ct a
left outer join cminning b on b.ctno=a.ctno
where a.ctno in ($ctnos$)
group by a.ctno
) b on b.ctno=a.ctno and b.dcnt=0
set <include refid="sql.up"></include>
,a.ccode=null,a.isdel=1
where b.dcnt=0 and a.ctno in ($ctnos$)
</update>
<select id="cm.pcm.foras" parameterClass="hashtable" resultClass="cm">
select distinct d.cmno value,d.cname text
from users a
inner join lect b on b.userno=a.userno and b.status&lt;5
inner join cm c on c.cmno=b.cmno
inner join cm d on d.cmno=c.pcmno
where a.asno=#asno#
order by text,value
</select>
<select id="cm.cm.foras" parameterClass="hashtable" resultClass="cm">
select distinct c.cmno value,concat(c.cname,'(',c.classno,')') text
from users a
inner join lect b on b.userno=a.userno and b.status&lt;5
inner join cm c on c.cmno=b.cmno and c.pcmno=#pcmno#
where a.asno=#asno#
order by text,value
</select>
<select id="cm.pcm.forall" parameterClass="hashtable" resultClass="cm">
select a.cmno value,a.cname text
from cm a
where a.ismaster=1 and a.isuse=1 and a.isdel=0
order by text,value
</select>
<select id="cm.cm.forall" parameterClass="hashtable" resultClass="cm">
select a.cmno value,concat(a.cname,'(',a.classno,')') text
from cm a
where a.pcmno=#cmno# and a.ismaster=1 and a.isuse=1 and a.isdel=0
order by text,value
</select>
<select id="cm.cmpcsbycmnos" parameterClass="string" resultClass="cm">
select a.pcno,b.cname pcname,a.cmno,c.cname
from cmpc a
inner join cm b on b.cmno=a.pcno
inner join cm c on c.cmno=a.cmno
<isNotEmpty property="pcnos">
where a.pcno in ($pcnos$)
</isNotEmpty>
</select>
<select id="cm.cms.forpay" parameterClass="hashtable" resultClass="cm">
2021-01-07 14:04:52 +09:00
select c.cmno,case when b.isjoin=1 then c.infee else c.infee end fee, c.accommofee, b.isjoin,d.lectno lectnocheck
2020-10-12 14:39:23 +09:00
from users a
left outer join assign b on b.asno=a.asno
inner join cm c on c.cmno=#cmno#
2020-11-24 17:34:18 +09:00
left outer join lect d on d.userno=a.userno and d.cmno=c.cmno and d.status in (1,2,3,4,6) and d.ischanged=0
2020-10-12 14:39:23 +09:00
where a.userno=#userno#
</select>
<select id="cm.cms.forpaypc" parameterClass="hashtable" resultClass="cm">
select c.cmno,case when b.isjoin=1 then c.infee else c.outfee end fee,b.isjoin
from users a
left outer join assign b on b.asno=a.asno
inner join cmpc c on c.pcno=#pcno#
where a.userno=#userno#
</select>
<select id="cm.cms.forpay2" parameterClass="string" resultClass="cm">
select a.cmno,a.infee,a.outfee
from cm a
where a.cmno in ($cmnos$)
</select>
<select id="cm.cms.forpaypc2" parameterClass="hashtable" resultClass="cm">
select a.pcno,a.cmno,a.infee,a.outfee
from cmpc a
where a.pcno in ($pcnos$)
</select>
<update id="cm.cminning.fgno" parameterClass="hashtable">
update cminning set fgno=#fgno# where cmino=#cmino#
</update>
2021-11-03 15:19:08 +09:00
<update id="cm.cminning.fgnooff" parameterClass="hashtable">
update cminning set fgnooff=#fgnooff# where cmino=#cmino#
</update>
2020-10-12 14:39:23 +09:00
<select id="cm.cms.forbuy" parameterClass="hashtable" resultClass="cm">
select a.cmno,a.cname,a.cshape,a.studyplace,a.studytime,a.infee,a.outfee,a.rstime,a.retime,a.sstime,a.setime,a.quota,a.difficulty,a.isrefund,a.fgnocm
,a.introhtml,a.targethtml,a.goalhtml,a.contenthtml,a.fgnocm
<!--,ev.attend,ev.attendcut,ev.attendrfd,ev.attendcutrfd,ev.mid,ev.midcut,ev.midrfd,ev.midcutrfd,ev.final,ev.finalcut,ev.finalrfd,ev.finalcutrfd,ev.subject,ev.subjectcut,ev.subjectrfd,ev.subjectcutrfd,ev.discuss,ev.discusscut,ev.discussrfd,ev.discusscutrfd,ev.etc,ev.etccut,ev.etcrfd,ev.etccutrfd,ev.cut,ev.cutrfd-->
,case when h.isjoin=1 then a.infee else a.outfee end fee
,b.cgname,b.cgcode
,c.cgcode pcgcode
,i.cmino
<!--,case when j.ctype=0 then concat('/', j.ccode, '/', k.srcp) else null end tasteurl-->
,ifnull(jf.fileurl,jf2.fileurl) tasteurl
,case when j.ctype &lt; 2 then concat(#contents#,'/', j.ccode, '/', k.srcp) else k.srcp end tasteurlpc
,case when j.ctype &lt; 2 then concat(#contents#,'/', j.ccode, '/', k.srcm) else k.srcm end tasterurlmobile
,m.cname certgradeccname
2020-10-13 16:10:18 +09:00
,cc.cname studyplacename
2020-10-12 14:39:23 +09:00
,max(case when e.lectno is null then 0 else 1 end) isrequested
,count(f.userno) countlect
from cm a
left outer join cmev ev on ev.cmno=a.cmno
inner join cg b on b.cgno=a.cgno <isNotNull property="cgcode">and b.cgcode=#cgcode#</isNotNull> <isNotNull property="iscover">and b.iscover=#iscover#</isNotNull>
inner join cg c on c.cgno=b.pcgno <isNotNull property="pcgcode">and c.cgcode=#pcgcode#</isNotNull>
left outer join lect d on d.cmno=a.cmno and d.status &lt; 5 and d.ischanged=0
left outer join lect e on e.cmno=a.cmno and e.userno=#userno# and e.status &lt;5 and e.ischanged=0
left outer join users f on f.userno=e.userno and f.status=1
left outer join users g on g.userno=#userno#
left outer join assign h on h.asno=g.asno
left outer join cminning i on i.cmno=a.cmno and i.istaste=1
left outer join ct j on j.ctno=i.ctno
left outer join fileinfo jf on jf.fgno=j.fgnothumb and jf.isdel=0
left outer join cminning i2 on i2.cmno=a.cmno and i2.iseq=1
left outer join ct j2 on j2.ctno=i2.ctno
left outer join fileinfo jf2 on jf2.fgno=j2.fgnothumb and jf2.isdel=0
left outer join ctpage k on k.ctno=j.ctno and k.pseq=1
left outer join comcode m on m.ccode=a.certgradecc
2020-10-13 16:10:18 +09:00
left outer join comcode cc on cc.ccode=a.studyplace
2020-10-12 14:39:23 +09:00
where a.ismaster=0 and a.isuse=1 and a.isdel=0
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
<isNotNull property="year">and year(a.sstime)=#year#</isNotNull>
<isNotNull property="cnamelike">and a.cname like concat('%', #cnamelike#,'%')</isNotNull>
<isNotNull property="isrequestable">and a.rstime &lt; now() and a.retime &gt; now()</isNotNull>
group by a.cmno,a.cname,a.studyplace,a.studytime,a.infee,a.outfee,a.rstime,a.retime,a.sstime,a.setime,a.quota,a.difficulty,a.isrefund,a.fgnocm
<!--,ev.attend,ev.attendcut,ev.attendrfd,ev.attendcutrfd,ev.mid,ev.midcut,ev.midrfd,ev.midcutrfd,ev.final,ev.finalcut,ev.finalrfd,ev.finalcutrfd,ev.subject,ev.subjectcut,ev.subjectrfd,ev.subjectcutrfd,ev.discuss,ev.discusscut,ev.discussrfd,ev.discusscutrfd,ev.etc,ev.etccut,ev.etcrfd,ev.etccutrfd,ev.cut,ev.cutrfd-->
,b.cgname,b.cgcode
,c.cgcode
,h.isjoin
,i.cmino
,j.ccode,j.ctype,k.srcp,k.srcm,m.cname
2020-10-13 16:10:18 +09:00
,cc.cname
2020-10-12 14:39:23 +09:00
<isNotNull property="isrequestable">having count(d.lectno) &lt; a.quota or a.quota=0</isNotNull>
order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.sstime,a.setime</isNull>
</select>
<select id="cm.cmbooks" parameterClass="string" resultClass="book">
select a.cmno
,b.bkno,b.bkname,b.price,b.author,b.publisher,b.pubdate
,c.fileurl
from cmbook a
inner join book b on b.bkno=a.bkno
left outer join fileinfo c on c.fgno=b.fgnothumb and c.isdel=0
where a.cmno in ($cmnos$)
order by a.cmno,b.bkname
</select>
<select id="cm.cmcheck.forbuy" parameterClass="hashtable" resultClass="cm">
select 1 rno,a.cmno,a.quota
,b.status lectstatus
,count(d.userno) countlect
from cm a
left outer join lect b on b.cmno=a.cmno and b.userno=#userno# and b.status &lt; 5 and b.ischanged=0
left outer join lect c on c.cmno=a.cmno and c.status &lt; 5 and c.ischanged=0
left outer join users d on d.userno=c.userno and d.status=1
where a.cmno=#cmno# and a.ismaster=0 and a.rstime &lt; now() and a.retime &gt; now() and a.isuse=1 and a.isdel=0
group by a.cmno,a.quota,b.status
union all
select 2,a.cmno,0
,b.status
,0
from cm a
inner join lect b on b.cmno &lt;&gt; a.cmno and b.userno=#userno# and b.status &lt; 5
inner join cm c on c.cmno=b.cmno and c.pcmno=a.pcmno
where a.cmno = #cmno#
</select>
<select id="cm.cmrelays" parameterClass="hashtable" resultClass="cm">
select a.ispre
,b.cmno,b.cname,b.rstime,b.retime,b.sstime,b.setime,b.difficulty,b.studytime,b.infee,b.outfee,b.isrefund
,b2.cgcode
,b3.cgcode pcgcode
,case when d.isjoin=1 then b.infee else b.outfee end fee
from cmrelay a
inner join cm b on b.cmno=a.rcmno and b.isuse=1 and b.isdel=0
inner join cg b2 on b2.cgno=b.cgno
inner join cg b3 on b3.cgno=b2.pcgno
left outer join users c on c.userno=#userno#
left outer join assign d on d.asno=c.asno
<dynamic prepend="where">
<isNotNull property="cmno" prepend="and">a.cmno=#cmno#</isNotNull>
</dynamic>
order by a.ispre desc, b.cname
</select>
2020-10-20 15:42:40 +09:00
<select id="cm.cmcshape" parameterClass="hashtable" resultClass="cm">
select cshape
from cm
<dynamic prepend="where">
<isNotNull property="cmno" prepend="and">cmno=#cmno#</isNotNull>
</dynamic>
</select>
2020-10-28 15:25:13 +09:00
<select id="cm.cgetc" parameterClass="hashtable" resultClass="cm">
select
b.cgno,b.pcgno,b.cgname,b.cgcode,b.isuse,b.iscover,b.isdel,b.cdt,b.cno,b.udt,b.uno,b.uip
from cg a
left outer join cg b on a.cgno = b.pcgno
2020-12-11 13:26:56 +09:00
where b.isdel=0 and b.isuse = 1
2020-10-28 15:25:13 +09:00
<isNotNull property="cgcode" prepend="and">a.cgcode=#cgcode#</isNotNull>
</select>
2020-11-02 16:59:33 +09:00
<!--<select id="cm.cms.studyplacecnt" parameterClass="int" resultClass="studyplace">
select
a.cmno,a.cname,b.ccode,b.cname
from cm a
left outer join comcode b on a.studyplace = b.ccode and b.cgroup='studyplace'
where a.isdel=0
<isNotNull property="pcmno">and a.pcmno=#cmno#</isNotNull>
</select>-->
2020-11-04 17:04:10 +09:00
<select id="cm.subcms" parameterClass="hashtable" resultClass="cm">
select a.*
from (
select a.cmno,case when a.ismaster=2 then a.cmno else 0 end pcno,a.ismaster,a.cgno,a.pcmno,a.cname,a.kname
,a.tmno,a.classno,a.rstime,a.retime,a.sstime,a.setime,a.gstime,a.getime
2021-01-05 14:19:50 +09:00
,a.cshape,a.infee,a.outfee,a.accommofee,a.quota
2020-11-04 17:04:10 +09:00
,a.introhtml,a.targethtml,a.goalhtml,a.contenthtml
2021-01-20 14:59:32 +09:00
,a.studytime,a.studyplace,a.certcc,a.certgradecc,a.jobcc,a.jobpositiongrade,a.difficulty,a.isrefund,a.isuse,a.isseq,a.fgnocm,a.studydays
2020-11-04 17:04:10 +09:00
,a.typeman,a.typeedu,a.typegrade,a.typejob,a.iscertificate
,b.pcgno,b.cgcode cgcode
,b.cgname,c.cgname pcgname
,c.cgcode pcgcode
,t.tyear,t.tseq
,d.cname pcname
,a.cdt,a.udt
,a.cmno value,a.cname text
,e.ccode, e.cname studyplacename
2021-01-22 10:59:21 +09:00
,(select count(l.lectno) cnt from lect l where l.cmno = a.cmno and l.status =1 and l.ischanged=0) lectcnt
2020-11-04 17:04:10 +09:00
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.udt desc</isNull>) rno
,count(a.cdt) over() pagetotalcount
2022-08-02 13:25:57 +09:00
,f.scdtype
2020-11-04 17:04:10 +09:00
from cm a
inner join cg b on b.cgno=a.cgno
inner join cg c on c.cgno=b.pcgno
left outer join term t on t.tmno=a.tmno
left outer join cm d on a.ismaster=0 and d.cmno=a.pcmno
left outer join comcode e on a.studyplace = e.ccode
2022-08-02 13:25:57 +09:00
<!--20220726 온라인강좌 혼합여부 추가-->
left JOIN cminning f
on a.cmno = f.cmno
and f.iseq = 99
where a.isdel=0 and a.rstime &lt;= now() and a.retime &gt;= now()
2020-11-04 17:04:10 +09:00
<isNotNull property="cmno">and a.pcmno=#cmno#</isNotNull>
<isNotNull property="studyplace">and a.studyplace=#studyplace#</isNotNull>
2022-08-02 13:25:57 +09:00
<!--20220726 파라미터로 추가-->
<isNotNull property="cshape">and a.cshape=#cshape#</isNotNull>
<isNotNull property="isuse">and a.isuse=#isuse#</isNotNull>
2022-08-02 13:25:57 +09:00
<isNotNull property="typeman">and a.typeman like concat('%',#typeman#,'%')</isNotNull>
<isNotNull property="typeedu">and a.typeedu like concat('%',#typeedu#,'%')</isNotNull>
<isNotNull property="typegrade">and a.typegrade like concat('%',#typegrade#,'%')</isNotNull>
<isNotNull property="typejob">and a.typejob like concat('%',#typejob#,'%')</isNotNull>
<isNotNull property="typejobitem">and a.typejobitem like concat('%',#typejobitem#,'%')</isNotNull>
) a
<!--<include refid="sql.pagedynamic"></include>-->
2022-08-02 13:25:57 +09:00
<isNull property="orderby">order by a.tseq, a.rstime, studyplacename</isNull>
<isNotNull property="orderby">order by #orderby#</isNotNull>
<!--20220726 파라미터로 변경-->
<!--order by a.tseq, a.rstime, studyplacename-->
2020-11-04 17:04:10 +09:00
</select>
<select id="cm.cmuser" parameterClass="hashtable" resultClass="cm">
select a.cmno,case when a.ismaster=2 then a.cmno else 0 end pcno,a.ismaster,a.cgno,a.pcmno,a.cname,a.kname
,a.tmno,a.classno,a.rstime,a.retime,a.sstime,a.setime,a.gstime,a.getime
2021-01-05 14:19:50 +09:00
,a.cshape,a.infee,a.outfee,a.accommofee,a.quota
2020-11-04 17:04:10 +09:00
,a.introhtml,a.targethtml,a.goalhtml,a.contenthtml
,a.studytime,a.studyplace,a.certcc,a.certgradecc,a.jobcc,a.jobpositiongrade,a.difficulty,a.isrefund,a.isuse,a.isseq,a.fgnocm
,a.typeman,a.typeedu,a.typegrade,a.typejob,a.iscertificate
,b.pcgno,b.cgcode cgcode
,b.cgname,c.cgname pcgname
,c.cgcode pcgcode
,t.tyear,t.tseq
,d.cname pcname
,a.cdt,a.udt
,a.cmno value,a.cname text
,e.ccode, e.cname studyplacename
,g.attendcut,g.finalcut,g.subjectcut, ifnull(g.isoffabs,0) isoffabs
2021-08-23 15:10:15 +09:00
,h.username
2020-11-04 17:04:10 +09:00
from cm a
inner join cg b on b.cgno=a.cgno
inner join cg c on c.cgno=b.pcgno
left outer join term t on t.tmno=a.tmno
left outer join cm d on a.ismaster=0 and d.cmno=a.pcmno
left outer join comcode e on a.studyplace = e.ccode
left outer join cmev g on a.cmno = g.cmno
2021-08-23 15:10:15 +09:00
left outer join (
select group_concat(b.username separator ', ') username,a.cmno
from cmprof a
inner join users b on b.userno = a.userno
where b.status =1
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
2021-08-23 15:10:15 +09:00
group by a.cmno
) h on a.cmno = h.cmno
2020-11-04 17:04:10 +09:00
where a.isdel=0
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
<isNotNull property="studyplace">and a.studyplace=#studyplace#</isNotNull>
</select>
2022-08-03 16:50:01 +09:00
<select id="cm.cminningscds.applyedu.admin" parameterClass="hashtable" resultClass="cminningscd">
select a.*
from (
select
a.cmisno,a.cmino,a.estart,a.eend,a.quota,a.cdt,a.udt,a.studyplace,a.studyplacename,a.startmonth,a.comment
,a.remainPeople
,a.isselected
<!--,case when a.remainPeople &lt;= 0 then 0 else 1 end isend-->
, 1 isend
from
(
select a.cmisno,a.cmino,a.estart,a.eend,a.quota,a.cdt,a.udt,month(a.estart) startmonth
,(a.quota - (select count(z.lectno) cnt from lect z where a.cmisno = z.cmisno and z.status in (1,2) and z.ischanged=0)) remainPeople
,a.studyplace,case when c.scdtype =1 then '온라인' else e.cname end studyplacename
,case when date_format(d.setime,'%Y%m%d') = date_format(a.estart,'%Y%m%d') then 1 else 0 end isselected
,a.comment
from cminningscd a
left outer join cminning c on c.cmino = a.cmino
left outer join cm d on d.cmno = c.cmno
left outer join comcode e on e.ccode = a.studyplace
<dynamic prepend="where">
<isNotNull property="cmno" prepend="and">c.cmno=#cmno#</isNotNull>
</dynamic>
)a
<dynamic prepend="where">
<isNotNull property="month" prepend="and">a.startmonth=#month#</isNotNull>
</dynamic>
) a
<!--where a.isend = 1-->
2022-08-03 16:50:01 +09:00
<!--20220803
and a.remainPeople &gt; 0-->
order by a.estart
</select>
<select id="cm.cminningscds.applyedu.admin2" parameterClass="hashtable" resultClass="cminningscd">
select a.*
from (
select
a.cmisno,a.cmino,a.estart,a.eend,a.quota,a.cdt,a.udt,a.studyplace,a.studyplacename,a.startmonth,a.comment
,a.remainPeople
,a.isselected
<!--,case when a.remainPeople &lt;= 0 then 0 else 1 end isend-->
, 1 isend
from
(
select a.cmisno,a.cmino,a.estart,a.eend,a.quota,a.cdt,a.udt,month(a.estart) startmonth
,(a.quota - (select count(z.lectno) cnt from lect z where a.cmisno = z.cmisno and z.status in (1,2) and z.ischanged=0)) remainPeople
,a.studyplace,case when c.scdtype =1 then '온라인' else e.cname end studyplacename
,case when date_format(d.setime,'%Y%m%d') = date_format(a.estart,'%Y%m%d') then 1 else 0 end isselected
,a.comment
from cminningscd a
left outer join cminning c on c.cmino = a.cmino
left outer join cm d on d.cmno = c.cmno
left outer join comcode e on e.ccode = a.studyplace
<dynamic prepend="where">
<isNotNull property="cmno" prepend="and">c.cmno=#cmno#</isNotNull>
</dynamic>
)a
<dynamic prepend="where">
<isNotNull property="month" prepend="and">a.startmonth=#month#</isNotNull>
</dynamic>
) a
<!--20220803
and a.remainPeople &gt; 0-->
order by a.estart
</select>
<select id="cm.cminningscds.attr2Check" parameterClass="hashtable" resultClass="cminningscd">
SELECT l.cmno, l.lectno, istatus as intv1, li.cmino, l.cmisno
FROM lect l
INNER JOIN users u ON l.userno = u.userno AND u.status = 1
LEFT OUTER JOIN lectinning li ON li.lectno = l.lectno
WHERE l.status IN (1,2) AND l.ischanged=0 AND l.cmno = #cmno# AND cmino = #cmino# AND istatus IS NOT NULL
<isNotNull property="cmisno" prepend="and">l.cmisno=#cmisno#</isNotNull>
GROUP BY l.cmno, l.lectno, istatus, li.cmino, l.cmisno
</select>
2020-11-05 17:02:05 +09:00
<select id="cm.cminningscds.applyedu" parameterClass="hashtable" resultClass="cminningscd">
2021-11-03 15:19:08 +09:00
select a.*
from (
select
a.cmno,a.pcmno,a.cgcode
,a.cmisno,a.cmino,a.estart,a.eend,a.quota,a.cdt,a.udt,a.studyplace,a.studyplacename,a.startmonth,a.comment
,a.remainPeople
,a.isselected
<!--211220.통합테스트목록(643) 4일부터로 변경-->
,case when a.estart &lt; date_format(now() ,'%Y-%m-%d 00:00:00')
2022-08-03 16:50:01 +09:00
<!--20220803
or a.remainPeople &lt;= 0-->
then 0 else 1 end isend
,a.scdtype
from
(
select a.cmisno,a.cmino,a.estart,a.eend,a.quota,a.cdt,a.udt,month(a.estart) startmonth
,(a.quota - (select count(z.lectno) cnt from lect z where a.cmisno = z.cmisno and z.status in (1,2) and z.ischanged=0)) remainPeople
,a.studyplace,case when c.scdtype =1 then '온라인' else e.cname end studyplacename
,case when date_format(d.setime,'%Y%m%d') = date_format(a.estart,'%Y%m%d') then 1 else 0 end isselected
,c.scdtype
,d.cmno,d.pcmno,cg.cgcode
,d.cshape,a.comment
from cminningscd a
left outer join cminning c on c.cmino = a.cmino
left outer join cm d on d.cmno = c.cmno
left outer join cg cg on d.cgno = cg.cgno
left outer join comcode e on e.ccode = a.studyplace
<dynamic prepend="where">
2021-11-03 15:19:08 +09:00
<isNotNull property="cmno" prepend="and">c.cmno=#cmno#</isNotNull>
</dynamic>
)a
2020-11-11 16:26:18 +09:00
<dynamic prepend="where">
2021-11-03 15:19:08 +09:00
<isNotNull property="month" prepend="and">a.startmonth=#month#</isNotNull>
2020-11-11 16:26:18 +09:00
</dynamic>
2022-08-02 13:25:57 +09:00
<dynamic prepend="where">
<isNotNull property="studyplace" prepend="and">a.studyplace=#studyplace#</isNotNull>
</dynamic>
2021-11-03 15:19:08 +09:00
) a
2022-08-03 16:50:01 +09:00
where a.isend = 1
<!--20220803
and a.remainPeople &gt; 0-->
2021-11-03 15:19:08 +09:00
order by a.estart
2020-11-05 17:02:05 +09:00
</select>
2022-08-03 16:50:01 +09:00
2021-08-23 15:10:15 +09:00
<select id="cm.cminningscds.applyedu.lectno" parameterClass="hashtable" resultClass="cminningscd">
select
a.cmisno,a.cmino,a.estart,a.eend,a.quota,a.cdt,a.udt,a.studyplace,a.studyplacename,a.startmonth,a.comment
,a.studyplace, a.studyplacename,a.remainPeople
,a.isselected, a.cmno,a.pcmno,a.cgcode
<!--211220.통합테스트목록(644) 이미지난 교육종료일 변경불가-->
2022-08-03 16:50:01 +09:00
,case when a.estart &lt; date_add(date_format(now() ,'%Y-%m-%d 00:00:00'),interval -1 second)
<!--20220803
or a.remainPeople &lt;= 0 -->
then 0 else 1 end isend
from
(
select a.cmisno,a.cmino,a.estart,a.eend,a.quota,a.cdt,a.udt,month(a.estart) startmonth
,(a.quota - (select count(z.lectno) cnt from lect z where a.cmisno = z.cmisno and z.status in (1,2) and z.ischanged=0)) remainPeople
,a.studyplace, e.cname studyplacename
,case when f.cmisno = a.cmisno then 1 else 0 end isselected, d.cmno,d.pcmno,cg.cgcode
,a.comment
from cminningscd a
left outer join cminning c on c.cmino = a.cmino
left outer join cm d on d.cmno = c.cmno
left outer join cg cg on d.cgno = cg.cgno
left outer join comcode e on e.ccode = a.studyplace
left outer join lect f on f.lectno = #lectno#
where DATE_ADD(f.sdate, INTERVAL 1 YEAR) > a.estart
<isNotNull property="cmno" prepend="and">c.cmno=#cmno#</isNotNull>
2021-08-23 15:10:15 +09:00
)a
<dynamic prepend="where">
<isNotNull property="month" prepend="and">a.startmonth=#month#</isNotNull>
</dynamic>
order by isend desc,a.estart
</select>
2022-08-03 16:50:01 +09:00
2020-11-06 11:20:26 +09:00
<select id="cm.user.applyedu" parameterClass="hashtable" resultClass="users">
select
a.userno,a.usertype,a.jointype,a.snsid,a.userkind,a.userid,a.userpass,a.username,a.usernameeng,a.gender,a.birthday,a.isacceptemail,a.isacceptmobile,a.telno,a.asno,a.pasname
,a.depart,a.ccposition,a.ccpositionetc,a.fgnoprofile,a.ccjobs,a.bankname,a.bankno,a.post,a.address1,a.address2,a.introhtml,a.status,a.exitreason,a.logintime,a.loginkey,a.send335time
,a.pwcalltime,a.pwcallno,a.eastereggkey,a.eetime,a.kfcfyear,a.isassignuser,a.uduty,a.slevel,a.edus,a.remotekey,a.vssn,a.di,a.ci
,CAST(AES_DECRYPT(UNHEX(a.mobile), <include refid="sql.digest"></include>) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(a.email), <include refid="sql.digest"></include>) AS char) email
,CAST(AES_DECRYPT(UNHEX(a.userpno), <include refid="sql.digest"></include>) AS char) userpno
from users a
where a.status &lt;&gt; 99
<isNotNull property="userno">and a.userno=#userno#</isNotNull>
</select>
<select id="cm.assign.applyedu" parameterClass="hashtable" resultClass="assign">
select
a.asno,a.ascode,a.isjoin,a.joinyear,a.joinprice,a.asname,a.ceoname,a.brno,a.eino,a.grno,a.btype,a.bkind,a.salesamount,a.homeurl,a.mcount,a.aday,a.astype,a.asctg,a.askey,a.post
,a.address1,a.address2,a.fgnobno,a.fgnobank,a.joindate,a.exitdate,a.status,a.issite,a.subdomain,a.sitename,a.sitelogo,a.sitefooter,a.siteip,a.ismain,a.mname,a.isdel
,CAST(AES_DECRYPT(UNHEX(a.mphone), <include refid="sql.digest"></include>) AS char) mphone
,CAST(AES_DECRYPT(UNHEX(a.taxemail), <include refid="sql.digest"></include>) AS char) taxemail
from assign a
inner join users b on a.asno = b.asno
where b.status &lt;&gt; 99
and a.isdel=0
<isNotNull property="userno">and b.userno=#userno#</isNotNull>
</select>
<select id="cm.assign.applyedu.byasno" parameterClass="hashtable" resultClass="assign">
select
a.asno,a.ascode,a.isjoin,a.joinyear,a.joinprice,a.asname,a.ceoname,a.brno,a.eino,a.grno,a.btype,a.bkind,a.salesamount,a.homeurl,a.mcount,a.aday,a.astype,a.asctg,a.askey,a.post
,a.address1,a.address2,a.fgnobno,a.fgnobank,a.joindate,a.exitdate,a.status,a.issite,a.subdomain,a.sitename,a.sitelogo,a.sitefooter,a.siteip,a.ismain,a.mname,a.isdel
,CAST(AES_DECRYPT(UNHEX(a.mphone), <include refid="sql.digest"></include>) AS char) mphone
,CAST(AES_DECRYPT(UNHEX(a.taxemail), <include refid="sql.digest"></include>) AS char) taxemail
from assign a
where a.asno=#asno#
and a.isdel=0
</select>
2020-11-06 18:04:55 +09:00
<insert id="cm.pplog.applyedu.in" parameterClass="hashtable">
SELECT * FROM (SELECT LAST_INSERT_ID(0) col1) a WHERE col1 > 0;
insert into pplog (
userno,cmno,isready,cgcode,cshape,typeman,typeedu,typegrade,typejob,typejobItem,cgno,cmisno,isrebate,rbankname,rbankacc,rbankowner,asname,brno,ceoname,post,address1,address2,btype,bkind,eino,mname
2021-01-07 14:04:52 +09:00
,mphone,taxemail,userpno,mobile,email,upost,uaddress1,uaddress2,isassignuser,uduty,slevel,isaccommodation,<include refid="sql.inc"></include>)
2020-11-06 18:04:55 +09:00
values (
#userno#,#cmno#,#isready#,#cgcode#,#cshape#,#typeman#,#typeedu#,#typegrade#,#typejob#,#typejobItem#,#cgno#,#cmisno#,#isrebate#,#rbankname#
2021-05-21 16:34:04 +09:00
,HEX(AES_ENCRYPT(#rbankacc#, <include refid="sql.digest"></include>))
,#rbankowner#,#asname#,#brno#,#ceoname#,#post#,#address1#
2020-11-06 18:04:55 +09:00
,#address2#,#btype#,#bkind#,#eino#,#mname#
,HEX(AES_ENCRYPT(#mphone#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#taxemail#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#userpno#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>))
2021-01-07 14:04:52 +09:00
,#upost#,#uaddress1#,#uaddress2#,#isassignuser#,#uduty#,#slevel#,#isaccommodation#,<include refid="sql.inv"></include>)
2020-11-06 18:04:55 +09:00
<selectKey type="post" property="pplno" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="cm.assign.applyedu.up" parameterClass="hashtable">
update assign set <include refid="sql.up"></include>
,asname=#asname#
,ceoname=#ceoname#
,brno =#brno#
<isNotEmpty property="post">,post =#post#</isNotEmpty>
<isNotEmpty property="address1">,address1=#address1#</isNotEmpty>
2021-09-02 12:51:06 +09:00
,address2=#address2#
<isNotEmpty property="btype">,btype =#btype#</isNotEmpty>
<isNotEmpty property="bkind">,bkind =#bkind#</isNotEmpty>
2021-04-28 15:36:20 +09:00
<isNotNull property="fgnobno">,fgnobno=#fgnobno#</isNotNull>
<isNotEmpty property="eino">,eino=#eino#</isNotEmpty>
<!--<isNotEmpty property="mname">,mname=#mname#</isNotEmpty>-->
<!--<isNotEmpty property="mphone">,mphone =case when #mphone# is not null then HEX(AES_ENCRYPT(#mphone#, <include refid="sql.digest"></include>)) else mphone end</isNotEmpty>-->
<!--<isNotEmpty property="taxemail">,taxemail =case when #taxemail# is not null then HEX(AES_ENCRYPT(#taxemail#, <include refid="sql.digest"></include>)) else taxemail end</isNotEmpty>-->
2020-11-06 18:04:55 +09:00
where asno=#asno#
</update>
<update id="cm.users.applyedu.up" parameterClass="hashtable">
update users set <include refid="sql.up"></include>
,email =case when #email# is null and #email# &gt; 80 then null when #email# is not null then HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>)) else email end
,mobile =HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>))
,asno =#asno#
,userpno =case when #userpno# is not null then HEX(AES_ENCRYPT(#userpno#, <include refid="sql.digest"></include>)) else null end
2021-05-21 17:44:46 +09:00
,post =case when #upost# is not null then #upost# else post end
,address1 =case when #uaddress1# is not null then #uaddress1# else address1 end
,address2 =case when #uaddress2# is not null then #uaddress2# else address2 end
<isNotEmpty property="uduty">,uduty = #uduty#</isNotEmpty>
2020-11-06 18:04:55 +09:00
,slevel = #slevel#
,isassignuser = #isassignuser#
where userno=#userno#
</update>
2020-11-09 13:29:54 +09:00
<select id="cm.lectcheckuser" parameterClass="hashtable" resultClass="int">
2021-08-23 15:10:15 +09:00
select count(c.lectno)
from cm a
left outer join cm b on b.pcmno = a.pcmno
left outer join lect c on c.cmno = b.cmno and c.userno = #userno#
where b.isdel=0
and (c.iscomplete = 1 or (c.status &lt; 5 or c.status = 6))
<isNotNull property="cmno">and a.cmno = #cmno# </isNotNull>
<isNotEmpty property="cmnos">and a.cmno in ($cmnos$)</isNotEmpty>
2020-11-09 13:29:54 +09:00
</select>
2020-11-11 16:26:18 +09:00
<select id="cm.cminningscdcheck" parameterClass="hashtable" resultClass="int">
select
a.quota - (select count(z.lectno) cnt from lect z where a.cmisno = z.cmisno and z.status in (1,2) and z.ischanged=0)
2020-11-11 16:26:18 +09:00
from cminningscd a
where a.cmisno = #cmisno#
</select>
<!--교육장 변경건 적용-->
2020-11-11 16:26:18 +09:00
<update id="cm.lectcmisno.up" parameterClass="hashtable">
update lect set <include refid="sql.up"></include>
,cmisno =case when #cmisno# is not null then #cmisno# else cmisno end
2021-08-23 15:10:15 +09:00
where lectno=#lectno#;
2021-11-03 15:19:08 +09:00
2021-08-23 15:10:15 +09:00
update pplog a
left outer join (
2021-11-03 15:19:08 +09:00
select a.lectno,a.payno,b.pplno,a.cmisno
from lect a
inner join pay b on b.payno = a.payno
where a.lectno = #lectno#
) b on b.pplno = a.pplno
2021-08-23 15:10:15 +09:00
set a.cmisno = case when b.cmisno is not null then b.cmisno else a.cmisno end
where b.lectno = #lectno#;
2021-11-03 15:19:08 +09:00
update lect a
left outer join cminningscd b on b.cmisno = a.cmisno
left outer join cm c on a.cmno = c.cmno
set a.edate = case when b.eend is not null then date_format(b.eend,'%Y-%m-%d 23:59:59') else a.edate end
,a.sdate = (case when b.estart is not null then date_format(b.estart,'%Y-%m-%d 00:00:00') else a.sdate end)
where a.lectno = #lectno# and c.cshape = 1;
update lect a
left outer join cminningscd b on b.cmisno = a.cmisno
left outer join cm c on a.cmno = c.cmno
set a.edate = case when b.eend is not null then date_format(b.eend,'%Y-%m-%d 23:59:59') else a.edate end
where a.lectno = #lectno# and c.cshape &lt;&gt; 1;
2020-11-11 16:26:18 +09:00
</update>
<!--종료일 변경건 적용-->
<!--<update id="cm.lectcmisno.up2" parameterClass="hashtable">
update lect set <include refid="sql.up"></include>
,cmisno =case when #cmisno# is not null then #cmisno# else cmisno end
where lectno=#lectno#;
update pplog a
left outer join (
select a.lectno,a.payno,b.pplno,a.cmisno
from lect a
inner join pay b on b.payno = a.payno
where a.lectno = #lectno#
) b on b.pplno = a.pplno
set a.cmisno = case when b.cmisno is not null then b.cmisno else a.cmisno end
where b.lectno = #lectno#;
update lect a
left outer join cminningscd b on b.cmisno = a.cmisno
set a.edate = case when b.eend is not null then date_format(b.eend,'%Y-%m-%d 23:59:59') else a.edate end
where a.lectno = #lectno#;
</update>-->
2020-12-09 16:57:47 +09:00
<select id="cm.cms.offs" parameterClass="hashtable" resultClass="cm">
select
a.cmno,a.ismaster,a.cgno,a.pcmno,a.cname,a.kname,a.tmno,a.classno,a.rstime,a.retime,a.sstime,a.setime,a.gstime,a.getime,a.cshape,a.typeman,a.typeedu,a.typegrade
2021-01-05 14:19:50 +09:00
,a.typejob,a.infee,a.outfee,a.accommofee,a.quota,a.introhtml,a.targethtml,a.goalhtml,a.contenthtml,a.studyplace,a.studytime,a.certcc,a.certgradecc,a.jobcc,a.jobpositiongrade,a.difficulty
2020-12-09 16:57:47 +09:00
,a.isrefund,a.isuse,a.isseq,a.isdel,a.fgnocm,a.iscertificate,a.ischkatt
,(select count(l.lectno) cnt from lect l where l.cmno = a.cmno and l.status =1 and l.ischanged=0) lectcnt
from cm a
2020-12-10 15:19:50 +09:00
where a.ismaster=0 and a.isuse=1 and a.isdel=0 and a.cshape = 1
2020-12-09 16:57:47 +09:00
<isNotNull property="cmno">and a.cmno=#cmno#</isNotNull>
<isNotNull property="year">and year(a.sstime)=#year#</isNotNull>
order by a.sstime,a.setime
</select>
2020-10-12 14:39:23 +09:00
</statements>
</sqlMap>