YNICTE/BO/bin/MyBatis/Maps/System.xml

1405 lines
64 KiB
XML
Raw Permalink Normal View History

2025-12-11 13:52:25 +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="menus" type="NP.Model.Menu, NP.Model" />
<typeAlias alias="excellog" type="NP.Model.excellog, NP.Model" />
<typeAlias alias="comcode" type="NP.Model.ComCode, NP.Model" />
<typeAlias alias="file" type="NP.Model.File, NP.Model" />
<typeAlias alias="ncs" type="NP.Model.NCS, NP.Model" />
<typeAlias alias="actlog" type="NP.Model.ActLog, NP.Model" />
<typeAlias alias="cmlect" type="NP.Model.CMLect, NP.Model" />
<typeAlias alias="cmcalc" type="NP.Model.CMCalc, NP.Model" />
<typeAlias alias="okcert3" type="NP.Model.OkCert3Item, NP.Model" />
</alias>
<cacheModels>
<cacheModel id="systemcache" implementation="LRU" >
<flushInterval hours="1" />
<property name="CacheSize" value="1000" />
</cacheModel>
</cacheModels>
<!--<parametermaps></parametermaps>-->
<resultMaps></resultMaps>
<statements>
<select id ="sys.menu.auths" parameterClass="hashtable" resultClass="userauth">
select distinct usertype,authname
,usertype value,authname text
from menuauth
where isdel=0
<isNotEmpty property="usertypes" prepend="and">usertype in ($usertypes$)</isNotEmpty>
<isNotNull property="isadminprof" prepend="and">usertype &gt; 10</isNotNull>
<isNotNull property="isadmin" prepend="and">usertype &gt; 80</isNotNull>
</select>
<update id="sys.userauth.save" parameterClass ="hashtable">
insert into menuauth (usertype,authname,menuno,isdel,<include refid="sql.inc"></include>)
select max(usertype)+1,#authname#,1,0,<include refid="sql.inv"></include>
from menuauth
</update>
<update id ="sys.authname.save" parameterClass="hashtable">
update menuauth
set authname=#authname#
where usertype=#usertype#
</update>
<update id="sys.userauth.del" parameterClass="hashtable">
delete a
from menuauth a
left outer join(
select count(userno) usercnt,usertype
from users
where usertype = #usertype#
group by usertype
)b on b.usertype = a.usertype
where a.usertype = #usertype# and (b.usercnt &lt; 1 or b.usercnt is null);
insert into menuauth (usertype,authname,menuno,isdel,cdt,cno,udt,uno,uip)
select *
from (
select #usertype# usertype,#authname# authname,1 menuno,0 isdel,now() cdt,#uno# cno,now() udt,#uno# uno,#uip# uip
) a
where not exists(
select usertype,authname,menuno
from menuauth
where usertype = #usertype# and menuno = 1
);
update menuauth a
left outer join (
select count(userno) usercnt,usertype
from users
where usertype = #usertype# and status=1
group by usertype
) b on b.usertype = a.usertype
set isdel=1
where a.usertype=#usertype# and (b.usercnt &lt; 1 or b.usercnt is null);
</update>
<select id="sys.menu.menuauth" parameterClass="Hashtable" resultClass="menus">
<!--권한매핑된메뉴-->
select a.usertype, a.menuno, a.menuname, a.pmenuno, a.menuurl, a.menulevel, a.menuorder, a.ccount, a.isuse, a.ishid
,concat('/',ifnull(b5.menuno, 0), '/', ifnull(b4.menuno, 0), '/', ifnull(b3.menuno, 0), '/', ifnull(b2.menuno, 0), '/', ifnull(b1.menuno, 0), '/', ifnull(a.menuno, 0), '/') menurout
,case a.menulevel when 0 then ' ' when 1 then b1.menuname when 2 then b2.menuname when 3 then b3.menuname when 4 then b4.menuname when 5 then b5.menuname end pmenuname
,b2.menuno ppmenuno
from (
select b.usertype, c.menuno, c.menuname, c.pmenuno, c.menuurl, c.menulevel, c.menuorder, count(d.menuno) ccount, c.isuse, c.ishid
from menuauth b
inner join menu c on c.menuno=b.menuno and c.isuse=1
left outer join menu d on d.pmenuno=c.menuno
group by b.usertype, c.menuno, c.menuname, c.pmenuno, c.menuurl, c.menulevel, c.menuorder, c.isuse, c.ishid
) a
left outer join menu b1 on b1.menuno=a.pmenuno
left outer join menu b2 on b2.menuno=b1.pmenuno
left outer join menu b3 on b3.menuno=b2.pmenuno
left outer join menu b4 on b4.menuno=b3.pmenuno
left outer join menu b5 on b5.menuno=b4.pmenuno
<dynamic prepend="where">
<isNotNull property="topmenuno" prepend="and">#topmenuno# = case a.menulevel when 0 then a.menuno when 1 then b1.menuno when 2 then b2.menuno when 3 then b3.menuno when 4 then b4.menuno else b5.menuno end</isNotNull>
</dynamic>
order by a.usertype,
case a.menulevel when 0 then a.menuorder when 1 then b1.menuorder when 2 then b2.menuorder when 3 then b3.menuorder when 4 then b4.menuorder else b5.menuorder end
,case a.menulevel when 0 then a.menuno when 1 then b1.menuno when 2 then b2.menuno when 3 then b3.menuno when 4 then b4.menuno else b5.menuno end
,case a.menulevel when 1 then a.menuorder when 2 then b1.menuorder when 3 then b2.menuorder when 4 then b3.menuorder when 5 then b4.menuorder else 0 end
,case a.menulevel when 1 then a.menuno when 2 then b1.menuno when 3 then b2.menuno when 4 then b3.menuno when 5 then b4.menuno else 0 end
,case a.menulevel when 2 then a.menuorder when 3 then b1.menuorder when 4 then b2.menuorder when 5 then b3.menuorder else 0 end
,case a.menulevel when 2 then a.menuno when 3 then b1.menuno when 4 then b2.menuno when 5 then b3.menuno else 0 end
,case a.menulevel when 3 then a.menuorder when 4 then b1.menuorder when 5 then b2.menuorder else 0 end
,case a.menulevel when 3 then a.menuno when 4 then b1.menuno when 5 then b2.menuno else 0 end
,case a.menulevel when 4 then a.menuorder when 5 then b1.menuorder else 0 end
,case a.menulevel when 4 then a.menuno when 5 then b1.menuno else 0 end
,case a.menulevel when 5 then a.menuorder else 0 end
,case a.menulevel when 5 then a.menuno else 0 end
</select>
<select id="sys.comcode.list" parameterClass="hashtable" resultClass="comcode">
select a.ccode, a.cname, a.cgroup, a.isuse, a.corder, a.cgroupname, a.refcode, a.cremark, a.ccode value, a.cname text, a.refcode value2,a.cdt,a.udt
from comcode a
<dynamic prepend="where">
<isNotNull property="ccode" prepend="and">a.ccode=#ccode#</isNotNull>
<isNotNull property="ccodes" prepend="and">a.ccode in ($ccodes$)</isNotNull>
<isNotNull property="cgroup" prepend="and">a.cgroup=#cgroup#</isNotNull>
<isNotNull property="cgroups" prepend="and">a.cgroup in ($cgroups$)</isNotNull>
<isNotNull property="refcode" prepend="and">a.refcode=#refcode#</isNotNull>
<isNotNull property="isuse" prepend="and">a.isuse=#isuse#</isNotNull>
<isNotNull property="cnamelike" prepend="and">a.cname like concat('%', #cnamelike#,'%')</isNotNull>
<isNull property="all" prepend="and">a.isuse=1</isNull>
</dynamic>
<isNotNull property="orderby">order by $orderby$</isNotNull>
<isNull property="orderby">order by a.cgroupname, a.corder</isNull>
</select>
<select id="sys.comcode.glist" parameterClass="string" resultClass="comcode">
select cgroup, cgroup value, cgroupname, cgroupname text, count(cgroup) ccount
from comcode
<dynamic prepend="where">
<isNotNull property="isuse" prepend="and">isuse=#isuse#</isNotNull>
</dynamic>
group by cgroup, cgroupname
<isNotNull property="orderby">order by $orderby$</isNotNull>
</select>
<select id="sys.menu.list" parameterClass="Hashtable" resultClass="menus">
select a.menuno, a.menuname, a.pmenuno, a.menuurl, a.menulevel, a.menuorder, a.ccount, a.isuse, a.ishid
,concat('/',ifnull(b5.menuno, 0), '/', ifnull(b4.menuno, 0), '/', ifnull(b3.menuno, 0), '/', ifnull(b2.menuno, 0), '/', ifnull(b1.menuno, 0), '/', ifnull(a.menuno, 0), '/') menurout
,case a.menulevel when 0 then ' ' when 1 then b1.menuname when 2 then b2.menuname when 3 then b3.menuname when 4 then b4.menuname when 5 then b5.menuname end pmenuname
from (
select a.menuno, a.menuname, a.pmenuno, a.menuurl, a.menulevel, a.menuorder, count(d.menuno) ccount, a.isuse, a.ishid
from menu a
left outer join menu d on d.pmenuno=a.menuno
group by a.menuno, a.menuname, a.pmenuno, a.menuurl, a.menulevel, a.menuorder, a.isuse, a.ishid
) a
left outer join menu b1 on b1.menuno=a.pmenuno
left outer join menu b2 on b2.menuno=b1.pmenuno
left outer join menu b3 on b3.menuno=b2.pmenuno
left outer join menu b4 on b4.menuno=b3.pmenuno
left outer join menu b5 on b5.menuno=b4.pmenuno
order by
case a.menulevel when 0 then a.menuorder when 1 then b1.menuorder when 2 then b2.menuorder when 3 then b3.menuorder when 4 then b4.menuorder else b5.menuorder end
,case a.menulevel when 0 then a.menuno when 1 then b1.menuno when 2 then b2.menuno when 3 then b3.menuno when 4 then b4.menuno else b5.menuno end
,case a.menulevel when 1 then a.menuorder when 2 then b1.menuorder when 3 then b2.menuorder when 4 then b3.menuorder when 5 then b4.menuorder else 0 end
,case a.menulevel when 1 then a.menuno when 2 then b1.menuno when 3 then b2.menuno when 4 then b3.menuno when 5 then b4.menuno else 0 end
,case a.menulevel when 2 then a.menuorder when 3 then b1.menuorder when 4 then b2.menuorder when 5 then b3.menuorder else 0 end
,case a.menulevel when 2 then a.menuno when 3 then b1.menuno when 4 then b2.menuno when 5 then b3.menuno else 0 end
,case a.menulevel when 3 then a.menuorder when 4 then b1.menuorder when 5 then b2.menuorder else 0 end
,case a.menulevel when 3 then a.menuno when 4 then b1.menuno when 5 then b2.menuno else 0 end
,case a.menulevel when 4 then a.menuorder when 5 then b1.menuorder else 0 end
,case a.menulevel when 4 then a.menuno when 5 then b1.menuno else 0 end
,case a.menulevel when 5 then a.menuorder else 0 end
,case a.menulevel when 5 then a.menuno else 0 end
</select>
<update id="sys.menu.chageposition" parameterClass="menus">
update menu a
left outer join menu b on b.menuno=#menuorder#
left outer join menu c on c.menuno=#pmenuno#
set a.pmenuno=#pmenuno#, a.menuorder = ifnull(b.menuorder, -1) + 1, a.menulevel=c.menulevel + 1
, a.udt=<include refid="sql.now"></include>, a.uno=#uno#, a.uip=#uip#
where a.menuno=#menuno#
</update>
<update id="sys.menu.update" parameterClass="menus">
update menu a
left outer join (select menulevel from menu where menuno=#pmenuno#) b on 1 = 1
set udt=<include refid="sql.now"></include>, uno=#uno#, uip=#uip#
,menuname=#menuname#, pmenuno=#pmenuno#, menuurl=ifnull(#menuurl#, ''),a.menulevel=b.menulevel + 1,menuorder=#menuorder#,isuse=#isuse#,ishid=#ishid#
where a.menuno=#menuno#;
</update>
<insert id="sys.menu.insert" parameterClass="menus">
insert into menu(menuname,pmenuno,menuurl,menulevel,menuorder,isuse,ishid,<include refid="sql.inc"></include>)
select #menuname#,#pmenuno#,ifnull(#menuurl#,''),ifnull(c.menulevel, -1) + 1,#menuorder#,#isuse#,#ishid#,<include refid="sql.inv"></include>
from (select #menuno# menuno) a
left outer join menu b on b.menuno=a.menuno
left outer join menu c on c.menuno=#pmenuno#
where b.menuno is null
<selectKey type="post" property="menuno" resultClass="int">select last_insert_id()</selectKey>
</insert>
<update id="sys.menu.delete" parameterClass="int">
delete from menuauth where menuno=#no#;
delete from menu where menuno=#no#
</update>
<update id="sys.authmenu.save" parameterClass="menus">
delete from menuauth where usertype=#usertype# and menuno not in ($menunos$);
insert into menuauth (menuno, usertype,authname,isdel,<include refid="sql.inc"></include>)
select a.menuno,#usertype#,#authname#,#isdel#,<include refid="sql.inv"></include>
from menu a
left outer join menuauth b on b.usertype=#usertype# and b.menuno=a.menuno
where a.menuno in ($menunos$) and b.menuno is null
</update>
<select id="sys.authmenu" parameterClass="int" resultClass="menus">
select a.usertype, a.menuno
from menuauth a
where a.usertype=#usertype#
</select>
<select id="sys.menu" parameterClass="Hashtable" resultClass="menus">
select a.menuno, a.menuname, a.pmenuno, a.menuurl, a.menulevel, a.menuorder, a.ccount, a.isuse, a.ishid
,concat('/',ifnull(b5.menuno, 0), '/', ifnull(b4.menuno, 0), '/', ifnull(b3.menuno, 0), '/', ifnull(b2.menuno, 0), '/', ifnull(b1.menuno, 0), '/', ifnull(a.menuno, 0), '/') menurout
,case a.menulevel when 0 then ' ' when 1 then b1.menuname when 2 then b2.menuname when 3 then b3.menuname when 4 then b4.menuname when 5 then b5.menuname end pmenuname
from (
select c.menuno, c.menuname, c.pmenuno, c.menuurl, c.menulevel, c.menuorder, count(d.menuno) ccount, c.isuse, c.ishid
from menu c
left outer join menu d on d.pmenuno=c.menuno
<dynamic prepend="where">
<isNotNull property="menuno" prepend="and">c.menuno=#menuno#</isNotNull>
</dynamic>
group by c.menuno, c.menuname, c.pmenuno, c.menuurl, c.menulevel, c.menuorder, c.isuse, c.ishid
) a
left outer join menu b1 on b1.menuno=a.pmenuno
left outer join menu b2 on b2.menuno=b1.pmenuno
left outer join menu b3 on b3.menuno=b2.pmenuno
left outer join menu b4 on b4.menuno=b3.pmenuno
left outer join menu b5 on b5.menuno=b4.pmenuno
</select>
<select id="cm.ncses0" parameterClass="hashtable" resultClass="ncs">
select a.*
from (
select a.ntno,a.tcode,a.tname,a.ntype
,a.ntno value,concat(a.tname,'(',a.tcode,')') text
,a.tcode acode,a.ntno ncsno,a.tname ncsname
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.tname</isNull>) rno
,count(a.cdt) over() pagetotalcount
from ncst a
<dynamic prepend="where">
<isNotNull property="ncsname" prepend="and">a.tname like concat('%',#ncsname#, '%')</isNotNull>
<isNotNull property="ntype" prepend="and">a.ntype=#ntype#</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.ncses1" parameterClass="hashtable" resultClass="ncs">
select a.*
from (
select a.nmno,a.mcode,a.mname,a.acode
,a.nmno ncsno,a.mname ncsname
,t.ntno,t.tname
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.mname</isNull>) rno
,count(a.cdt) over() pagetotalcount
from ncsm a
inner join ncst t on t.ntno=a.ntno
<dynamic prepend="where">
<isNotNull property="ncsname" prepend="and">a.mname like concat('%',#ncsname#, '%')</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.ncses2" parameterClass="hashtable" resultClass="ncs">
select a.*
from (
select a.nbno,a.bcode,a.bname,a.acode
,a.nbno ncsno,a.bname ncsname
,m.nmno,m.mname
,t.ntno,t.tname
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.bname</isNull>) rno
,count(a.cdt) over() pagetotalcount
from ncsb a
inner join ncsm m on m.nmno=a.nmno
inner join ncst t on t.ntno=m.ntno
<dynamic prepend="where">
<isNotNull property="ncsname" prepend="and">a.bname like concat('%',#ncsname#, '%')</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.ncses3" parameterClass="hashtable" resultClass="ncs">
select a.*
from (
select a.ndno,a.dname,a.acode
,a.ndno ncsno,a.dname ncsname,a.dcode
,b.nbno,b.bname,b.bcode
,m.nmno,m.mname,m.mcode
,t.ntno,t.tname,t.tcode
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.dname</isNull>) rno
,count(a.cdt) over() pagetotalcount
from ncsd a
inner join ncsb b on b.nbno=a.nbno
inner join ncsm m on m.nmno=b.nmno
inner join ncst t on t.ntno=m.ntno
<dynamic prepend="where">
<isNotNull property="ncsname" prepend="and">a.dname like concat('%',#ncsname#, '%')</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="sys.file.getbygroup" parameterClass="hashtable" resultClass="file">
select a.fileno,a.fgno,a.orgname,a.fileurl,a.filesize,a.extension,a.dcount,a.cdt
from fileinfo a
where a.isdel=0
<isNotNull property="fgno">and a.FGNo=#fgno#</isNotNull>
<isNotNull property="fgnos">and a.FGNo in ($fgnos$)</isNotNull>
</select>
<insert id="sys.filegroup.insert" parameterClass="file">
INSERT INTO filegroup (tablename,columnname, <include refid="sql.inc"></include>) VALUES (#tablename#, #columnname#, <include refid="sql.inc"></include>)
<selectKey type="post" property="fgno" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="sys.filegroup.save" parameterClass="file">
INSERT INTO fileinfo (fgno, orgname, fileurl, filesize, extension, dcount, isdel, <include refid="sql.inc"></include>)
values
<iterate property="Files" conjunction="," open="" close="">
(#fgno#, #Files[].orgname#, #Files[].fileurl#, #Files[].filesize#, #Files[].extension#, 0, 0, <include refid="sql.now"></include>,#uno#,<include refid="sql.now"></include>,#uno#,#uip#)
</iterate>
</update>
<update id="sys.file.down" parameterClass="long">
update fileinfo set dcount = dcount + 1 where fileno=#fileno#
</update>
<select id="sys.file.get" parameterClass="long" resultClass="file">
select a.fileno,a.fgno,a.orgname,a.fileurl,a.filesize,a.extension,a.dcount,a.cno,a.uno
,b.tablename,b.columnname
from fileinfo a
inner join filegroup b on b.fgno=a.fgno
where a.FileNo = #fileno# and a.isdel = 0
</select>
<select id="sys.file.getall" parameterClass="long" resultClass="file">
select a.fileno,a.fgno,a.orgname,a.fileurl,a.filesize,a.extension,a.dcount,a.cno,a.uno
,b.tablename,b.columnname
from fileinfo a
inner join filegroup b on b.fgno=a.fgno
where a.FileNo = #fileno#
</select>
<update id="sys.file.del" parameterClass="hashtable">
update fileinfo set uip=#uip#, uno=#uno#, isdel=1 where fileno=#fileno# and (#isadmin# = 1 or #uno# = -999 or cno=#uno#)
</update>
<update id="sys.file.del2" parameterClass="hashtable">
update fileinfo set uip=#uip#, uno=#uno#, isdel=1 where fgno=#fgno# and (#isadmin# = 1 or #uno# = -999 or cno=#uno#)
</update>
<update id="sys.file.copy" parameterClass="hashtable">
insert into fileinfo (fgno,orgname,fileurl,filesize,extension,dcount,isdel,<include refid="sql.inc"></include>)
select #nfgno#,a.orgname,concat(substr(a.fileurl,1,instr(a.fileurl,'.')-1),'_$copytype$_',#uno#,'_',#nfgno#, substr(a.fileurl,instr(a.fileurl,'.'))),filesize,extension,dcount,isdel,<include refid="sql.inc"></include>
from fileinfo a
where a.fgno=#ofgno# and a.isdel=0
</update>
<!--<select id="cm.ncss" parameterClass="hashtable" resultClass="ncs">
select a.*
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.ndepth,a.ncscode</isNull>) rno
,count(a.ncsno) over() pagetotalcount
from (
select 0 ndepth,a.ntno ncsno,a.tcode ncscode,a.tname ncsname
from ncst a
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(a.tcode = #codename# or a.tname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
union all
select 1 ndepth,a.nmno ncsno,a.mcode ncscode,a.mname ncsname
from ncsm a
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(a.mcode = #codename# or a.mname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
union all
select 2 ndepth,a.nbno ncsno,a.bcode ncscode,a.bname ncsname
from ncsb a
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(a.bcode = #codename# or a.bname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
union all
select 3 ndepth,a.ndno ncsno,a.dcode ncscode,a.dname ncsname
from ncsd a
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(a.dcode = #codename# or a.dname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
union all
select 4 ndepth,a.nuno ncsno,a.ucode ncscode,a.uname ncsname
from ncsu a
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(a.ucode = #codename# or a.uname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
)
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>-->
<select id="cm.ncs.ncss" parameterClass="hashtable" resultClass="ncs">
select g.ntno,f.nmno,d.nbno,c.ndno,b.nuno
from ncst g
left outer join ncsm f on f.ntno=g.ntno
left outer join ncsb d on d.nmno=f.nmno
left outer join ncsd c on c.nbno=d.nbno
left outer join ncsu b on b.ndno=c.nbno
<dynamic prepend="where">
<isNotNull property="ncst" prepend="and">g.ntno=#ncst#</isNotNull>
<isNotNull property="ncsm" prepend="and">f.nmno=#ncsm#</isNotNull>
<isNotNull property="ncsb" prepend="and">d.nbno=#ncsb#</isNotNull>
<isNotNull property="ncsd" prepend="and">c.ndno=#ncsd#</isNotNull>
</dynamic>
group by c.ndno,d.nbno,f.nmno,g.ntno
</select>
<select id="cm.ncs.U" parameterClass="hashtable" resultClass="ncs">
select 4 ndepth,a.*
from (
select a.nuno,a.ucode,a.uname
,b.ndno,b.dcode,b.dname,b.acode dacode
,c.nbno,c.bcode,c.bname,c.acode bacode
,d.nmno,d.mcode,d.mname,d.acode macode
,e.ntno,e.tcode,e.tname,e.ntype
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.ucode</isNull>) rno
,count(a.cdt) over() pagetotalcount
from ncsu a
inner join ncsd b on b.ndno=a.ndno
inner join ncsb c on c.nbno=b.nbno
inner join ncsm d on d.nmno=c.nmno
inner join ncst e on e.ntno=d.ntno
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(a.ucode = #codename# or a.uname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.ncs.D" parameterClass="hashtable" resultClass="ncs">
select 3 ndepth,a.*
from (
select b.ndno,b.dcode,b.dname,b.acode dacode
,c.nbno,c.bcode,c.bname,c.acode bacode
,d.nmno,d.mcode,d.mname,d.acode macode
,e.ntno,e.tcode,e.tname,e.ntype
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">b.dcode</isNull>) rno
,count(b.cdt) over() pagetotalcount
from ncsd b
inner join ncsb c on c.nbno=b.nbno
inner join ncsm d on d.nmno=c.nmno
inner join ncst e on e.ntno=d.ntno
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(b.dcode = #codename# or b.dname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.ncs.B" parameterClass="hashtable" resultClass="ncs">
select 2 ndepth,a.*
from (
select c.nbno,c.bcode,c.bname,c.acode bacode
,d.nmno,d.mcode,d.mname,d.acode macode
,e.ntno,e.tcode,e.tname,e.ntype
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">c.bcode</isNull>) rno
,count(c.cdt) over() pagetotalcount
from ncsb c
inner join ncsm d on d.nmno=c.nmno
inner join ncst e on e.ntno=d.ntno
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(c.bcode = #codename# or c.bname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.ncs.M" parameterClass="hashtable" resultClass="ncs">
select 1 ndepth,a.*
from (
select d.nmno,d.mcode,d.mname,d.acode macode
,e.ntno,e.tcode,e.tname,e.ntype
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">d.mcode</isNull>) rno
,count(d.cdt) over() pagetotalcount
from ncsm d
inner join ncst e on e.ntno=d.ntno
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(d.mcode = #codename# or d.mname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.ncs.T" parameterClass="hashtable" resultClass="ncs">
select 0 ndepth,a.*
from (
select e.ntno,e.tcode,e.tname,e.ntype
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">e.tcode</isNull>) rno
,count(e.cdt) over() pagetotalcount
from ncst e
<dynamic prepend="where">
<isNotNull property="codename" prepend="and">(e.tcode = #codename# or e.tname like concat('%',#codename#,'%'))</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.ncst.check" parameterClass="ncs" resultClass="int">
select count(b.ntno)
from (select 1 col1) a
left outer join ncst b
<dynamic prepend="on">
<isNotNull property="notno" prepend="and">b.ntno&lt;&gt;#notno#</isNotNull>
<isNotNull property="ntype" prepend="and">b.ntype=#ntype#</isNotNull>
<isNotNull property="ncscode" prepend="and">b.tcode=#ncscode#</isNotNull>
</dynamic>
</select>
<select id="cm.ncs.check" parameterClass="ncs" resultClass="int">
select count(b.n$ndepthname$no)
from (select 1 col1) a
left outer join ncs$ndepthname$ b
<dynamic prepend="on">
<isNotNull property="notno" prepend="and">b.n$ndepthname$no&lt;&gt;#notno#</isNotNull>
<isNotNull property="pno" prepend="and">b.n$pndepthname$no=#pno#</isNotNull>
<isNotNull property="ncscode" prepend="and">b.$ndepthname$code=#ncscode#</isNotNull>
</dynamic>
</select>
<select id="cm.ncs.hierarchy" parameterClass="hashtable" resultClass="string">
<isEqual property="ndepth" compareValue="1">
select tcode from ncst where ntno=#pno#
</isEqual>
<isEqual property="ndepth" compareValue="2">
select concat(b.tcode,a.mcode)
from ncsm a
inner join ncst b on b.ntno=a.ntno
where a.nmno=#pno#
</isEqual>
<isEqual property="ndepth" compareValue="3">
select concat(c.tcode,b.mcode,a.bcode)
from ncsb a
inner join ncsm b on b.nmno=a.nmno
inner join ncst c on c.ntno=b.ntno
where a.nbno=#pno#
</isEqual>
</select>
<update id="cm.ncst.in" parameterClass="ncs">
insert into ncst (ntype,tcode,tname,<include refid="sql.inc"></include>)
values (#ntype#,#ncscode#,#ncsname#,<include refid="sql.inv"></include>)
</update>
<update id="cm.ncst.up" parameterClass="ncs">
update ncst set <include refid="sql.up"></include>
,tcode=#ncscode#,tname=#ncsname#
where ntno=#ncsno#
</update>
<update id="cm.ncs.in" parameterClass="ncs">
insert into ncs$ndepthname$ (n$pndepthname$no,$ndepthname$code,$ndepthname$name,acode,<include refid="sql.inc"></include>)
values (#pno#,#ncscode#,#ncsname#,#acode#,<include refid="sql.inv"></include>)
</update>
<update id="cm.ncs.up" parameterClass="ncs">
update ncs$ndepthname$ set <include refid="sql.up"></include>
,$ndepthname$code=#ncscode#,$ndepthname$name=#ncsname#,acode=#acode#
where n$ndepthname$no=#ncsno#
</update>
<update id="cm.ncs.del" parameterClass="ncs">
delete from ncs$ndepthname$ where n$ndepthname$no=#ncsno#
</update>
<update id="cm.ncs.del2" parameterClass="hashtable">
<isNotNull property="nunos">
delete from ncsu where nuno in ($nunos$);
</isNotNull>
<isNotNull property="ndnos">
delete from ncsd where ndno in ($nunos$);
</isNotNull>
<isNotNull property="nbnos">
delete from ncsb where nbno in ($nunos$);
</isNotNull>
<isNotNull property="nmnos">
delete from ncsm where nmno in ($nunos$);
</isNotNull>
delete from ncs$ndepthname$ where n$ndepthname$no=#ncsno#;
</update>
<select id="cm.ncs.child" parameterClass="ncs" resultClass="ncs">
select n$ndepthname$no,$ndepthname$name,acode
,n$ndepthname$no value,$ndepthname$name text
,$ndepthname$code ncscode
from ncs$ndepthname$ where n$pndepthname$no=#pno#
</select>
<select id="cm.ncs.union.check" parameterClass="hashtable" resultClass="ncs">
select distinct(a.cmno),b.ndno cmndno,c.ndno ncsdno,d.nbno,f.nmno,g.ntno
from cm a
inner join cmncsd b on b.cmno=a.cmno
inner join ncsd c on c.ndno=b.ndno
left outer join ncsb d on d.nbno=c.nbno
left outer join ncsm f on f.nmno=d.nmno
left outer join ncst g on g.ntno=f.ntno
where a.isdel=0 and a.isrefund=1
<isNotNull property="ncst">and g.ntno=#ncst#</isNotNull>
<isNotNull property="ncsm">and f.nmno=#ncsm#</isNotNull>
<isNotNull property="ncsb">and d.nbno=#ncsb#</isNotNull>
<isNotNull property="ncsd">and c.ndno=#ncsd#</isNotNull>
group by a.cmno,b.ndno,c.ndno,d.nbno,f.nmno,g.ntno
</select>
<select id="cm.ncst.get" parameterClass="ncs" resultClass="ncs">
select ntno ncsno,tname ncsname,tcode ncscode,ntype pno,#ndepth# ndepth
,ntno value
,tname text
from ncs$ndepthname$
where n$ndepthname$no=#ncsno#
</select>
<select id="cm.ncs.get" parameterClass="ncs" resultClass="ncs">
select n$ndepthname$no ncsno,$ndepthname$name ncsname,$ndepthname$code ncscode,n$pndepthname$no pno,#ndepth# ndepth
,n$ndepthname$no value
,$ndepthname$name text
from ncs$ndepthname$
where n$ndepthname$no=#ncsno#
</select>
<select id="cm.ncs.parents.u" parameterClass="hashtable" resultClass="ncs">
select 3 ndepth,v.ndno ncsno,v.dname ncsname,v.dcode ncscode,case when v.ndno=u.ndno then 1 else 0 end isact
from ncsu u
inner join ncsd d on d.ndno=u.ndno
inner join ncsd v on v.nbno=d.nbno
where u.nuno=#ncsno#
union all
select 2 ndepth,v.nbno ncsno,v.bname ncsname,v.bcode ncscode,case when v.nbno=b.nbno then 1 else 0 end isact
from ncsu u
inner join ncsd d on d.ndno=u.ndno
inner join ncsb b on b.nbno=d.nbno
inner join ncsb v on v.nmno=b.nmno
where u.nuno=#ncsno#
union all
select 1 ndepth,v.nmno ncsno,v.mname ncsname,v.mcode ncscode,case when v.nmno=m.nmno then 1 else 0 end isact
from ncsu u
inner join ncsd d on d.ndno=u.ndno
inner join ncsb b on b.nbno=d.nbno
inner join ncsm m on m.nmno=b.nmno
inner join ncsm v on v.ntno=m.ntno
where u.nuno=#ncsno#
union all
select 0 ndepth,v.ntno ncsno,v.tname ncsname,v.tcode ncscode,case when v.ntno=t.ntno then 1 else 0 end isact
from ncsu u
inner join ncsd d on d.ndno=u.ndno
inner join ncsb b on b.nbno=d.nbno
inner join ncsm m on m.nmno=b.nmno
inner join ncst t on t.ntno=m.ntno
inner join ncst v on v.ntype=t.ntype
where u.nuno=#ncsno#
order by ndepth,ncscode
</select>
<select id="cm.ncs.parents.d" parameterClass="hashtable" resultClass="ncs">
select 2 ndepth,v.nbno ncsno,v.bname ncsname,v.bcode ncscode,case when v.nbno=b.nbno then 1 else 0 end isact
from ncsd d
inner join ncsb b on b.nbno=d.nbno
inner join ncsb v on v.nmno=b.nmno
where d.ndno=#ncsno#
union all
select 1 ndepth,v.nmno ncsno,v.mname ncsname,v.mcode ncscode,case when v.nmno=m.nmno then 1 else 0 end isact
from ncsd d
inner join ncsb b on b.nbno=d.nbno
inner join ncsm m on m.nmno=b.nmno
inner join ncsm v on v.ntno=m.ntno
where d.ndno=#ncsno#
union all
select 0 ndepth,v.ntno ncsno,v.tname ncsname,v.tcode ncscode,case when v.ntno=t.ntno then 1 else 0 end isact
from ncsd d
inner join ncsb b on b.nbno=d.nbno
inner join ncsm m on m.nmno=b.nmno
inner join ncst t on t.ntno=m.ntno
inner join ncst v on v.ntype=t.ntype
where d.ndno=#ncsno#
order by ndepth,ncscode
</select>
<select id="cm.ncs.parents.b" parameterClass="hashtable" resultClass="ncs">
select 1 ndepth,v.nmno ncsno,v.mname ncsname,v.mcode ncscode,case when v.nmno=m.nmno then 1 else 0 end isact
from ncsb b
inner join ncsm m on m.nmno=b.nmno
inner join ncsm v on v.ntno=m.ntno
where b.nbno=#ncsno#
union all
select 0 ndepth,v.ntno ncsno,v.tname ncsname,v.tcode ncscode,case when v.ntno=t.ntno then 1 else 0 end isact
from ncsb b
inner join ncsm m on m.nmno=b.nmno
inner join ncst t on t.ntno=m.ntno
inner join ncst v on v.ntype=t.ntype
where b.nbno=#ncsno#
order by ndepth,ncscode
</select>
<select id="cm.ncs.parents.m" parameterClass="hashtable" resultClass="ncs">
select 0 ndepth,v.ntno ncsno,v.tname ncsname,v.tcode ncscode,case when v.ntno=t.ntno then 1 else 0 end isact
from ncsm m
inner join ncst t on t.ntno=m.ntno
inner join ncst v on v.ntype=t.ntype
where m.nmno=#ncsno#
order by ndepth,ncscode
</select>
<select id="cm.ncs3.check" parameterClass="hashtable" resultClass="ncs">
select d.ndno,d.acode dacode,d.dname
from ncsd d
inner join ncsb b on b.nbno=d.nbno
inner join ncsm m on m.nmno=b.nmno
inner join ncst t on t.ntno=m.ntno and t.ntype=#ntype#
where d.acode in ($dacodes$)
</select>
<select id="cm.ncs4.check" parameterClass="hashtable" resultClass="ncs">
select u.ndno,u.ucode
from ncsu u
where u.ndno=#ndno# and u.ucode in ($ucodes$)
</select>
<update id="cm.ncs4.in.batch" parameterClass="string">
insert into ncsu (ndno,ucode,acode,uname,<include refid="sql.inc"></include>)
values $inquery$
</update>
<select id="cm.loginlog.monthgroup" parameterClass="hashtable" resultClass="data">
select a.dtype,count(distinct b.intval) intval,sum(b.intval2) intval2
from (
select 1 dtype union all
select 2 union all
select 3 union all
select 4 union all
select 5 union all
select 6 union all
select 7 union all
select 8 union all
select 9 union all
select 10 union all
select 11 union all
select 12) a
left outer join (
select month(a.cdt) dtype,a.userno intval,count(a.logno) intval2
from loginlog a
<dynamic prepend="where">
<isNotNull property="logsite" prepend="and">a.logsite=#logsite#</isNotNull>
<isNotNull property="loginstatus" prepend="and">a.loginstatus=#loginstatus#</isNotNull>
<isNotNull property="loginstatuslt" prepend="and">a.loginstatus &lt; #loginstatuslt#</isNotNull>
<isNotNull property="year" prepend="and">year(a.cdt) = #year#</isNotNull>
</dynamic>
group by month(a.cdt),a.userno
) b on b.dtype=a.dtype
group by a.dtype
order by a.dtype,b.intval
</select>
<select id="cm.loginlogs" parameterClass="hashtable" resultClass="data">
select a.*
from (
select b.username strval,b.userid strval2,a.cdt time,a.uip strval3,a.loginstatus intval
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.cdt desc,b.username,b.userno</isNull>) rno
,count(a.cdt) over() pagetotalcount
from loginlog a
left outer join users b on b.userno=a.userno
<dynamic prepend="where">
<isNotNull property="start" prepend="and">a.cdt between #start# and #end#</isNotNull>
<isNotNull property="userid" prepend="and">b.userid=#userid#</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.pagelogs" parameterClass="hashtable" resultClass="data">
select a.*
from (
select b.username strval,b.userid strval2,a.cdt time,a.uip strval3,ifnull(c.menuname, ifnull(d.pagename, a.loginfo)) strval4
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.cdt desc,b.username,b.userno</isNull>) rno
,count(a.cdt) over() pagetotalcount
from pagelog a
left outer join users b on b.userno=a.userno
left outer join menu c on a.logsite=0 and c.menuno=a.menuno
left outer join menupage d on a.logsite=1 and d.pno=a.pno
<dynamic prepend="where">
<isNotNull property="start" prepend="and">a.cdt between #start# and #end#</isNotNull>
<isNotNull property="userid" prepend="and">b.userid=#userid#</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.actlogs" parameterClass="hashtable" resultClass="actlog">
select a.*
from (
select a.logtype,a.logtarget,a.userno,a.logdata,a.cdt,a.uip
,b.userid cnoid,b.username cnoname
,case a.logtarget when 21 then c.userid else null end userid
,case a.logtarget when 21 then c.username when 31 then d.asname when 32 then e.mname else null end username
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.cdt desc,b.username,b.userno</isNull>) rno
,count(a.cdt) over() pagetotalcount
from actlog a
inner join users b on b.userno=a.cno
left outer join users c on a.logtarget=21 and c.userno=a.userno
left outer join assign d on a.logtarget=31 and d.asno=a.userno
left outer join assignman e on a.logtarget=32 and e.asmno=a.userno
<dynamic prepend="where">
<isNotNull property="start" prepend="and">a.cdt between #start# and #end#</isNotNull>
<isNotNull property="userid" prepend="and">c.userid=#userid#</isNotNull>
<isNotNull property="username" prepend="and">c.username=#username#</isNotNull>
<isNotNull property="cnouid" prepend="and">b.userid=#cnouid#</isNotNull>
<isNotNull property="cnoname" prepend="and">b.username=#cnoname#</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<update id="cm.actlog.set" parameterClass="actlog">
insert into actlog (logtype,logtarget,userno,logdata,<include refid="sql.inc"></include>)
values(#logtype#,#logtarget#,#userno#,#logdata#,<include refid="sql.inv"></include>)
</update>
<update id="cm.authlog.set" parameterClass="authlog">
insert into authlog(logtype,userno,usertypeorg,usertypenew,<include refid="sql.inc"></include>)
values(#logtype#,#userno#,#usertypeorg#,#usertypenew#,<include refid="sql.inv"></include>)
</update>
<update id="cm.authlog.set2" parameterClass="authlog">
insert into authlog(logtype,userno,usertypeorg,usertypenew,<include refid="sql.inc"></include>)
select #logtype#,#userno#,a.usertype,#usertypenew#,<include refid="sql.inv"></include>
from users a
where a.userno=#userno# and a.usertype &lt;&gt; #usertypenew#
</update>
<select id="cm.authlogs" parameterClass="hashtable" resultClass="authlog">
select a.*
from (
select a.logtype,a.userno,a.usertypeorg,a.usertypenew,a.cdt,a.uip
,case when a.usertypeorg = 1 then '교육생' when d1.authname is null then '-' else d1.authname end usertypeorgstr
,case when a.usertypenew = 1 then '교육생' when d2.authname is null then '-' else d2.authname end usertypenewstr
,b.userid cnoid,b.username cnoname
,c.userid,c.username
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.cdt desc</isNull>) rno
,count(a.cdt) over() pagetotalcount
from authlog a
inner join users b on b.userno=a.cno
left outer join users c on a.logtype &gt; 0 and c.userno=a.userno
left outer join (
select distinct usertype,authname
from menuauth
) d1 on d1.usertype=a.usertypeorg
left outer join (
select distinct usertype,authname
from menuauth
) d2 on d2.usertype = a.usertypenew
<dynamic prepend="where">
<isNotNull property="start" prepend="and">a.cdt between #start# and #end#</isNotNull>
<isNotNull property="userid" prepend="and">c.userid=#userid#</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.sales.bycm" parameterClass="int" resultClass="data">
select case b.ptype when 2 then 2 when 3 then 1 else 0 end dtype, 0 intval, case b.ptype when 2 then '교재' when 3 then '시험' else '강좌' end strval,'매출' strval2
,sum(case when month(a.payoktime)=1 then b.payamt else 0 end) longval
,sum(case when month(a.payoktime)=2 then b.payamt else 0 end) longval2
,sum(case when month(a.payoktime)=3 then b.payamt else 0 end) longval3
,sum(case when month(a.payoktime)=4 then b.payamt else 0 end) longval4
,sum(case when month(a.payoktime)=5 then b.payamt else 0 end) longval5
,sum(case when month(a.payoktime)=6 then b.payamt else 0 end) longval6
,sum(case when month(a.payoktime)=7 then b.payamt else 0 end) longval7
,sum(case when month(a.payoktime)=8 then b.payamt else 0 end) longval8
,sum(case when month(a.payoktime)=9 then b.payamt else 0 end) longval9
,sum(case when month(a.payoktime)=10 then b.payamt else 0 end) longval10
,sum(case when month(a.payoktime)=11 then b.payamt else 0 end) longval11
,sum(case when month(a.payoktime)=12 then b.payamt else 0 end) longval12
from pay a
inner join payitem b on b.payno=a.payno and a.pstatus=1
where year(a.payoktime)=#year# and a.pstatus=1
group by b.ptype,month(a.payoktime)
union all
select case b.ptype when 2 then 2 when 3 then 1 else 0 end dtype, 1 intval, '','환불' strval
,(case when month(b.refundtime)=1 then b.refundamt else 0 end) * -1 longval
,(case when month(b.refundtime)=2 then b.refundamt else 0 end) * -1 longval2
,(case when month(b.refundtime)=3 then b.refundamt else 0 end) * -1 longval3
,(case when month(b.refundtime)=4 then b.refundamt else 0 end) * -1 longval4
,(case when month(b.refundtime)=5 then b.refundamt else 0 end) * -1 longval5
,(case when month(b.refundtime)=6 then b.refundamt else 0 end) * -1 longval6
,(case when month(b.refundtime)=7 then b.refundamt else 0 end) * -1 longval7
,(case when month(b.refundtime)=8 then b.refundamt else 0 end) * -1 longval8
,(case when month(b.refundtime)=9 then b.refundamt else 0 end) * -1 longval9
,(case when month(b.refundtime)=10 then b.refundamt else 0 end) * -1 longval10
,(case when month(b.refundtime)=11 then b.refundamt else 0 end) * -1 longval11
,(case when month(b.refundtime)=12 then b.refundamt else 0 end) * -1 longval12
from pay a
inner join payitem b on b.payno=a.payno and a.pstatus=1 and b.rstatus &gt; 0 and b.refundtime is not null and year(b.refundtime)=#year#
where a.pstatus=1 and a.rstatus &gt; 0
group by b.ptype,month(b.refundtime)
order by dtype,intval
</select>
<select id="cm.sales.bycmp" parameterClass="hashtable" resultClass="data">
select g.cgno intval,g.cgname strval,f.cgno intval2,f.cgname strval2,e.cname strval3,sum(b.payamt) longval,count(b.pino) intval3,sum(b.refundamt) longval2
,sum(case when b.rstatus=0 then 0 else 1 end) intval4,sum(b.payamt)-sum(b.refundamt) longval3
from term a
inner join payitem b on b.ptype &lt; 2 and b.pstatus=1
inner join pay c on c.payno=b.payno and c.pstatus=1
inner join cm d on d.cmno=b.itemno and d.tmno = a.tmno
inner join cm e on e.cmno=d.pcmno
inner join cg f on f.cgno=e.cgno
inner join cg g on g.cgno=f.pcgno
<dynamic prepend="where">
<isNotNull property="year" prepend="and">a.tyear=#year#</isNotNull>
<isNotNull property="tmno" prepend="and">a.tmno=#tmno#</isNotNull>
</dynamic>
group by g.cgno,g.cgname,f.cgno,f.cgname
order by g.cgname,g.cgno,f.cgname,f.cgno,e.cname,e.cmno
</select>
<select id="cm.data.lect.bycm" parameterClass="hashtable" resultClass="data">
select
b.cshape, case when b.cshape=0 then '온라인' when b.cshape=1 then '교육장교육' else '온라인교육' end cshapename
,b3.cgno,b2.cgno,f.cmno
,b3.cgname strval,b2.cgname strval2,f.cname strval3
,count(c.lectno) intval,sum(c.iscomplete) intval2
,sum(e.isjoin) intval3,sum(case when e.isjoin=1 and c.iscomplete=1 then 1 else 0 end) intval4
,sum(case when e.isjoin=0 then 1 else 0 end) intval5,sum(case when e.isjoin=0 and c.iscomplete=1 then 1 else 0 end) intval6
,sum(case when c.isrebate=0 then 1 else 0 end) intval7,sum(case when c.isrebate=0 and c.iscomplete=1 then 1 else 0 end) intval8
,sum(case when c.isrebate=1 then 1 else 0 end) intval9,sum(case when c.isrebate=1 and c.iscomplete=1 then 1 else 0 end) intval10
from term a
inner join cm b on b.tmno=a.tmno
inner join lect c on c.cmno=b.cmno and c.status=1
inner join users d on d.userno=c.userno
left outer join assign e on e.asno=d.asno
inner join cm f on f.cmno=b.pcmno
inner join cg b2 on b2.cgno=f.cgno
inner join cg b3 on b3.cgno=b2.pcgno
<dynamic prepend="where">
<isNotNull property="year" prepend="and">a.tyear=#year#</isNotNull>
<isNotNull property="tmno" prepend="and">a.tmno=#tmno#</isNotNull>
<isNotNull property="cshape" prepend="and">b.cshape=#cshape#</isNotNull>
<isNotNull property="pcgno" prepend="and">b3.cgno=#pcgno#</isNotNull>
<isNotNull property="cgno" prepend="and">b2.cgno=#cgno#</isNotNull>
</dynamic>
group by b3.cgno,b2.cgno,f.cmno,b3.cgname,b2.cgname,f.cname
order by b3.cgname,b3.cgno,b2.cgname,b2.cgno,f.cname,f.cmno
</select>
<select id="cm.data.lect.byc" parameterClass="hashtable" resultClass="data">
select a.*
from (
select b.cshape, case when b.cshape=0 then '온라인' when b.cshape=1 then '교육장교육' else '온라인교육' end cshapename
,b3.cgno pcgno,b2.cgno,f.cmno pcmno,b.cmno
,b3.cgname strval,b2.cgname strval2,f.cname strval3,concat(b.cname,'(',b.classno,')') strval4,concat(date_format(b.sstime,'%y.%m.%d'),'~',date_format(b.setime,'%y.%m.%d')) strval5
,count(c.lectno) intval
,sum(c.iscomplete) intval2
,sum(case when (c.iscomplete &lt;&gt; 1 or c.iscomplete is null) then 1 else 0 end) intval15 <!--총계미수료-->
,sum(e.isjoin) intval3
,sum(case when e.isjoin=1 and c.iscomplete=1 then 1 else 0 end) intval4
,sum(case when e.isjoin=0 then 1 else 0 end) intval5
,sum(case when e.isjoin=0 and c.iscomplete=1 then 1 else 0 end) intval6
,sum(case when c.isrebate=0 then 1 else 0 end) intval7
,sum(case when c.isrebate=0 and c.iscomplete=1 then 1 else 0 end) intval8
,sum(case when c.isrebate=1 then 1 else 0 end) intval9
,sum(case when c.isrebate=1 and c.iscomplete=1 then 1 else 0 end) intval10
,sum(case when c.isrebate=0 and (c.iscomplete &lt;&gt; 1 or c.iscomplete is null) then 1 else 0 end) intval13 <!--비환급 미수료-->
,sum(case when c.isrebate=1 and (c.iscomplete &lt;&gt; 1 or c.iscomplete is null) then 1 else 0 end) intval14 <!--환급 미수료-->
,sum(case when plog.isaccommodation = 1 then 1 else 0 end) intval16 <!--합숙신청완료-->
,sum(case when plog.isaccommodation = 1 and c.iscomplete=1 then 1 else 0 end) intval17 <!--합숙수료-->
,sum(case when plog.isaccommodation = 1 and (c.iscomplete &lt;&gt; 1 or c.iscomplete is null) then 1 else 0 end) intval18 <!--합숙미수료-->
,sum(case when (plog.isaccommodation &lt;&gt; 1 or plog.isaccommodation is null) then 1 else 0 end) intval19 <!--비합숙신청완료-->
,sum(case when (plog.isaccommodation &lt;&gt; 1 or plog.isaccommodation is null) and c.iscomplete=1 then 1 else 0 end) intval20 <!--비합숙수료-->
,sum(case when (plog.isaccommodation &lt;&gt; 1 or plog.isaccommodation is null) and (c.iscomplete &lt;&gt; 1 or c.iscomplete is null) then 1 else 0 end) intval21 <!--비합숙미수료-->
,row_number() over(order by b3.cgname,b3.cgno,b2.cgname,b2.cgno,f.cname,f.cmno,b.cname,b.cmno,b.classno) rno
,count(b.cmno) over() pagetotalcount
from term a
inner join cm b on b.tmno=a.tmno
inner join lect c on c.cmno=b.cmno and c.status=1
inner join users d on d.userno=c.userno
left outer join assign e on e.asno=d.asno
inner join cm f on f.cmno=b.pcmno
inner join cg b2 on b2.cgno=f.cgno
inner join cg b3 on b3.cgno=b2.pcgno
inner join pay p on c.payno = p.payno
inner join pplog plog on p.pplno = plog.pplno
<dynamic prepend="where">
<isNotNull property="year" prepend="and">a.tyear=#year#</isNotNull>
<isNotNull property="tmno" prepend="and">a.tmno=#tmno#</isNotNull>
<isNotNull property="cshape" prepend="and">b.cshape=#cshape#</isNotNull>
<isNotNull property="pcgno" prepend="and">b3.cgno=#pcgno#</isNotNull>
<isNotNull property="cgno" prepend="and">b2.cgno=#cgno#</isNotNull>
</dynamic>
group by b3.cgno,b2.cgno,f.cmno,b3.cgname,b2.cgname,f.cname,b.cmno,b.cname,b.sstime,b.setime
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.data.lect.byasctg" parameterClass="hashtable" resultClass="data">
select b3.cgno,b2.cgno,f.cmno
,b3.cgname strval,b2.cgname strval2,f.cname strval3
,count(c.lectno) intval,sum(c.iscomplete) intval2
$columns$
,sum(case when e.asctg is null then 1 else 0 end) intvaletc,sum(case when e.asctg is null and c.iscomplete=1 then 1 else 0 end) intvaletc2
from term a
inner join cm b on b.tmno=a.tmno
inner join lect c on c.cmno=b.cmno and c.status=1
inner join users d on d.userno=c.userno
left outer join assign e on e.asno=d.asno
inner join cm f on f.cmno=b.pcmno
inner join cg b2 on b2.cgno=f.cgno
inner join cg b3 on b3.cgno=b2.pcgno
<dynamic prepend="where">
<isNotNull property="year" prepend="and">a.tyear=#year#</isNotNull>
<isNotNull property="tmno" prepend="and">a.tmno=#tmno#</isNotNull>
</dynamic>
group by b3.cgno,b2.cgno,f.cmno,b3.cgname,b2.cgname,f.cname
order by b3.cgname,b3.cgno,b2.cgname,b2.cgno,f.cname,f.cmno
</select>
<select id="cm.data.lect.byjobposition" parameterClass="hashtable" resultClass="data">
select b3.cgno,b2.cgno,f.cmno
,b3.cgname strval,b2.cgname strval2,f.cname strval3
,count(c.lectno) intval,sum(c.iscomplete) intval2
$columns$
,sum(case when d.ccposition is null then 1 else 0 end) intvaletc,sum(case when d.ccposition is null and c.iscomplete=1 then 1 else 0 end) intvaletc2
from term a
inner join cm b on b.tmno=a.tmno
inner join lect c on c.cmno=b.cmno and c.status=1
inner join users d on d.userno=c.userno
inner join cm f on f.cmno=b.pcmno
inner join cg b2 on b2.cgno=f.cgno
inner join cg b3 on b3.cgno=b2.pcgno
<dynamic prepend="where">
<isNotNull property="year" prepend="and">a.tyear=#year#</isNotNull>
<isNotNull property="tmno" prepend="and">a.tmno=#tmno#</isNotNull>
</dynamic>
group by b3.cgno,b2.cgno,f.cmno,b3.cgname,b2.cgname,f.cname
order by b3.cgname,b3.cgno,b2.cgname,b2.cgno,f.cname,f.cmno
</select>
<select id="cm.data.lect.raw" parameterClass="hashtable" resultClass="cmlect">
select a.*
from (
select a.tyear,a.tseq,b3.cgno pcgno,b3.cgname pcgname,b2.cgno,b2.cgname,f.cname pcname,b.cname,b.classno,b.sstime,b.setime,b.infee,b.outfee,pp.asname,e.isjoin,e2.cname asctgname,c.isrebate
,d.username,d.userid,c.cdt,d2.cname ccpositionname,c.iscomplete
,row_number() over(order by b3.cgname,b3.cgno,b2.cgname,b2.cgno,f.cname,f.cmno,b.cname,b.cmno,b.classno) rno
,count(c.lectno) over() pagetotalcount
from term a
inner join cm b on b.tmno=a.tmno
inner join lect c on c.cmno=b.cmno and c.status=1
inner join pay p on p.payno = c.payno
left outer join pplog pp on p.pplno = pp.pplno
inner join users d on d.userno=c.userno
left outer join comcode d2 on d2.ccode=d.ccposition
left outer join assign e on e.asno=d.asno
left outer join comcode e2 on e2.ccode=.e.asctg
inner join cm f on f.cmno=b.pcmno
inner join cg b2 on b2.cgno=f.cgno
inner join cg b3 on b3.cgno=b2.pcgno
<dynamic prepend="where">
<isNotNull property="year" prepend="and">a.tyear=#year#</isNotNull>
<isNotNull property="tmno" prepend="and">a.tmno=#tmno#</isNotNull>
</dynamic>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="cm.data.lect.byassign" parameterClass="hashtable" resultClass="cmlect">
select a.*
from (
select row_number() over(order by b3.cgname,b3.cgno,b2.cgname,b2.cgno,f.cname,f.cmno,b.cname,b.cmno,b.classno,d.username,d.userno) rno, count(c.lectno) over() pagerowcount
,a.tyear,a.tseq,b3.cgno pcgno,b3.cgname pcgname,b2.cgno,b2.cgname,f.cname pcname,b.cname,b.classno,b.sstime,b.setime,b.infee,b.outfee,pp.asname,e.isjoin,e2.cname asctgname,c.isrebate
,d.username,d.userid,d.depart
,CAST(AES_DECRYPT(UNHEX(d.mobile), <include refid="sql.digest"></include>) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(d.email), <include refid="sql.digest"></include>) AS char) email
,c.attrate,c.cdt,c.iscomplete
,c2.payamt
,d2.cname ccpositionname
,count(a.cdt) over() pagetotalcount
from term a
inner join cm b on b.tmno=a.tmno <isNotNull property="pcmno">and b.pcmno=#pcmno#</isNotNull> <isNotNull property="cmno">and b.cmno=#cmno#</isNotNull>
inner join lect c on c.cmno=b.cmno and c.status=1
inner join pay p on p.payno = c.payno
left outer join pplog pp on p.pplno = pp.pplno
left outer join payitem c2 on c2.pino=c.pino
inner join users d on d.userno=c.userno <isNotNull property="username">and d.username like concat('%',#username#,'%')</isNotNull> <isNotNull property="asno">and d.asno=#asno#</isNotNull>
left outer join comcode d2 on d2.ccode=d.ccposition
left outer join assign e on e.asno=d.asno
left outer join comcode e2 on e2.ccode=.e.asctg
inner join cm f on f.cmno=b.pcmno
inner join cg b2 on b2.cgno=f.cgno
inner join cg b3 on b3.cgno=b2.pcgno
where ifnull(c2.refundstatus,0)=0
<isNotNull property="year">and a.tyear=#year#</isNotNull>
<isNotNull property="tmno">and a.tmno=#tmno#</isNotNull>
<isNotNull property="asname">and e.asname like concat('%',#asname#,'%')</isNotNull>
) a
<isNotEqual property="isexcel" compareValue="1">
<include refid="sql.pagedynamic"></include>
</isNotEqual>
order by a.rno
</select>
<select id="cm.data.cmcalc" parameterClass="hashtable" resultClass="cmcalc">
select a.rno,a.pcgno,a.pcgname,a.cgno,a.cgname,a.pcname,a.cmno,a.cname,a.classno,a.sstime,a.setime
,a.studyplace
,a.infee,a.outfee
,a.infeetotal
,a.outfeetotal
,a.feeloc,a.feebkpr,a.feebrt,a.feemat,a.feefoo,a.feeetc,a.prtcnt
,a.studyplacename
,a.incount
,a.outcount
,a.totcount
,a.pfee
,a.managers
,group_concat(c.username order by case when b.userno is null then 1 else 0 end,b.week,b.iseq separator $profsep$) profnames
,concat(substr(min(b.ist),1,2),':',substr(min(b.ist),3,2),'~',substr(max(b.iet),1,2),':',substr(max(b.iet),3,2)) itime
from (
select a.rno,a.pcgno,a.pcgname,a.cgno,a.cgname,a.pcname,a.cmno,a.cname,a.classno,a.sstime,a.setime
,a.studyplace
,a.infee,a.outfee
,a.infeetotal
,a.outfeetotal
,a.feeloc,a.feebkpr,a.feebrt,a.feemat,a.feefoo,a.feeetc,a.prtcnt
,a.studyplacename
,a.incount
,a.outcount
,a.totcount
,sum(b.pfee) pfee
,group_concat(case when b2.usertype=11 then null else b2.username end separator $profsep$) managers
from (
select row_number() over(order by b.sstime) rno
,b3.cgno pcgno,b3.cgname pcgname,b2.cgno,b2.cgname,f.cname pcname,b.cmno,b.cname,b.classno,b.sstime,b.setime
,b.studyplace
,b.infee,b.outfee
,b.infee*sum(case when e.isjoin=1 then 1 else 0 end) infeetotal
,b.outfee*sum(case when e.isjoin=1 then 0 else 1 end) outfeetotal
,cmc.feeloc,cmc.feebkpr,cmc.feebrt,cmc.feemat,cmc.feefoo,cmc.feeetc,cmc.prtcnt
,cc.cname studyplacename
,sum(case when e.isjoin=1 then 1 else 0 end) incount
,sum(case when e.isjoin=1 then 0 else 1 end) outcount
,count(c.lectno) totcount
from term a
inner join cm b on b.tmno=a.tmno and b.cshape=1
left outer join cmcalc cmc on cmc.cmno=b.cmno
inner join lect c on c.cmno=b.cmno and c.status=1
inner join users d on d.userno=c.userno
left outer join assign e on e.asno=d.asno
inner join cm f on f.cmno=b.pcmno
inner join cg b2 on b2.cgno=f.cgno
inner join cg b3 on b3.cgno=b2.pcgno
left outer join comcode cc on cc.ccode=b.studyplace
where a.tyear=#year#
group by b3.cgname,b3.cgno,b2.cgname,b2.cgno,f.cname,f.cmno,b.cname,b.cmno,b.classno
,b.sstime,b.setime
,b.studyplace
,cmc.infee, b.infee,cmc.outfee,b.outfee
,cmc.feeloc,cmc.feebkpr,cmc.feebrt,cmc.feemat,cmc.feefoo,cmc.feeetc,cmc.prtcnt
,cc.cname
) a
inner join cmprof b on b.cmno=a.cmno
inner join users b2 on b2.userno=b.userno
group by a.rno,a.pcgno,a.pcgname,a.cgno,a.cgname,a.pcname,a.cmno,a.cname,a.classno,a.sstime,a.setime
,a.studyplace
,a.infee,a.outfee
,a.infeetotal
,a.outfeetotal
,a.feeloc,a.feebkpr,a.feebrt,a.feemat,a.feefoo,a.feeetc,a.prtcnt
,a.studyplacename
,a.incount
,a.outcount
,a.totcount
) a
inner join cminning b on b.cmno=a.cmno
left outer join users c on c.userno=b.userno
group by a.rno,a.pcgno,a.pcgname,a.cgno,a.cgname,a.pcname,a.cmno,a.cname,a.classno,a.sstime,a.setime
,a.studyplace
,a.infee,a.outfee
,a.infeetotal
,a.outfeetotal
,a.feeloc,a.feebkpr,a.feebrt,a.feemat,a.feefoo,a.feeetc,a.prtcnt
,a.studyplacename
,a.incount
,a.outcount
,a.totcount
,a.pfee
,a.managers
order by a.rno
</select>
<update id="cm.cmcalc" parameterClass="hashtable">
update cmcalc a
inner join (
<iterate property="Ds" conjunction="union all" open="" close="">
select #Ds[].cmno# cmno,#Ds[].infee# infee,#Ds[].outfee# outfee,#Ds[].feeloc# feeloc,#Ds[].feebkpr# feebkpr,#Ds[].feebrt# feebrt,#Ds[].feemat# feemat,#Ds[].feefoo# feefoo,#Ds[].feeetc# feeetc,#Ds[].prtcnt# prtcnt
</iterate>
) b on b.cmno=a.cmno
set a.feeloc =b.feeloc
,a.feebkpr =b.feebkpr
,a.feebrt =b.feebrt
,a.feemat =b.feemat
,a.feefoo =b.feefoo
,a.feeetc =b.feeetc
,a.prtcnt =b.prtcnt;
insert into cmcalc (cmno,infee,outfee,feeloc,feebkpr,feebrt,feemat,feefoo,feeetc,prtcnt,<include refid="sql.inc"></include>)
select a.cmno,a.infee,a.outfee,a.feeloc,a.feebkpr,a.feebrt,a.feemat,a.feefoo,a.feeetc,a.prtcnt,<include refid="sql.inv"></include>
from (
<iterate property="Ds" conjunction="union all" open="" close="">
select #Ds[].cmno# cmno,#Ds[].infee# infee,#Ds[].outfee# outfee,#Ds[].feeloc# feeloc,#Ds[].feebkpr# feebkpr,#Ds[].feebrt# feebrt,#Ds[].feemat# feemat,#Ds[].feefoo# feefoo,#Ds[].feeetc# feeetc,#Ds[].prtcnt# prtcnt
</iterate>
) a
left outer join cmcalc b on b.cmno=a.cmno
where b.cmno is null
</update>
<select id="cm.cmcalc.print" parameterClass="int" resultClass="cmcalc">
select a.cmno,a.feeloc,a.feebkpr,a.feebrt,a.feemat,a.feefoo,a.feeetc,a.prtcnt
,b.cname,b.classno,b.sstime,b.setime
,c.pfee
,d.username,CAST(AES_DECRYPT(UNHEX(d.userpno), <include refid="sql.digest"></include>) AS char) userpno,d.bankname,CAST(AES_DECRYPT(UNHEX(d.bankno), <include refid="sql.digest"></include>) AS char) bankno,d.post,d.address1,d.address2
,row_number() over(order by d.username) rno
from cmcalc a
inner join cm b on b.cmno=a.cmno
inner join cmprof c on c.cmno=b.cmno
inner join users d on d.userno=c.userno
where a.cmno=#cmno#
order by rno
</select>
<select id="sys.npsystem" parameterClass="string" resultClass="int">
select count(b.daokey)
from (select 1 col1) a
left outer join npsystem b on b.daokey=#daokey#
</select>
<select id="sys.ncs.check.t" parameterClass="hashtable" resultClass="data">
select sum(intval) intval,sum(intval2) intval2
from (
select 0 intval, count(m.nmno) intval2
from ncst t
left outer join ncsm m on m.ntno=t.ntno
where t.ntno=#ncsno#
union all
select 0 intval,count(b.nbno) intval2
from ncst t
left outer join ncsm m on m.ntno=t.ntno
left outer join ncsb b on b.nmno=m.nmno
where t.ntno=#ncsno#
union all
select count(cmd.cmno) intval,count(distinct d.ndno) intval2
from ncst t
left outer join ncsm m on m.ntno=t.ntno
left outer join ncsb b on b.nmno=m.nmno
left outer join ncsd d on d.nbno=b.nbno
left outer join cmncsd cmd on cmd.ndno=d.ndno
where t.ntno=#ncsno#
union all
select 0 intval,count(u.nuno) intval2
from ncst t
left outer join ncsm m on m.ntno=t.ntno
left outer join ncsb b on b.nmno=m.nmno
left outer join ncsd d on d.nbno=b.nbno
left outer join ncsu u on u.ndno=d.ndno
where t.ntno=#ncsno#
) a
</select>
<select id="sys.ncs.check.m" parameterClass="hashtable" resultClass="data">
select sum(intval) intval,sum(intval2) intval2
from (
select 0 intval,count(b.nbno) intval2
from ncsm m
left outer join ncsb b on b.nmno=m.nmno
where m.nmno=#ncsno#
union all
select count(cmd.cmno) intval,count(distinct d.ndno) intval2
from ncsm m
left outer join ncsb b on b.nmno=m.nmno
left outer join ncsd d on d.nbno=b.nbno
left outer join cmncsd cmd on cmd.ndno=d.ndno
where m.nmno=#ncsno#
union all
select 0 intval,count(u.nuno) intval2
from ncsm m
left outer join ncsb b on b.nmno=m.nmno
left outer join ncsd d on d.nbno=b.nbno
left outer join ncsu u on u.ndno=d.ndno
where m.nmno=#ncsno#
) a
</select>
<select id="sys.ncs.check.b" parameterClass="hashtable" resultClass="data">
select sum(intval) intval,sum(intval2) intval2
from (
select count(cmd.cmno) intval,count(distinct d.ndno) intval2
from ncsb b
left outer join ncsd d on d.nbno=b.nbno
left outer join cmncsd cmd on cmd.ndno=d.ndno
where b.nbno=#ncsno#
union all
select 0 intval,count(u.nuno) intval2
from ncsb b
left outer join ncsd d on d.nbno=b.nbno
left outer join ncsu u on u.ndno=d.ndno
where b.nbno=#ncsno#
) a
</select>
<select id="sys.ncs.check.d" parameterClass="hashtable" resultClass="data">
select sum(intval) intval,sum(intval2) intval2
from (
select count(cmd.cmno) intval,0 intval2
from ncsd d
left outer join cmncsd cmd on cmd.ndno=d.ndno
where d.ndno=#ncsno#
union all
select 0 intval,count(u.nuno) intval2
from ncsd d
left outer join ncsu u on u.ndno=d.ndno
where d.ndno=#ncsno#
) a
</select>
<update id="sys.ncs.delall" parameterClass="hashtable">
<isEqual property="ndepth" compareValue="0">
delete from ncsu where ndno in (
select d.ndno
from ncst t
inner join ncsm m on m.ntno=t.ntno
inner join ncsb b on b.nmno=m.nmno
inner join ncsd d on d.nbno=b.nbno
where t.ntno=#ncsno#
);
delete from ncsd where nbno in (
select b.nbno
from ncst t
inner join ncsm m on m.ntno=t.ntno
inner join ncsb b on b.nmno=m.nmno
where t.ntno=#ncsno#
);
delete from ncsb where nmno in (
select m.nmno
from ncst t
inner join ncsm m on m.ntno=t.ntno
where t.ntno=#ncsno#
);
delete from ncsm where ntno=#ncsno#;
delete from ncst where ntno=#ncsno#
</isEqual>
<isEqual property="ndepth" compareValue="1">
delete from ncsu where ndno in (
select d.ndno
from ncsm m
inner join ncsb b on b.nmno=m.nmno
inner join ncsd d on d.nbno=b.nbno
where m.nmno=#ncsno#
);
delete from ncsd where nbno in (
select b.nbno
from ncsm m
inner join ncsb b on b.nmno=m.nmno
where m.nmno=#ncsno#
);
delete from ncsb where nmno=#ncsno#;
delete from ncsm where nmno=#ncsno#
</isEqual>
<isEqual property="ndepth" compareValue="2">
delete from ncsu where ndno in (
select d.ndno
from ncsb b
inner join ncsd d on d.nbno=b.nbno
where b.nbno=#ncsno#
);
delete from ncsd where nbno=#ncsno#;
delete from ncsb where nbno=#ncsno#
</isEqual>
<isEqual property="ndepth" compareValue="3">
delete from ncsu where ndno=#ncsno#;
delete from ncsd where ndno=#ncsno#
</isEqual>
</update>
<update id="sys.kcblog.in" parameterClass="hashtable">
insert into kcblog (cdt,cp_cd,mobile,vssn,logmsg)
values(now(),#cp_cd#
,case when #mobile# is not null then HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>)) else null end
,#vssn#
,#logmsg#
);
</update>
<update id="excellog.in" parameterClass="excellog">
INSERT INTO exceldownlog (userno, userid, username, actiontime, position, comment, userip)
SELECT userno, userid, username, sysdate(), #position#, #comment#, #userip#
FROM users
where userno = #userno#
</update>
<select id="excellog.look" parameterClass="hashtable" resultClass="excellog">
select *
from (
select edno, userno, userid, username, actiontime, position, comment
, userip, count(edno) over() pagetotalcount
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">edno desc</isNull>) rno
from exceldownlog
<dynamic prepend="where">
<isNotNull property="userid" prepend="and">userid = #userid#</isNotNull>
<isNotNull property="sstime" prepend="and">
date_format(actiontime,'%Y%m%d') &gt;= date_format(#sstime#,'%Y%m%d')
</isNotNull>
<isNotNull property="setime" prepend="and">
date_format(actiontime,'%Y%m%d') &lt;= date_format(#setime#,'%Y%m%d')
</isNotNull>
</dynamic>
)t
<include refid="sql.pagedynamic"></include>
order by edno desc
</select>
<insert id="sys.okcert3.in" parameterClass="okcert3" >
insert into okcert3log (gubn, ret, reason, sn, rsltcd, rslt, dt)
select #gubn#, #retVal#, #reasonNo#, #sn#, #rsltCd#, #rslt#, now()
<selectKey type="post" property="no" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<select id="sys.okcert3.get" parameterClass="hashtable" resultClass="string">
select rslt
from okcert3log
where no = $no$ and sn=#sn#
</select>
<update id="sys.okcert3.setUno" parameterClass="hashtable">
update okcert3log set uno = $uno$
where no = $no$;
</update>
<update id="sys.okcert3.setEnccd" parameterClass="hashtable">
update okcert3log set enccd = #enccd#
where no = $no$;
</update>
</statements>
</sqlMap>