509 lines
27 KiB
XML
509 lines
27 KiB
XML
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|||
|
|
<sqlMap xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/TR/xmlschema-1/" namespace="">
|
|||
|
|
|
|||
|
|
<alias>
|
|||
|
|
<typeAlias alias="comment" type="NP.Model.Comment, NP.Model" />
|
|||
|
|
<typeAlias alias="memo" type="NP.Model.Memo, NP.Model" />
|
|||
|
|
<typeAlias alias="memouser" type="NP.Model.MemoUser, NP.Model" />
|
|||
|
|
<typeAlias alias="basemodel" type="NP.Model.BaseModel, NP.Model" />
|
|||
|
|
<typeAlias alias="emailsend" type="NP.Model.EmailSend, NP.Model" />
|
|||
|
|
<typeAlias alias="smsauth" type="NP.Model.SmsAuth, NP.Model" />
|
|||
|
|
</alias>
|
|||
|
|
|
|||
|
|
<cacheModels>
|
|||
|
|
<cacheModel id="commonCache" implementation="LRU" >
|
|||
|
|
<flushInterval hours="1" />
|
|||
|
|
<property name="CacheSize" value="1000" />
|
|||
|
|
</cacheModel>
|
|||
|
|
</cacheModels>
|
|||
|
|
|
|||
|
|
<!--<parameterMaps>
|
|||
|
|
</parameterMaps>-->
|
|||
|
|
|
|||
|
|
<resultMaps>
|
|||
|
|
</resultMaps>
|
|||
|
|
|
|||
|
|
<statements>
|
|||
|
|
<select id="common.check.loginkey" parameterClass="hashtable" resultClass="data">
|
|||
|
|
select a.userno dtype
|
|||
|
|
from users a
|
|||
|
|
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
</select>
|
|||
|
|
<select id="common.check.admin" parameterClass="hashtable" resultClass="data">
|
|||
|
|
select a.userno dtype, a.udt time, count(b.mno) intval
|
|||
|
|
from users a
|
|||
|
|
left outer join memouser b on b.userno=a.userno and b.isread=0 and b.isdel=0
|
|||
|
|
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
</select>
|
|||
|
|
<select id="common.check.front" parameterClass="hashtable" resultClass="data">
|
|||
|
|
select a.dtype,sum(a.intval) intval,sum(a.intval2) intval2
|
|||
|
|
from (
|
|||
|
|
select a.userno dtype,count(b.mno) intval,0 intval2
|
|||
|
|
from users a
|
|||
|
|
left outer join memouser b on b.userno=a.userno and b.isread=0 and b.isdel=0
|
|||
|
|
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
group by a.userno
|
|||
|
|
union all
|
|||
|
|
select a.userno dtype,0 intval,count(b.userno) intval2
|
|||
|
|
from users a
|
|||
|
|
left outer join alarms b on b.userno=a.userno and b.isdel=0
|
|||
|
|
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
group by a.userno
|
|||
|
|
) a
|
|||
|
|
group by a.dtype
|
|||
|
|
</select>
|
|||
|
|
<select id="common.check.frontcroom" parameterClass="hashtable" resultClass="data">
|
|||
|
|
select a.dtype,sum(a.intval) intval,sum(a.intval2) intval2,sum(a.intval3) intval3,sum(a.intval4) intval4,sum(a.intval5) intval5
|
|||
|
|
,sum(a.intval6) intval6,sum(a.intval7) intval7,sum(a.intval8) intval8,sum(a.intval9) intval9,sum(a.intval10) intval10
|
|||
|
|
,sum(a.intval11) intval11,sum(a.intval12) intval12
|
|||
|
|
,max(a.strval) strval,max(a.strval2) strval2,max(a.strval3) strval3
|
|||
|
|
from (
|
|||
|
|
select a.userno dtype,count(b.mno) intval,0 intval2,0 intval3,0 intval4,0 intval5
|
|||
|
|
,0 intval6,0 intval7,0 intval8,0 intval9,0 intval10
|
|||
|
|
,0 intval11,0 intval12
|
|||
|
|
,null strval,null strval2,null strval3
|
|||
|
|
from users a
|
|||
|
|
left outer join memouser b on b.userno=a.userno and b.isread=0 and b.isdel=0
|
|||
|
|
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
group by a.userno
|
|||
|
|
union all
|
|||
|
|
select a.userno dtype,0 intval,count(b.userno) intval2,0 intval3,0 intval4,0 intval5
|
|||
|
|
,0 intval6,0 intval7,0 intval8,0 intval9,0 intval10
|
|||
|
|
,0 intval11,0 intval12
|
|||
|
|
,null strval,null strval2,null strval3
|
|||
|
|
from users a
|
|||
|
|
left outer join alarms b on b.userno=a.userno and b.isdel=0
|
|||
|
|
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
union all
|
|||
|
|
select a.userno dtype,0 intval,0 intval2,c.tyear intval3,c.tseq intval4,b.classno intval5
|
|||
|
|
,b2.isplan intval6,b2.iscontent intval7,b2.isev intval8,b2.isrs intval9,b2.isgrade intval10
|
|||
|
|
,b.cmno intval11,b.cshape intval12
|
|||
|
|
,d.cgname strval,b.cname strval2
|
|||
|
|
,group_concat(case when f.bmno is null then null else concat(f.bmno,':',f.bmname,':',f.bmtype) end separator ';') strval3
|
|||
|
|
from users a0
|
|||
|
|
inner join lect a on a.lectno=#lectno# and a.userno=a0.userno and a.status=1 and a.ischanged=0
|
|||
|
|
inner join cm b on b.cmno=a.cmno
|
|||
|
|
inner join cmmenu b2 on b2.cmno=b.cmno
|
|||
|
|
inner join term c on c.tmno=b.tmno
|
|||
|
|
inner join cg d on d.cgno=b.cgno
|
|||
|
|
left outer join cmmenubm e on e.cmno=b.cmno
|
|||
|
|
left outer join boardmaster f on f.bmno=e.bmno
|
|||
|
|
where a0.userno=#userno# and (a0.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
group by a.userno,b.cmno,c.tyear,c.tseq,b.classno
|
|||
|
|
,b2.isplan,b2.iscontent,b2.isev,b2.isrs,b2.isgrade
|
|||
|
|
,d.cgname,b.cname
|
|||
|
|
) a
|
|||
|
|
group by a.dtype
|
|||
|
|
</select>
|
|||
|
|
<select id="common.check.frontcroom.subdomain" parameterClass="hashtable" resultClass="data">
|
|||
|
|
select a.*,b.asname strval4,c.fileurl
|
|||
|
|
from (
|
|||
|
|
select a.dtype,sum(a.intval) intval,sum(a.intval2) intval2,sum(a.intval3) intval3,sum(a.intval4) intval4,sum(a.intval5) intval5
|
|||
|
|
,sum(a.intval6) intval6,sum(a.intval7) intval7,sum(a.intval8) intval8,sum(a.intval9) intval9,sum(a.intval10) intval10
|
|||
|
|
,sum(a.intval11) intval11
|
|||
|
|
,max(a.strval) strval,max(a.strval2) strval2,max(a.strval3) strval3
|
|||
|
|
from (
|
|||
|
|
select a.userno dtype,count(b.mno) intval,0 intval2,0 intval3,0 intval4,0 intval5
|
|||
|
|
,0 intval6,0 intval7,0 intval8,0 intval9,0 intval10
|
|||
|
|
,0 intval11
|
|||
|
|
,null strval,null strval2,null strval3
|
|||
|
|
from users a
|
|||
|
|
left outer join memouser b on b.userno=a.userno and b.isread=0 and b.isdel=0
|
|||
|
|
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
group by a.userno
|
|||
|
|
union all
|
|||
|
|
select a.userno dtype,0 intval,count(b.userno) intval2,0 intval3,0 intval4,0 intval5
|
|||
|
|
,0 intval6,0 intval7,0 intval8,0 intval9,0 intval10
|
|||
|
|
,0 intval11
|
|||
|
|
,null strval,null strval2,null strval3
|
|||
|
|
from users a
|
|||
|
|
left outer join alarms b on b.userno=a.userno and b.isdel=0
|
|||
|
|
where a.userno=#userno# and (a.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
union all
|
|||
|
|
select a.userno dtype,0 intval,0 intval2,c.tyear intval3,c.tseq intval4,b.classno intval5
|
|||
|
|
,b2.isplan intval6,b2.iscontent intval7,b2.isev intval8,b2.isrs intval9,b2.isgrade intval10
|
|||
|
|
,b.cmno intval11
|
|||
|
|
,d.cgname strval,b.cname strval2
|
|||
|
|
,group_concat(case when f.bmno is null then null else concat(f.bmno,':',f.bmname,':',f.bmtype) end separator ';') strval3
|
|||
|
|
from users a0
|
|||
|
|
inner join lect a on a.lectno=#lectno# and a.userno=a0.userno and a.status=1 and a.ischanged=0
|
|||
|
|
inner join cm b on b.cmno=a.cmno
|
|||
|
|
inner join cmmenu b2 on b2.cmno=b.cmno
|
|||
|
|
inner join term c on c.tmno=b.tmno
|
|||
|
|
inner join cg d on d.cgno=b.cgno
|
|||
|
|
left outer join cmmenubm e on e.cmno=b.cmno
|
|||
|
|
left outer join boardmaster f on f.bmno=e.bmno
|
|||
|
|
where a0.userno=#userno# and (a0.loginkey=#loginkey# or #IsDupCheck#=0)
|
|||
|
|
group by a.userno,b.cmno,c.tyear,c.tseq,b.classno
|
|||
|
|
,b2.isplan,b2.iscontent,b2.isev,b2.isrs,b2.isgrade
|
|||
|
|
,d.cgname,b.cname
|
|||
|
|
) a
|
|||
|
|
group by a.dtype
|
|||
|
|
) a
|
|||
|
|
inner join assign b on b.subdomain=#subdomain#
|
|||
|
|
left outer join fileinfo c on c.fgno=b.sitelogo
|
|||
|
|
</select>
|
|||
|
|
<update id="common.comment.save" parameterClass="hashtable">
|
|||
|
|
update cmt set <include refid="sql.up"></include>
|
|||
|
|
,memo=#memo#
|
|||
|
|
,memotype=case when cdepth=0 then #memotype# else memotype end
|
|||
|
|
<isNotNull property="fgno" prepend=",">fgno=#fgno#</isNotNull>
|
|||
|
|
where #cmtno# <>0 and cmtno=#cmtno#;
|
|||
|
|
|
|||
|
|
insert into cmt (cmttype,pcmtno,cdepth,tcmtno,baseno,memotype,memo,fgno,isdel,<include refid="sql.inc"></include>)
|
|||
|
|
select #cmttype#,#pcmtno#
|
|||
|
|
,case when #pcmtno# is null then 0 else b.cdepth+1 end
|
|||
|
|
,case when #pcmtno# is null then null else case when b.cdepth=0 then b.cmtno else b.tcmtno end end
|
|||
|
|
,#baseno#,case when #pcmtno# is null then #memotype# else null end,#memo#,#fgno#,0,<include refid="sql.inv"></include>
|
|||
|
|
from (select 1 col1) a
|
|||
|
|
left outer join cmt b on b.cmtno=#pcmtno#
|
|||
|
|
where #cmtno#=0;
|
|||
|
|
</update>
|
|||
|
|
<select id="common.basecomments" parameterClass="hashtable" resultClass="comment">
|
|||
|
|
select a.cmtno,a.pcmtno,a.tcmtno,a.baseno,a.cdepth,a.memo,a.memotype,a.fgno,a.cdt,a.udt, a.isdel,a.cno
|
|||
|
|
,b.orgname, b.fileurl, b.fileno
|
|||
|
|
,c.username
|
|||
|
|
from cmt a
|
|||
|
|
inner join users c on c.userno=a.cno
|
|||
|
|
left outer join fileinfo b on b.fgno=a.fgno and b.isdel=0
|
|||
|
|
where a.cmttype=#cmttype# and a.baseno=#baseno#
|
|||
|
|
order by a.cdt desc
|
|||
|
|
</select>
|
|||
|
|
<update id="common.comment.delete" parameterClass="hashtable">
|
|||
|
|
update cmt set isdel=1 where cmtno=#cmtno# and (#isadmin# is not null or cno=#cno#);
|
|||
|
|
</update>
|
|||
|
|
|
|||
|
|
<select id="common.emailsends" parameterClass="hashtable" resultClass="emailsend">
|
|||
|
|
select a.*
|
|||
|
|
from (
|
|||
|
|
select a.sendno,a.etitle,a.semail,a.fgno,a.cdt,a.rcvcount,a.readcount
|
|||
|
|
,count(b.sendno) bancount
|
|||
|
|
,c.username cnoname
|
|||
|
|
,row_number() over(order by a.cdt desc) rno,count(a.cdt) over() pagetotalcount
|
|||
|
|
from emailsend a
|
|||
|
|
left outer join emailban b on b.sendno=a.sendno
|
|||
|
|
inner join users c on c.userno=a.cno
|
|||
|
|
where a.isdel=0
|
|||
|
|
group by a.sendno,a.etitle,a.semail,a.fgno,a.cdt,a.rcvcount,a.readcount,c.username
|
|||
|
|
) a
|
|||
|
|
<include refid="sql.pagedynamic"></include>
|
|||
|
|
order by a.rno
|
|||
|
|
</select>
|
|||
|
|
<select id="common.emailsend.get" parameterClass="long" resultClass="emailsend">
|
|||
|
|
select a.sendno,a.ehtml,a.etitle
|
|||
|
|
from emailsend a
|
|||
|
|
left outer join emailban b on b.sendno=a.sendno
|
|||
|
|
where a.sendno=#sendno# and a.isdel=0
|
|||
|
|
</select>
|
|||
|
|
<select id="common.emailsend.get2" parameterClass="long" resultClass="emailsend">
|
|||
|
|
select a.sendno,a.etitle,a.rcvs,ifnull(a.sendeds, ' ') sendeds,ifnull(group_concat(b.email separator ';'), ' ') bans
|
|||
|
|
from emailsend a
|
|||
|
|
left outer join emailban b on b.sendno=a.sendno
|
|||
|
|
where a.sendno=#sendno# and a.isdel=0
|
|||
|
|
group by a.sendno,a.rcvs,a.etitle,a.sendeds
|
|||
|
|
</select>
|
|||
|
|
<insert id="common.emailsend.in" parameterClass="hashtable">
|
|||
|
|
insert into emailsend(etitle,semail,ehtml,fgno,cmno,rcvs,reademails,rcvcount,readcount,<include refid="sql.inc"></include>)
|
|||
|
|
values (#etitle#,#semail#,#ehtml#,#fgno#,#cmno#,#rcvs#,#reademails#,#rcvcount#,#readcount#,<include refid="sql.inv"></include>)
|
|||
|
|
<selectKey type="post" property="sendno" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
|
|||
|
|
</insert>
|
|||
|
|
<select id="common.emailbanpool" parameterClass="string" resultClass="emailsend">
|
|||
|
|
select email semail from emailbanpool where email in ($emails$)
|
|||
|
|
</select>
|
|||
|
|
<update id="common.emailsendok" parameterClass="hashtable">
|
|||
|
|
update emailsend set isdel=0,readcount=#readcount#,sendeds=#sendeds# where sendno=#sendno#
|
|||
|
|
</update>
|
|||
|
|
<update id="common.emailban" parameterClass="emailsend">
|
|||
|
|
insert into emailban(sendno,email,<include refid="sql.inc"></include>)
|
|||
|
|
values
|
|||
|
|
<iterate property="Ds" open="" conjunction="," close="">
|
|||
|
|
(#sendno#,#Ds[].bans#,now(),#Ds[].uno#,now(),#Ds[].uno#,#Ds[].uip#)
|
|||
|
|
</iterate>
|
|||
|
|
</update>
|
|||
|
|
|
|||
|
|
<select id="common.list.rcv" parameterClass="hashtable" resultClass="memo">
|
|||
|
|
select a.*
|
|||
|
|
from (
|
|||
|
|
select a.mno,a.userno,a.isread,a.cdt
|
|||
|
|
,b.mtitle
|
|||
|
|
,u.username sendusername
|
|||
|
|
,u.usertype sendusertype
|
|||
|
|
,u.userid senduserid
|
|||
|
|
,CAST(AES_DECRYPT(UNHEX(u.email), <include refid="sql.digest"></include>) AS char) Email
|
|||
|
|
, row_number() over(order by a.cdt desc) rno
|
|||
|
|
, count(a.cdt) over() pagetotalcount
|
|||
|
|
from memouser a
|
|||
|
|
inner join memo b on b.mno=a.mno
|
|||
|
|
left outer join users u on u.userno=b.cno
|
|||
|
|
where a.isdel=0
|
|||
|
|
<isNotNull property="userno">and a.userno=#userno#</isNotNull>
|
|||
|
|
) a
|
|||
|
|
<include refid="sql.pagedynamic"></include>
|
|||
|
|
order by a.rno
|
|||
|
|
</select>
|
|||
|
|
<select id="common.list.rcvnot" parameterClass="hashtable" resultClass="int">
|
|||
|
|
select count(a.mno)
|
|||
|
|
from memouser a
|
|||
|
|
where a.userno=#userno# and and a.isread=0 and a.isdel=0
|
|||
|
|
</select>
|
|||
|
|
<update id="common.memo.alldeleteR" parameterClass="hashtable">
|
|||
|
|
update memouser set isdel=1,<include refid="sql.up"></include> where userno=#uno#
|
|||
|
|
</update>
|
|||
|
|
<update id="common.memo.alldeleteS" parameterClass="hashtable">
|
|||
|
|
update memo set isdel=1,<include refid="sql.up"></include> where cno=#uno#
|
|||
|
|
</update>
|
|||
|
|
<update id="common.memo.deleteR" parameterClass="hashtable">
|
|||
|
|
update memouser set isdel=1,<include refid="sql.up"></include>
|
|||
|
|
where userno=#uno#
|
|||
|
|
<isNotNull property="mnos">and mno in ($mnos$)</isNotNull>
|
|||
|
|
<isGreaterThan property="mno" compareValue="0">and mno=#mno#</isGreaterThan>
|
|||
|
|
</update>
|
|||
|
|
<update id="common.memo.deleteS" parameterClass="hashtable">
|
|||
|
|
update memo set isdel=1,<include refid="sql.up"></include> where cno=#uno#
|
|||
|
|
<isNotNull property="mnos">and mno in ($mnos$)</isNotNull>
|
|||
|
|
<isGreaterThan property="mno" compareValue="0">and mno=#mno#</isGreaterThan>
|
|||
|
|
</update>
|
|||
|
|
<select id="common.list.send" parameterClass="hashtable" resultClass="memo">
|
|||
|
|
select a.*
|
|||
|
|
from (
|
|||
|
|
select a.mno,a.mtitle,a.cdt,count(b.mno) mucount
|
|||
|
|
, sum(b.isread) ccount
|
|||
|
|
, row_number() over(order by a.cdt desc) rno
|
|||
|
|
, count(b.cdt) over() pagetotalcount
|
|||
|
|
from memo a
|
|||
|
|
inner join memouser b on b.mno=a.mno
|
|||
|
|
where a.isdel=0
|
|||
|
|
<isNotNull property="userno">and a.cno=#userno#</isNotNull>
|
|||
|
|
group by a.mno,a.mtitle,a.cdt
|
|||
|
|
) a
|
|||
|
|
<include refid="sql.pagedynamic"></include>
|
|||
|
|
order by a.rno
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
<update id="common.memo.insert" parameterClass="memo">
|
|||
|
|
insert into memo (pmno,mtitle,mcontents,fgno,Isdel,<include refid="sql.inc"></include>)
|
|||
|
|
values (#pmno#,#mtitle#,#mcontents#,#fgno#,0,<include refid="sql.now"></include>,#cno#,<include refid="sql.now"></include>,#uno#,#uip#);
|
|||
|
|
|
|||
|
|
insert into memouser (mno,userno,isread,isdel,<include refid="sql.inc"></include>)
|
|||
|
|
select LAST_INSERT_ID(),userno,1,0,0,<include refid="sql.inv"></include>
|
|||
|
|
from users where userno in ($usernos$) and isdel=0
|
|||
|
|
</update>
|
|||
|
|
<update id="common.memo.inserttousertype" parameterClass="memo">
|
|||
|
|
insert into memo (pmno,mtitle,mcontents,fgno,isdel,<include refid="sql.inc"></include>)
|
|||
|
|
values (#pmno#,#mtitle#,#mcontents#,#fgno#,0,<include refid="sql.now"></include>,#cno#,<include refid="sql.now"></include>,#uno#,#uip#);
|
|||
|
|
|
|||
|
|
insert into memouser (mno,userno,isread,isdel,<include refid="sql.inc"></include>)
|
|||
|
|
select LAST_INSERT_ID(),userno,1,0,0,<include refid="sql.inv"></include>
|
|||
|
|
from users
|
|||
|
|
where usertype in ($usertype$) and isdel=0
|
|||
|
|
</update>
|
|||
|
|
<update id="common.memo.insertmulti" parameterClass="hashtable">
|
|||
|
|
insert into memo (pmno,cmno,mtitle,mcontents,fgno,isdel,<include refid="sql.inc"></include>)
|
|||
|
|
values (#pmno#,#cmno#,#mtitle#,#mcontents#,#fgno#,0,<include refid="sql.inv"></include>);
|
|||
|
|
|
|||
|
|
insert into memouser (mno,userno,isread,isdel,<include refid="sql.inc"></include>)
|
|||
|
|
select LAST_INSERT_ID(), a.userno,0,0,<include refid="sql.inv"></include>
|
|||
|
|
from users a
|
|||
|
|
where a.userno in ($usernos$)
|
|||
|
|
</update>
|
|||
|
|
<select id="common.list.senddata" parameterClass="hashtable" resultClass="memo">
|
|||
|
|
select a.mno,b.isread,a.cdt,b.rdate
|
|||
|
|
,u.username,u.usertype sendusertype
|
|||
|
|
,CAST(AES_DECRYPT(UNHEX(u.userid), <include refid="sql.digest"></include>) AS char) email
|
|||
|
|
,u.userid zstring0
|
|||
|
|
from memo a
|
|||
|
|
inner join memouser b on b.mno=a.mno
|
|||
|
|
left outer join users u on u.userno=b.userno
|
|||
|
|
<dynamic prepend="where">
|
|||
|
|
<isNotNull property="mno" prepend="and">a.mno=#mno#</isNotNull>
|
|||
|
|
<isNotNull property="mnos" prepend="and">a.mno in ($mnos$)</isNotNull>
|
|||
|
|
</dynamic>
|
|||
|
|
order by a.mno
|
|||
|
|
</select>
|
|||
|
|
<select id="common.memo" parameterClass="hashtable" resultClass="memo">
|
|||
|
|
<isNotNull property="readcheck">
|
|||
|
|
update memouser set isread=1,rdate=now() where mno=#mno# and userno=#readuser#;
|
|||
|
|
</isNotNull>
|
|||
|
|
select a.mno,u.username cnoname,a.cdt,a.mtitle,a.mcontents,a.fgno,a.cno
|
|||
|
|
,u.usertype
|
|||
|
|
from memo a
|
|||
|
|
left outer join users u on u.userno=a.cno
|
|||
|
|
<isNotNull property="readuser">
|
|||
|
|
inner join memouser b on b.mno=a.mno and b.userno=#readuser# and b.isdel=0
|
|||
|
|
</isNotNull>
|
|||
|
|
where a.mno=#mno# <isNotNull property="cno">and a.cno=#cno#</isNotNull>
|
|||
|
|
</select>
|
|||
|
|
<select id="common.memouser" parameterClass="hashtable" resultClass="memo">
|
|||
|
|
<isNotNull property="userno">
|
|||
|
|
update memouser set isread=1,rdate=<include refid="sql.now"></include> where mno=#mno# and userno=#userno#;
|
|||
|
|
</isNotNull>
|
|||
|
|
select a.mno,u.username,a.isread,a.rdate
|
|||
|
|
from memouser a
|
|||
|
|
left outer join users u on u.userno=a.userno
|
|||
|
|
where a.mno=#mno# <isNotNull property="userno">and a.userno=#userno#</isNotNull>
|
|||
|
|
order by u.username
|
|||
|
|
</select>
|
|||
|
|
<select id="common.talklist.send" parameterClass="hashtable" resultClass="memo">
|
|||
|
|
select a.mno,b.mcontents,a.ACount,a.FTCount,a.SCount,a.LCount,a.MCount,a.ECount,a.ccount,b.cdt,c.username cnoname
|
|||
|
|
from (
|
|||
|
|
select a.mno,a.rno,a.pagetotalcount
|
|||
|
|
,sum(case when b.isok=1 and b.smstype='A' then 1 else 0 end) ACount
|
|||
|
|
,sum(case when b.isok=1 and b.smstype='FT' then 1 else 0 end) FTCount
|
|||
|
|
,sum(case when b.isok=1 and b.smstype='S' then 1 else 0 end) SCount
|
|||
|
|
,sum(case when b.isok=1 and b.smstype='L' then 1 else 0 end) LCount
|
|||
|
|
,sum(case when b.isok=1 and b.smstype='M' then 1 else 0 end) MCount
|
|||
|
|
,sum(case when b.isok < 1 then 1 else 0 end) ECount
|
|||
|
|
,count(b.mno) ccount
|
|||
|
|
from (
|
|||
|
|
select a.mno,a.rno,a.pagetotalcount
|
|||
|
|
from (
|
|||
|
|
select a.mno
|
|||
|
|
, row_number() over(order by a.cdt desc) rno
|
|||
|
|
, count(a.cdt) over() pagetotalcount
|
|||
|
|
from sms a
|
|||
|
|
where a.cno=#userno#
|
|||
|
|
) a
|
|||
|
|
<include refid="sql.pagedynamic"></include>
|
|||
|
|
) a
|
|||
|
|
inner join smsuser b on b.mno=a.mno
|
|||
|
|
group by a.mno,a.rno,a.pagetotalcount
|
|||
|
|
) a
|
|||
|
|
inner join sms b on b.mno=a.mno
|
|||
|
|
inner join users c on c.userno=b.cno
|
|||
|
|
order by a.rno
|
|||
|
|
</select>
|
|||
|
|
<insert id="common.sms.in" parameterClass="hashtable">
|
|||
|
|
insert into sms(cmno,mcontents,<include refid="sql.inc"></include>)
|
|||
|
|
values (#cmno#,#mcontents#,<include refid="sql.inv"></include>);
|
|||
|
|
<selectKey type="post" property="mno" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
|
|||
|
|
</insert>
|
|||
|
|
<update id="common.smsuser.in" parameterClass="hashtable">
|
|||
|
|
insert into smsuser (mno,userno,smstype,isok,msgid,message,<include refid="sql.inc"></include>)
|
|||
|
|
values
|
|||
|
|
<iterate property="Users" open="" conjunction="," close="">
|
|||
|
|
(#mno#,#Users[].userno#,#Users[].smstype#,#Users[].isok#,#Users[].msgid#,#Users[].message#,now(),#uno#,now(),#uno#,#uip#)
|
|||
|
|
</iterate>
|
|||
|
|
</update>
|
|||
|
|
<select id="common.smssend.get" parameterClass="long" resultClass="memouser">
|
|||
|
|
select c.asname,b.usertype,b.username
|
|||
|
|
,CAST(AES_DECRYPT(UNHEX(b.mobile), <include refid="sql.digest"></include>) AS char) mobile
|
|||
|
|
,a.smstype,a.isok
|
|||
|
|
,row_number() over(order by b.username) rno, count(a.cno) over() pagetotalcount
|
|||
|
|
from smsuser a
|
|||
|
|
inner join users b on b.userno=a.userno
|
|||
|
|
left outer join assign c on c.asno=b.asno
|
|||
|
|
where a.mno=#mno#
|
|||
|
|
order by b.username
|
|||
|
|
</select>
|
|||
|
|
<select id="common.home" parameterClass="int" resultClass="data">
|
|||
|
|
select b.cnt intval
|
|||
|
|
,c.cnt0 intval2
|
|||
|
|
,c.cnt1 intval3
|
|||
|
|
,d.cnt intval4
|
|||
|
|
,e.cnt intval5
|
|||
|
|
,f.cnt intval6
|
|||
|
|
,(SELECT COUNT(*) FROM userleave WHERE status = 0) intval7
|
|||
|
|
from (select 1 col1) a
|
|||
|
|
left outer join (select count(mno) cnt from memouser where userno=#userno# and isread=0 and isdel=0) b on 1=1
|
|||
|
|
left outer join (
|
|||
|
|
select sum(case when a.bmposition=0 then 1 else 0 end) cnt0,sum(case when a.bmposition=1 and b.cmno is not null then 1 else 0 end) cnt1
|
|||
|
|
from boardmaster a
|
|||
|
|
inner join board b on b.bmno=a.bmno and b.pbno is null and b.isdel=0 and b.isopen=1
|
|||
|
|
left outer join board c on c.pbno=b.bno and c.isdel=0
|
|||
|
|
where a.bmtype=2 and a.isopen=1 and c.bno is null and a.disptype=0
|
|||
|
|
) c on 1=1
|
|||
|
|
left outer join (
|
|||
|
|
select count(a.rfdno) cnt
|
|||
|
|
from payrfd a
|
|||
|
|
left outer join pay b on b.payno = a.payno
|
|||
|
|
where a.rstatus=0 and b.rstatus=0
|
|||
|
|
<!--select sum(cnt) cnt
|
|||
|
|
from (
|
|||
|
|
select count(a.rfdno) cnt
|
|||
|
|
from payrfd a
|
|||
|
|
inner join payitem b on a.payno is not null and b.payno=a.payno and b.pstatus=1 and b.rstatus=0
|
|||
|
|
where a.rstatus=0
|
|||
|
|
union all
|
|||
|
|
select count(a.rfdno) cnt
|
|||
|
|
from payrfd a
|
|||
|
|
inner join pay b on a.payno is null and b.payno=a.payno and b.pstatus=1 and b.rstatus=0
|
|||
|
|
where a.rstatus=0
|
|||
|
|
) a-->
|
|||
|
|
) d on 1=1
|
|||
|
|
left outer join (
|
|||
|
|
select count(a.payno) cnt
|
|||
|
|
from paydvr a
|
|||
|
|
inner join pay b on b.payno=a.payno and b.pstatus=1 and b.rstatus=0
|
|||
|
|
inner join payitem c on c.payno = b.payno
|
|||
|
|
inner join book bb on bb.bkno=c.itemno
|
|||
|
|
where a.dvrcode is null and a.isdvr=1
|
|||
|
|
) e on 1=1
|
|||
|
|
left outer join (
|
|||
|
|
select count(a.payno) cnt
|
|||
|
|
from paytax a
|
|||
|
|
where a.ischeck=0
|
|||
|
|
<!--inner join pay b on b.payno=a.payno and b.pstatus in (1,22) and b.rstatus < 2
|
|||
|
|
where a.taxdate is null and ifnull(a.iscancel,0) = 0-->
|
|||
|
|
) f on 1=1
|
|||
|
|
</select>
|
|||
|
|
<update id="common.authkey.save" parameterClass="hashtable">
|
|||
|
|
update authkey set jobkey=#jobkey#,randkey=#randkey#,keytime=date_add(now(), interval 1 minute)
|
|||
|
|
where authtype=#authtype# and userno=#userno#;
|
|||
|
|
|
|||
|
|
insert into authkey (authtype,userno,jobkey,randkey,keytime)
|
|||
|
|
select a.authtype,a.userno,a.jobkey,a.randkey,date_add(now(), interval 1 minute)
|
|||
|
|
from (select #authtype# authtype,#userno# userno,#jobkey# jobkey,#randkey# randkey) a
|
|||
|
|
left outer join authkey b on b.authtype=a.authtype and b.userno=a.userno
|
|||
|
|
where b.authtype is null
|
|||
|
|
</update>
|
|||
|
|
<select id="common.authkey" parameterClass="hashtable" resultClass="string">
|
|||
|
|
select jobkey
|
|||
|
|
from authkey where authtype=#authtype# and userno=#userno# and randkey=#randkey# and keytime > now()
|
|||
|
|
</select>
|
|||
|
|
<update id="common.authkey.set" parameterClass="data">
|
|||
|
|
<isEqual property="dtype" compareValue="1">
|
|||
|
|
update ct set authkey=#intval30# where ctno=#intval#
|
|||
|
|
</isEqual>
|
|||
|
|
<isEqual property="dtype" compareValue="2">
|
|||
|
|
update question set authkey=#intval30# where qno=#intval#
|
|||
|
|
</isEqual>
|
|||
|
|
</update>
|
|||
|
|
<select id="common.authkey.check1" parameterClass="hashtable" resultClass="data">
|
|||
|
|
select ctno intval,ismenu intval2,ctype intval3,ccode strval
|
|||
|
|
from ct
|
|||
|
|
where ctno=#ctno# and authkey=#authkey#;
|
|||
|
|
update ct set authkey=null where ctno=#ctno#
|
|||
|
|
</select>
|
|||
|
|
<select id="common.authkey.check2" parameterClass="hashtable" resultClass="data">
|
|||
|
|
select qno intval
|
|||
|
|
from question
|
|||
|
|
where qno=#qno# and authkey=#authkey#;
|
|||
|
|
update question set authkey=null where qno=#qno#
|
|||
|
|
</select>
|
|||
|
|
<insert id="common.smsauth" parameterClass="smsauth">
|
|||
|
|
insert into smsauth(latime,lakey,lectno)
|
|||
|
|
values(now(),#lakey#,#lectno#);
|
|||
|
|
<selectKey type="post" property="authno" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
|
|||
|
|
</insert>
|
|||
|
|
<insert id="common.smsauth2" parameterClass="smsauth">
|
|||
|
|
insert into smsauth(latime,lakey,userno, lectno)
|
|||
|
|
values(now(),#lakey#,#userno#, 0);
|
|||
|
|
<selectKey type="post" property="authno" resultClass="long">SELECT LAST_INSERT_ID()</selectKey>
|
|||
|
|
</insert>
|
|||
|
|
<select id ="common.sms.chk" parameterClass="hashtable" resultClass="data">
|
|||
|
|
select authno intval,lectno intval2,latime time,lakey strval
|
|||
|
|
from smsauth
|
|||
|
|
where authno = #authno#
|
|||
|
|
</select>
|
|||
|
|
<update id="common.sms.extend" parameterClass="hashtable">
|
|||
|
|
update smsauth
|
|||
|
|
set latime = now()
|
|||
|
|
where authno = #authno#
|
|||
|
|
</update>
|
|||
|
|
<insert id ="common.atalk.send" parameterClass="hashtable">
|
|||
|
|
insert into MTS_ATALK_MSG (TRAN_SENDER_KEY,TRAN_TMPL_CD,TRAN_CALLBACK,TRAN_PHONE,TRAN_SUBJECT,TRAN_MSG,TRAN_DATE,TRAN_TYPE,TRAN_STATUS,TRAN_REPLACE_TYPE,TRAN_REPLACE_MSG)
|
|||
|
|
values (#senderkey#,#method#,#SEND_PHONE#,#DEST_PHONE#,#title#,#MSG_BODY#,now(),5,'1',#replace_type#,#MSG_BODY#);
|
|||
|
|
</insert>
|
|||
|
|
</statements>
|
|||
|
|
</sqlMap>
|