YNICTE/Dao/MyBatis/Maps/User.xml

974 lines
58 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>
<!--tfile, 첨부파일 -->
<typeAlias alias="users" type="NP.Model.Users, NP.Model" />
<typeAlias alias="authlog" type="NP.Model.AuthLog, NP.Model" />
<typeAlias alias="loginlog" type="NP.Model.LoginLog, NP.Model" />
<typeAlias alias="assign" type="NP.Model.Assign, NP.Model" />
<typeAlias alias="assignfee" type="NP.Model.AssignFee, NP.Model" />
<typeAlias alias="assignman" type="NP.Model.AssignMan, NP.Model" />
<typeAlias alias="users.lect" type="NP.Model.Lect, NP.Model" />
<typeAlias alias="councel" type="NP.Model.Councel, NP.Model" />
<typeAlias alias="data" type="NP.Model.Data, NP.Model" />
</alias>
<cacheModels>
<cacheModel id="userCache" implementation="LRU" >
<flushInterval hours="1" />
<property name="CacheSize" value="1000" />
</cacheModel>
</cacheModels>
<!--<parametermaps>
</parametermaps>-->
<resultMaps>
</resultMaps>
<statements>
<sql id="sql.prc">count(a.cdt) over() pagetotalcount</sql>
<sql id="sql.inc">cdt,cno,udt,uno,uip</sql>
<sql id="sql.inv">now(),#uno#,now(),#uno#,#uip#</sql>
<sql id="sql.up">udt=now(),uno=#uno#,uip=#uip#</sql>
<sql id="sql.now">now()</sql>
<sql id="sql.digest">'np123@!'</sql>
<sql id="sql.page">
<isNotNull property="pagerange" prepend="and">rno between $pagerange$</isNotNull>
</sql>
<sql id="sql.pagedynamic">
<dynamic prepend="where">
<isNotNull property="pagerange" prepend="and">rno between $pagerange$</isNotNull>
</dynamic>
</sql>
<select id="users.adminlogin" parameterClass="hashtable" resultClass="users">
select userno,a.username,a.status,a.userpass, usertype,a.asno
, CAST(AES_DECRYPT(UNHEX(a.mobile), <include refid="sql.digest"></include>) AS char) mobile
, a.logintime
from users a
left outer join assign b on b.asno=a.asno
where a.userid=#userid# and a.usertype &gt; 10 and (a.usertype &lt;&gt; 81 or (a.usertype = 81 and b.status=1))
</select>
<insert id="users.loginlog" parameterClass="hashtable">
insert into loginlog (logsite,userno, loginstatus, logindata, <include refid="sql.inc"></include>) values (#loginsite#,#userno#, #loginstatus#, #logindata#, <include refid="sql.inv"></include>)
</insert>
<select id="users.assigns" parameterClass="hashtable" resultClass="assign">
select a.*
from (
select a.asno,a.asname,a.brno
,a.asno value,a.asname text
,a.isjoin,a.ascode,a.astype,a.asctg,a.joindate,a.status
,c1.cname astypename,c2.cname asctgname
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.asname</isNull>) rno
,count(a.cdt) over() pagetotalcount
from assign a
left outer join comcode c1 on c1.ccode=a.astype
left outer join comcode c2 on c2.ccode=a.asctg
where a.isdel=0
<isNotNull property="asno" prepend="and">a.asno=#asno#</isNotNull>
<isNotNull property="status" prepend="and">a.status=#status#</isNotNull>
<isNotNull property="statuses" prepend="and">a.status in ($statuses$)</isNotNull>
<isNotNull property="asname" prepend="and">a.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNull property="brnos" prepend="and">a.brno in ($brnos$)</isNotNull>
<isNotNull property="brno" prepend="and">a.brno =#brno#</isNotNull>
<isNotNull property="ismain" prepend="and">a.ismain=#ismain#</isNotNull>
<isNotNull property="isjoin" prepend="and">a.isjoin=#isjoin#</isNotNull>
<isNotNull property="issite" prepend="and">a.issite=#issite#</isNotNull>
<isNotNull property="ceoname" prepend="and">a.ceoname=#ceoname#</isNotNull>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="users.assigns2" parameterClass="hashtable" resultClass="assign">
select a.*
from (
select a.asno,a.astype,a.asctg,a.askey,a.brno,a.ismain
,a.asname,a.asno value,a.asname text,a.isjoin,a.joinyear,a.joinprice,a.ascode,a.joindate
<!--,case when a.joindate is not null then year(a.joindate) else null end joindateyear-->
, a.exitdate,a.aday,a.status,a.ceoname
$excel1$
,a.address1,a.address2,concat(a.address1, a.address2) adr1,a.grno,a.btype,a.bkind,a.salesamount,a.homeurl,a.mcount
,a.fgnobno,a.fgnobank,a.issite
,a.subdomain,a.sitename,a.sitelogo,a.sitefooter
,a.eino, a.mname
,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
,a.cdt
,c.fdate
,case when c.status = 1 then 1 else 0 end fstatus
<!--,case when c.fyear=year(now()) then c.status else c.status end fnstatus-->
<!--,case when c.fyear=year(now()) then c.fprice else 0 end fnprice-->
,c1.cname astypename,c2.cname asctgname,c3.cname askeyname
,f.fileno,f.orgname
,row_number() over(order by $orderby$) rno
,count(a.cdt) over() pagetotalcount
from (
select distinct a.asno
from assign a
left outer join assignman b on b.asno=a.asno and b.isdel=0 and b.mname = ifnull(#mname#, 'xx박효동 xx')
left outer join users c on c.asno = a.asno
where a.isdel=0
<isNotNull property="userno" prepend="and">c.userno=#userno#</isNotNull>
<isNotNull property="asno" prepend="and">a.asno=#asno#</isNotNull>
<isNotNull property="status" prepend="and">a.status=#status#</isNotNull>
<isNotNull property="statuses" prepend="and">a.status in ($statuses$)</isNotNull>
<isNotNull property="asname" prepend="and">a.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNull property="brnos" prepend="and">a.brno in ($brnos$)</isNotNull>
<isNotNull property="brno" prepend="and">a.brno =#brno#</isNotNull>
<isNotNull property="ismain" prepend="and">a.ismain=#ismain#</isNotNull>
<isNotNull property="isjoin" prepend="and">a.isjoin=#isjoin#</isNotNull>
<isNotNull property="ceoname" prepend="and">a.ceoname like concat('%',#ceoname#,'%')</isNotNull>
<isNotNull property="mname" prepend="and">a.mname like concat('%',#mname#,'%')</isNotNull>
<isNotNull property="salesamountf" prepend="and">a.salesamount between #salesamountf# and #salesamountt#</isNotNull>
<isNotNull property="mcountf" prepend="and">a.mcount between #mcountf# and #mcountt#</isNotNull>
<isNotNull property="cdtf" prepend="and">a.cdt between #cdtf# and #cdtt#</isNotNull>
<isNotNull property="astype" prepend="and">a.astype=#astype#</isNotNull>
<isNotNull property="asctg" prepend="and">a.asctg=#asctg#</isNotNull>
<isNotNull property="askey" prepend="and">a.askey=#askey#</isNotNull>
<isNotNull property="issite" prepend="and">a.issite=#issite#</isNotNull>
<isNotNull property="asnolt" prepend="and">a.asno &lt; #asnolt#</isNotNull>
<isNotEmpty property="mphone" prepend="and">
CAST(AES_DECRYPT(UNHEX(a.mphone), <include refid="sql.digest"></include>) AS char) like concat('%',#mphone#,'%')
</isNotEmpty>
) b
inner join assign a on a.asno=b.asno
left outer join assignfee c on c.asno=a.asno <isNull property="fyear">and c.fyear=0</isNull> <isNotNull property="fyear">and c.fyear=#fyear#</isNotNull> and c.asno &gt;0
left outer join fileinfo f on f.fgno = a.fgnobno
left outer join comcode c1 on c1.ccode=a.astype
left outer join comcode c2 on c2.ccode=a.asctg
left outer join comcode c3 on c3.ccode=a.askey
<dynamic prepend="where">
<isNotNull property="statusfee" prepend="and">case when c.status = 1 then 1 else 0 end in ($statusfee$)</isNotNull>
</dynamic>
) a
<isNull property="isexcel">
<include refid="sql.pagedynamic"></include>
</isNull>
group by a.asno,a.brno
order by a.rno
</select>
<select id="users.assignsite" parameterClass="hashtable" resultClass="assign">
select a.asno,a.asname,a.issite,a.subdomain,a.sitename,a.sitelogo,a.sitefooter,a.siteip
,b.fileurl
from assign a
left outer join fileinfo b on b.fgno=a.sitelogo and b.isdel=0
<dynamic prepend="where">
<isNotNull property="asno" prepend="and">a.asno=#asno#</isNotNull>
<isNotNull property="subdomain" prepend="and">a.subdomain=#subdomain#</isNotNull>
<isNotNull property="asnonot" prepend="and">a.asno&lt;&gt;#asnonot#</isNotNull>
</dynamic>
</select>
<select id="users.assignmans" parameterClass="hashtable" resultClass="assignman">
select a.asmno,a.asno,a.mtype,a.jtype,a.depart,a.mname,a.position
,CAST(AES_DECRYPT(UNHEX(a.telno), <include refid="sql.digest"></include>) AS char) telno
,CAST(AES_DECRYPT(UNHEX(a.mobile), <include refid="sql.digest"></include>) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(a.fax), <include refid="sql.digest"></include>) AS char) fax
,CAST(AES_DECRYPT(UNHEX(a.email), <include refid="sql.digest"></include>) AS char) email
,a.post,a.address1,a.address2
from assignman a
<dynamic prepend="where">
<isNotNull property="asno" prepend="and">a.asno=#asno#</isNotNull>
<isNotNull property="mtype" prepend="and">a.mtype=#mtype#</isNotNull>
<isNotNull property="jtype" prepend="and">a.jtype=#jtype#</isNotNull>
and a.isdel=0
</dynamic>
order by a.mtype,a.jtype,a.cdt
</select>
<select id="users.assignmans2" parameterClass="hashtable" resultClass="assignman">
select a.*
from (
select a.asno,a.asname,a.brno
,a.asno value,a.asname text
,a.isjoin,a.ascode,a.astype,a.asctg,a.joindate,a.status,a.ceoname, concat('[',a.post,']') post,concat(ifnull(a.post,''),ifnull(a.address1,''),ifnull(a.address2,'')) adr1
,c.mtype,c.jtype,c.depart,c.mname,c.position
,CAST(AES_DECRYPT(UNHEX(c.email), <include refid="sql.digest"></include>) AS char) email
,CAST(AES_DECRYPT(UNHEX(c.mobile), <include refid="sql.digest"></include>) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(c.telno), <include refid="sql.digest"></include>) AS char) telno
,concat('[',c.post,']') post2,concat(ifnull(c.post,''),ifnull(c.address1,''),ifnull(c.address2,'')) adr2
,c1.cname astypename,c2.cname asctgname,c3.cname askeyname
,case when d.status=1 then 1 else 0 end fstatus
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.asname</isNull>,a.asno,c.mtype,c.jtype,c.cdt) rno
,count(a.cdt) over() pagetotalcount
from (
select distinct a.asno
from assign a
left outer join assignman b on b.asno=a.asno and b.isdel=0 and b.mname = ifnull(#mname#, 'xx박효동 xx')
where a.isdel=0
<isNotNull property="asno" prepend="and">a.asno=#asno#</isNotNull>
<isNotNull property="status" prepend="and">a.status=#status#</isNotNull>
<isNotNull property="statuses" prepend="and">a.status in ($statuses$)</isNotNull>
<isNotNull property="asname" prepend="and">a.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNull property="brnos" prepend="and">a.brno in ($brnos$)</isNotNull>
<isNotNull property="brno" prepend="and">a.brno =#brno#</isNotNull>
<isNotNull property="ismain" prepend="and">a.ismain=#ismain#</isNotNull>
<isNotNull property="isjoin" prepend="and">a.isjoin=#isjoin#</isNotNull>
<isNotNull property="ceoname" prepend="and">a.ceoname=#ceoname#</isNotNull>
<isNotNull property="mname" prepend="and">b.mname is not null</isNotNull>
<isNotNull property="salesamountf" prepend="and">a.salesamount between #salesamountf# and #salesamountt#</isNotNull>
<isNotNull property="mcountf" prepend="and">a.mcount between #mcountf# and #mcountt#</isNotNull>
<isNotNull property="joindatef" prepend="and">a.joindate between #joindatef# and #joindatet#</isNotNull>
<isNotNull property="astype" prepend="and">a.astype=#astype#</isNotNull>
<isNotNull property="asctg" prepend="and">a.asctg=#asctg#</isNotNull>
<isNotNull property="askey" prepend="and">a.askey=#askey#</isNotNull>
) b
inner join assign a on a.asno=b.asno
inner join assignman c on c.asno=a.asno and c.isdel=0
left outer join assignfee d on d.asno=a.asno
left outer join comcode c1 on c1.ccode=a.astype
left outer join comcode c2 on c2.ccode=a.asctg
left outer join comcode c3 on c3.ccode=a.askey
<isNotNull property="statusfee">where d.status in ($statusfee$) </isNotNull>
group by a.asno,c.asmno
) a
<isNull property="isexcel">
<include refid="sql.pagedynamic"></include>
</isNull>
order by a.rno
</select>
<select id="users.users" parameterClass="hashtable" resultClass="users">
select a.*
from (
select a.userno,a.usertype,a.asno,a.pasname,a.userid,a.username,a.status,a.gender,a.jointype
,b.asname,b.isjoin,b.ceoname,b.brno,b.post aspost,b.address1 asaddress1,b.address2 asaddress2,b.btype asbtype,b.bkind asbkind
,CAST(AES_DECRYPT(UNHEX(a.email), <include refid="sql.digest"></include>) AS char) email
,CAST(AES_DECRYPT(UNHEX(a.mobile), <include refid="sql.digest"></include>) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(a.telno), <include refid="sql.digest"></include>) AS char) telno
,CAST(AES_DECRYPT(UNHEX(a.userpno), <include refid="sql.digest"></include>) AS char) userpno
,a.usernameeng,a.logintime
,CAST(AES_DECRYPT(UNHEX(a.bankno), <include refid="sql.digest"></include>) AS char) bankno
,a.userkind,a.isacceptemail,a.depart,a.ccposition,a.ccpositionetc,a.fgnoprofile,a.ccjobs
,a.bankname
,a.post,a.address1,a.address2,a.introhtml,a.send335time,a.pwcalltime,a.pwcallno,a.eastereggkey,a.eetime
,a.kfcfyear,a.isassignuser,a.edus
,case when c.refcode='9' then a.ccpositionetc else c.cname end ccpositionname
,case when a.usertype=1 then '교육생' when d.authname is null then '-' else d.authname end usertypestr
,CAST(AES_DECRYPT(UNHEX(a.birthday), <include refid="sql.digest"></include>) AS char) birthday
,a.uduty,a.slevel,a.isacceptmobile,a.vssn,a.di,a.ci,a.ischkatt,a.authplatform
, ifnull(us.playbar, 0) as playbar
, ifnull(us.isplay, 0) as isplay
,row_number() over(order by <isNotNull property="orderby">$orderby$</isNotNull><isNull property="orderby">a.username</isNull>) rno
,count(a.cdt) over() pagetotalcount
from users a
left outer join assign b on b.asno=a.asno and b.isdel=0
left outer join comcode c on c.ccode=a.ccposition
left outer join (
select distinct usertype,authname
from menuauth
) d on d.usertype = a.usertype
left outer join userstatus us on a.userno = us.userno
where a.status &lt; 99
<isNull property="includesysadmin">and a.usertype &lt;&gt; 91</isNull>
<isNotNull property="userno">and a.userno =#userno#</isNotNull>
<isNotNull property="usernonot">
<isGreaterThan property="usernonot" compareValue="0">and a.userno &lt;&gt; #usernonot#</isGreaterThan>
</isNotNull>
<isNotEmpty property="usertypes">and a.usertype in ($usertypes$)</isNotEmpty>
<isNotNull property="usertype">and a.usertype =#usertype#</isNotNull>
<isNotNull property="userid">and a.userid=#userid#</isNotNull>
<isNotEmpty property="username" prepend="and">(a.username = #username#)</isNotEmpty>
<isNotEmpty property="usernameid" prepend="and">(a.username like concat('%',#usernameid#,'%') or a.userid like concat('%',#usernameid#,'%'))</isNotEmpty>
<isNotNull property="status" prepend="and">a.status=#status#</isNotNull>
<isNotNull property="asno" prepend="and">a.asno=#asno#</isNotNull>
<isNotNull property="profandmainadmin" prepend="and">(a.usertype=11 or (a.usertype &gt; 80 and b.ismain=1))</isNotNull>
<isNotNull property="asname" prepend="and">b.asname like concat('%',#asname#,'%')</isNotNull>
<!--<isNotNull property="asname" prepend="and">b.asname = #asname#</isNotNull>-->
<isNotEmpty property="brno" prepend="and">b.brno=#brno#</isNotEmpty>
<isNotNull property="email" prepend="and">
<!--CAST(AES_DECRYPT(UNHEX(a.email), <include refid="sql.digest"></include>) AS char) like concat('%',#email#,'%')-->
a.email=HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>))
</isNotNull>
<isNotEmpty property="mobile" prepend="and">
<!--CAST(AES_DECRYPT(UNHEX(a.mobile), <include refid="sql.digest"></include>) AS char) like concat('%',#mobile#,'%')-->
a.mobile=HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>))
</isNotEmpty>
<isNotEmpty property="userpno" prepend="and">
<!--CAST(AES_DECRYPT(UNHEX(a.userpno), <include refid="sql.digest"></include>) AS char) like concat('%',#userpno#,'%')-->
a.userpno=HEX(AES_ENCRYPT(#userpno#, <include refid="sql.digest"></include>))
</isNotEmpty>
<isNotNull property="usertypeover" prepend="and">a.usertype &gt; #usertypeover#</isNotNull>
<isNotNull property="vssn" prepend="and">a.vssn = #vssn#</isNotNull>
<isNotNull property="di" prepend="and">a.di = #di#</isNotNull>
) a
<include refid="sql.pagedynamic"></include>
order by a.rno
</select>
<select id="users.usersbyuserids" parameterClass="hashtable" resultClass="users">
select a.userno,a.userid,a.username,asno
from users a
where a.status=1 <isNotNull property="usertype">and a.usertype=#usertype#</isNotNull>
<isNotNull property="userids">and a.userid in ($userids$)</isNotNull>
</select>
<select id="users.byusernos" parameterClass="string" resultClass="users">
select a.userno,CAST(AES_DECRYPT(UNHEX(a.mobile), <include refid="sql.digest"></include>) AS char) mobile,a.username,b.isjoin
from users a
left outer join assign b on b.asno=a.asno
where a.userno in ($usernos$)
</select>
<select id="users.checkuser" parameterClass="hashtable" resultClass="int">
select min(case when b.userid=#userid# then 1
else case when b.usertype = 1 and #email# is not null and b.email=HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>)) then 2
else case when b.usertype = 1 and #mobile# is not null and b.mobile=HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>)) then 3
else case when b.usertype = 1 and #userpno# is not null and b.userpno=HEX(AES_ENCRYPT(#userpno#, <include refid="sql.digest"></include>)) then 4
else case when b.usertype = 1 and #di# is not null and b.di=#di# then 5
else 9 end end end end end)
from (select 1 col1) a
left outer join users b on b.userno &gt; 0
<isNotNull property="usernonot">and b.userno &lt;&gt;#usernonot#</isNotNull>
and (
b.userid=#userid#
or b.email=HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>))
or b.mobile=HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>))
or b.userpno=HEX(AES_ENCRYPT(#userpno#, <include refid="sql.digest"></include>))
or b.di=#di#
)
</select>
<insert id="users.in" parameterClass="hashtable">
insert into users(usertype,userkind,userid,userpass,username,usernameeng
,gender,email,isacceptemail,mobile,telno
,asno,pasname,depart,ccposition,ccpositionetc,fgnoprofile,ccjobs
,userpno,bankname,bankno
,post,address1,address2,introhtml,status,logintime,send335time,pwcalltime,pwcallno,eastereggkey,eetime,kfcfyear,isassignuser,edus
,isacceptmobile,uduty,slevel,jointype,birthday,snsid,di,ci,vssn,ischkatt,authplatform,<include refid="sql.inc"></include>)
values (#usertype#,#userkind#,#userid#,#userpass#,#username#,#usernameeng#
,gender,HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>)),#isacceptemail#,HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>)),HEX(AES_ENCRYPT(#telno#, <include refid="sql.digest"></include>))
,#asno#,#pasname#,#depart#,#ccposition#,#ccpositionetc#,#fgnoprofile#,#ccjobs#
,HEX(AES_ENCRYPT(#userpno#, <include refid="sql.digest"></include>)),#bankname#,HEX(AES_ENCRYPT(#bankno#, <include refid="sql.digest"></include>))
,#post#,#address1#,#address2#,#introhtml#,#status#,<include refid="sql.now"></include>,null,null,null,null,null,#kfcfyear#,#isassignuser#,#edus#
,#isacceptmobile#,#uduty#,#slevel#,#jointype#,HEX(AES_ENCRYPT(#birthday#, <include refid="sql.digest"></include>)),#snsid#,#di#,#ci#,#vssn#,#ischkatt#,#authplatform#,<include refid="sql.inv"></include>);
<selectKey type="post" property="userno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<select id="users.pass.check" parameterClass="hashtable" resultClass="int">
select count(userno)
from userpasslog
where userno = #userno# and userpass = #userpass#
</select>
<update id="users.up" parameterClass="hashtable">
<isNotNull property="userpass">
insert into userpasslog (userno, userpass, cdt, uip)
select #userno#, #userpass#, now(), #uip#
from (select 1 col1) a
left outer join userpasslog b on b.userno=#userno#
where b.userno is null;
update userpasslog set userpass = #userpass#
where userno=#userno#;
</isNotNull>
update users set <include refid="sql.up"></include>
,usertype=#usertype#
,userkind =#userkind#
<isNotNull property="userpass">,userpass =#userpass#</isNotNull>
,username =case when #username# is not null then #username# else username end
,usernameeng =case when #usernameeng# is not null then #usernameeng# else username end
,gender =#gender#
,email =case when #email# is null and #usertype# &gt; 80 then null when #email# is not null then HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>)) else email end
,isacceptemail =case when #isacceptemail# is not null then #isacceptemail# else isacceptemail end
,mobile =HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>))
,telno =HEX(AES_ENCRYPT(#telno#, <include refid="sql.digest"></include>))
,asno =#asno#
,pasname =#pasname#
,depart =#depart#
,ccposition =#ccposition#
,ccpositionetc =#ccpositionetc#
<isNotNull property="fgnoprofile">,fgnoprofile =#fgnoprofile#</isNotNull>
,ccjobs =case when #ccjobs# is not null then #ccjobs# else ccjobs end
,userpno =case when #userpno# is not null then HEX(AES_ENCRYPT(#userpno#, <include refid="sql.digest"></include>)) else null end
,bankname =case when #bankname# is not null then #bankname# else bankname end
,bankno =case when #bankno# is not null then HEX(AES_ENCRYPT(#bankno#, <include refid="sql.digest"></include>)) else bankno end
,post =case when #post# is not null then #post# else post end
,address1 =case when #address1# is not null then #address1# else address1 end
,address2 =case when #address2# is not null then #address2# else address2 end
,introhtml =case when #introhtml# is not null then #introhtml# else introhtml end
,isacceptmobile = #isacceptmobile#
,uduty = #uduty#
,slevel = #slevel#
,jointype =case when #jointype# is not null then #jointype# else jointype end
,isassignuser = #isassignuser#
,birthday = case when #birthday# is not null then HEX(AES_ENCRYPT(#birthday#, <include refid="sql.digest"></include>)) else birthday end
,kfcfyear =case when #kfcfyear# is not null then #kfcfyear# else kfcfyear end
<isEqual property="savefrontbuy" compareValue="1">
,isassignuser =#isassignuser#,kfcfyear =#kfcfyear#,edus=#edus#
</isEqual>
,status =case when #status# &gt; 0 then #status# else status end
,ischkatt = #ischkatt#
,authplatform =case when #authplatform# &gt; 0 then #authplatform# else authplatform end
,di =case when #di# is not null then #di# else di end
,ci =case when #ci# is not null then #ci# else ci end
,vssn =case when #vssn# is not null then #vssn# else vssn end
where userno=#userno#;
update userstatus set playbar = #playbar#
,isplay = #isplay#
where userno = #userno#;
insert into userstatus(userno, playbar)
select a.userno, #playbar#
from users a
left outer join userstatus b on a.userno = b.userno
where a.userno = #userno# and b.no is null;
</update>
<update id="users.exitjoin" parameterClass="hashtable">
update users set <include refid="sql.up"></include>
,username='삭제됨',usernameeng=null,email=null,mobile=null,telno=null,userpno=null,bankno=null,post=null,address1=null,address2=null,birthday=null,di=null,ci=null,vssn=null,authplatform=0,status=99
where
<isNotNull property="userno">userno=#userno#</isNotNull>
<isNotNull property="usernos">userno in ($usernos$)</isNotNull>
</update>
<!--<update id="users.dormant" parameterClass="hashtable">
update users set <include refid="sql.up"></include>,status=8
where userno in ($usernos$)
</update>-->
<update id="users.dormant" parameterClass="hashtable">
insert into userdormant(userno,username,usernameeng,email,isacceptemail,mobile
,telno,userpno,bankno,post,address1,address2,birthday,cdt)
select a.userno,a.username,a.usernameeng,a.email,a.isacceptemail,a.mobile
,a.telno,a.userpno,a.bankno,a.post,a.address1,a.address2, a.birthday,<include refid="sql.now"></include> cdt
from users a
left outer join userdormant b on b.userno = a.userno
where a.userno in ($usernos$)
and b.userno is null;
update users set <include refid="sql.up"></include>
,username='삭제됨',usernameeng=null,email=null,mobile=null,telno=null,userpno=null,bankno=null,post=null,address1=null,address2=null,birthday=null,status=8
where userno in ($usernos$);
</update>
<update id="users.dormant.insert" parameterClass="hashtable">
insert into userdormant(userno,username,usernameeng,email,isacceptemail,mobile
,telno,userpno,bankno,post,address1,address2,birthday,cdt)
select a.userno,a.username,a.usernameeng,a.email,a.isacceptemail,a.mobile
,a.telno,a.userpno,a.bankno,a.post,a.address1,a.address2, a.birthday,<include refid="sql.now"></include> cdt
from users a
left outer join userdormant b on b.userno = a.userno
where date_add(a.logintime,interval 1 year) &lt; now();
and a.status != 99
update users set <include refid="sql.up"></include>
,username='삭제됨',usernameeng=null,email=null,mobile=null,telno=null,userpno=null,bankno=null,post=null,address1=null,address2=null,birthday=null,status=8
where date_add(a.logintime,interval 1 year) &lt; now();
and a.status != 99
</update>
<select id="users.ee" parameterClass="int" resultClass="users">
update users set eastereggkey=FLOOR(10000000 + (RAND() * 99999999)),eetime=<include refid="sql.now"></include> where userno=#userno#;
select a.userno,a.eastereggkey,a.usertype,a.username
,b.subdomain
from users a
left outer join assign b on b.asno=a.asno and b.issite=1 and b.isdel=0
where a.userno=#userno#;
</select>
<select id ="users.batchcheck.bybrnos" parameterClass="string" resultClass="users">
select distinct(asno),brno
from assign
where status =1 and isdel=0
<isNotNull property="brnos">and brno in ($brnos$)</isNotNull>
</select>
<select id="users.usersall" parameterClass="string" resultClass="users">
select
userno,usertype,jointype,snsid,userkind,userid,userpass,username,usernameeng,gender,birthday,email,isacceptemail,mobile,isacceptmobile,telno,asno,pasname,depart,ccposition,ccpositionetc,fgnoprofile
,ccjobs,userpno,bankname,bankno,post,address1,address2,introhtml,status,exitreason,logintime,loginkey,send335time,pwcalltime,pwcallno,eastereggkey,eetime,kfcfyear,isassignuser,uduty,slevel,edus,remotekey
from users
</select>
<select id="users.batchcheck" parameterClass="string" resultClass="users">
select userid,CAST(AES_DECRYPT(UNHEX(email), <include refid="sql.digest"></include>) AS char) email from users
where
<isNotNull property="userids">userid in ($userids$)</isNotNull>
<isNotNull property="emails">
CAST(AES_DECRYPT(UNHEX(email), <include refid="sql.digest"></include>) AS char) in ($emails$)
</isNotNull>
</select>
<update id="users.batch" parameterClass="users">
insert into users (usertype,jointype,userid,userpass,username,gender,email,isacceptemail,isacceptmobile,isassignuser,mobile,telno,asno,depart,ccposition,ccjobs,uduty,status,logintime,<include refid="sql.inc"></include><!--,devcol-->)
<iterate property="Us" open="" conjunction="union all" close="">
select 1,0
,#Us[].userid#
,#Us[].userpass#
,#Us[].username#
,null
,HEX(AES_ENCRYPT(#Us[].email#, <include refid="sql.digest"></include>))
,1
,1
,1
,HEX(AES_ENCRYPT(#Us[].mobile#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#Us[].telno#, <include refid="sql.digest"></include>))
,#Us[].asno#
,#Us[].depart#
,null
,null
,#Us[].uduty#
,1,now(), now(), #uno#, now(), #uno#, #uip#
<!--,#Us[].introhtml#-->
from (select 1 col1) a
<!--left outer join assign b on b.brno=#Us[].brno# and b.isdel=0
left outer join comcode c on c.cgroup='jobposition' and c.ccode=#Us[].ccposition#-->
</iterate>;
</update>
<select id="users.eecall" parameterClass="hashtable" resultClass="users">
select userno,usertype,username from users where userno=#userno# and eastereggkey=#eek# and date_add(eetime, interval 10 second) &gt; <include refid="sql.now"></include>;
update users set eastereggkey=null,eetime=null,loginkey=#loginkey# where userno=#userno#
</select>
<select id="users.eecall2" parameterClass="hashtable" resultClass="users">
select userno,usertype,username,userid from users where userno=#userno# and eastereggkey=#eek# and date_add(eetime, interval 15 second) &gt; <include refid="sql.now"></include>;
update users set eastereggkey=null,eetime=null,loginkey=null where userno=#userno#
</select>
<update id="users.loginkey" parameterClass="hashtable">
update users set loginkey=#loginkey#,logintime =<include refid="sql.now" ></include>,send335time = null where userno=#userno#
</update>
<update id="users.loginkey2" parameterClass="hashtable">
update users set loginkey=#loginkey#,logintime =<include refid="sql.now" ></include>,send335time = null where userno=#userno#;
insert into loginlog (logsite,userno, loginstatus, logindata, <include refid="sql.inc"></include>)
values (#loginsite#,#userno#, #loginstatus#, #logindata#, <include refid="sql.inv"></include>)
</update>
<select id="users.assignfees" parameterClass="hashtable" resultClass="assignfee">
select a.asno,a.fyear,a.fprice,a.fdate,a.fmemo,a.status
from assignfee a
<dynamic prepend="where">
<isNotNull property="asnos" prepend="and">a.asno in ($asnos$)</isNotNull>
<isNotNull property="asno" prepend="and">a.asno =#asno#</isNotNull>
<isNotNull property="fyear" prepend="and">a.fyear=#fyear#</isNotNull>
<isNotNull property="status" prepend="and">a.status=#status#</isNotNull>
</dynamic>
order by a.asno,a.fyear desc
</select>
<select id="users.assign.newascode" parameterClass="int" resultClass="int">
select ifnull(max(b.ascode),0) + 1
from (select 1 col1) a
left outer join assign b on b.asno is not null
</select>
<select id="users.assign.check.ascode" parameterClass="hashtable" resultClass="assign">
select a.asno
from assign a
<dynamic prepend="where">
<isNotNull property="asnonot" prepend="and">a.asno &lt;&gt; #asnonot#</isNotNull>
<isNotNull property="ascode" prepend="and">a.ascode=#ascode#</isNotNull>
</dynamic>
</select>
<select id="users.assign.check.brno" parameterClass="hashtable" resultClass="assign">
select a.asno
from assign a
<dynamic prepend="where">
<isNotNull property="asnonot" prepend="and">a.asno &lt;&gt; #asnonot#</isNotNull>
<isNotNull property="brno" prepend="and">a.brno=#brno#</isNotNull>
</dynamic>
</select>
<insert id="users.assign.in" parameterClass="hashtable">
insert into assign (ascode,isjoin,joinyear,joinprice,asname,ceoname,brno,grno,btype,bkind,salesamount,homeurl,mcount,aday,astype,asctg,askey,post,address1,address2,fgnobno,fgnobank,joindate,exitdate,status,issite,subdomain,sitename,sitelogo,sitefooter,ismain,isdel,
eino,mname,mphone,taxemail,<include refid="sql.inc"></include>)
values (#ascode#,#isjoin#,#joinyear#,#joinprice#,#asname#,#ceoname#,#brno#,#grno#,#btype#,#bkind#,#salesamount#,#homeurl#,#mcount#,#aday#,#astype#,#asctg#,#askey#,#post#,#address1#,#address2#,#fgnobno#,#fgnobank#,#joindate#,#exitdate#,#status#,0,null,null,null,null,0,0,
#eino#,#mname#
,HEX(AES_ENCRYPT(#mphone#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#taxemail#, <include refid="sql.digest"></include>))
,<include refid="sql.inv"></include>);
<selectKey type="post" property="asno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="users.assign.up" parameterClass="hashtable">
update assign set <include refid="sql.up"></include>
<isNotNull property="saveflag">
,ascode=#ascode#,isjoin=#isjoin#,joinyear=#joinyear#,joinprice=#joinprice#,astype=#astype#,asctg=#asctg#,askey=#askey#,joindate=#joindate#,exitdate=#exitdate#,status=#status#
</isNotNull>
,asname=#asname#,ceoname=#ceoname#,brno =#brno#,grno =#grno#,btype =#btype#,bkind =#bkind#,salesamount=#salesamount#,homeurl=#homeurl#
,mcount=#mcount#,aday =#aday# ,post =#post#,address1=#address1#,address2=#address2#,fgnobno=#fgnobno#,fgnobank=#fgnobank#
,eino=#eino#
,mname=case when #mname# is not null then #mname# else mname end
,mphone =case when #mphone# is not null then HEX(AES_ENCRYPT(#mphone#, <include refid="sql.digest"></include>)) else mphone end
,taxemail =case when #taxemail# is not null then HEX(AES_ENCRYPT(#taxemail#, <include refid="sql.digest"></include>)) else taxemail end
where asno=#asno#
</update>
<update id="users.assign.del" parameterClass="hashtable">
update assign set <include refid="sql.up"></include>
,isdel=1,brno=null
where asno=#asno#
</update>
<update id="users.assignman.in" parameterClass="hashtable">
insert into assignman (asno,mtype,jtype,depart,mname,position,telno,mobile,fax,email,post,address1,address2,isdel,<include refid="sql.inc"></include>)
values (#asno#,#mtype#,#jtype#,#depart#,#mname#,#position#
,HEX(AES_ENCRYPT(#telno#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#fax#, <include refid="sql.digest"></include>))
,HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>))
,#post#,#address1#,#address2#,0,<include refid="sql.inv"></include>)
</update>
<update id="users.assignman.up" parameterClass="hashtable">
update assignman set <include refid="sql.up"></include>
,mtype =#mtype#
,jtype =#jtype#
,depart =#depart#
,mname =#mname#
,position=#position#
,telno =HEX(AES_ENCRYPT(#telno#, <include refid="sql.digest"></include>))
,mobile =HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>))
,fax =HEX(AES_ENCRYPT(#fax#, <include refid="sql.digest"></include>))
,email =HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>))
,post =#post#
,address1=#address1#
,address2=#address2#
where asmno=#asmno#
</update>
<update id="users.assignman.del" parameterClass="hashtable">
update assignman set <include refid="sql.up"></include>
,isdel = 1
where asmno=#asmno#
</update>
<update id="users.assignfee.in" parameterClass="hashtable">
insert into assignfee (asno,fyear,fprice,fdate,fmemo,status,<include refid="sql.inc"></include>)
select #asno#,#fyear#,#fprice#,#fdate#,#fmemo#,#status#,<include refid="sql.inv"></include>
from (select 1 col1) a
left outer join assignfee b on b.asno=#asno# and b.fyear=#fyear#
where b.asno is null
</update>
<update id="users.assignfee.up" parameterClass="hashtable">
update assignfee set <include refid="sql.up"></include>
,fprice=#fprice#,fdate =#fdate#,fmemo =#fmemo#,status=#status#
where asno=#asno# and fyear=#fyear#
</update>
<update id="users.assignfee.del" parameterClass="hashtable">
delete from assignfee where asno=#asno# and fyear=#fyear#
</update>
<update id="users.assignsite.save" parameterClass="hashtable">
update assign set <include refid="sql.up"></include>,issite=#issite#,subdomain=#subdomain#,sitename=#sitename#
,siteip=#siteip#
,sitelogo=#sitelogo#,sitefooter=#sitefooter# where asno=#asno#
</update>
<select id="users.getlectbyusernos" parameterClass="string" resultClass="users.lect">
select a.userno,a.username
,a.isacceptemail
,CAST(AES_DECRYPT(UNHEX(a.email), <include refid="sql.digest"></include>) AS char) email
from users a
where a.userno in ($usernos$) and a.status=1
order by a.username
</select>
<select id="users.me" parameterClass="int" resultClass="users">
select userno,username
,CAST(AES_DECRYPT(UNHEX(email), <include refid="sql.digest"></include>) AS char) email
from users where userno=#userno#
</select>
<!--<update id="users.leave" parameterClass="hashtable">
update users set <include refid="sql.up"></include>
,status=99,username='탈퇴',email=null,userid=null,mobile=null,telno=null,userpno=null,bankno=null
where status&lt;&gt;99 <isNotNull property="usernos"> and userno in ($usernos$)</isNotNull>
</update>-->
<select id="users.userlogin" parameterClass="hashtable" resultClass="users">
select a.userid, a.userpass,a.userno,a.username,a.status,usertype,a.asno,a.udt
,b.subdomain
from users a
left outer join assign b on b.asno=a.asno and b.issite=1 and b.isdel=0
<!--<isNotNull property="subdomain">
inner join assign b on b.asno=a.asno and b.subdomain=#subdomain#
</isNotNull>-->
where (userpass=#userpass# or #userpass# is null) and a.usertype=1
<isNotNull property="userid">
and a.userid=#userid#
</isNotNull>
<isNotNull property="useridsns">
and a.snsid=#useridsns#
</isNotNull>
</select>
<update id="users.asno.save" parameterClass="hashtable">
update users set asno=#asno# where userno=#userno#
</update>
<select id="users.findme" parameterClass="hashtable" resultClass="users">
select a.userno,a.username
,a.userid
,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
from users a
where a.usertype in (1,11) and a.status=1
<isNotNull property="email">
and a.email=HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>))
</isNotNull>
<isNotNull property="mobile">
and a.mobile=HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>))
</isNotNull>
</select>
<select id="users.findmes" parameterClass="hashtable" resultClass="users">
select a.userno,a.username
,a.userid
,a.pwcallno
,CAST(AES_DECRYPT(UNHEX(b.mobile), <include refid="sql.digest"></include>) AS char) mobile
,CAST(AES_DECRYPT(UNHEX(b.email), <include refid="sql.digest"></include>) AS char) email
from users a
left outer join userdormant b on b.userno = a.userno
where a.usertype in (1,11) and a.status &lt; 9
<isNotNull property="userno">
and a.userno = #userno#
</isNotNull>
<isNotNull property="usertype">
and a.usertype = #usertype#
</isNotNull>
<isNotNull property="email">
and ( a.email=HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>)) or b.email=HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>)) )
</isNotNull>
<isNotNull property="mobile">
and ( a.mobile=HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>)) or b.mobile=HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>)) )
</isNotNull>
</select>
<update id="users.pwcalltime" parameterClass="long">
update users set pwcalltime=<include refid="sql.now"></include>,pwcallno=#pwcallno#<!--floor(RAND() * (30000-1)+1)--> where userno=#userno#
</update>
<select id="users.pwuser" parameterClass="hashtable" resultClass="users">
select userno
,userid
,username
,usertype
,pwcallno
from users
where userno=#userno#
<isNotNull property="pwcallno">
and pwcallno=#pwcallno# and pwcalltime is not null and date_add(pwcalltime, interval 24 hour) &gt; <include refid="sql.now"></include>
</isNotNull>
</select>
<update id="users.resetuser" parameterClass="hashtable">
update users set userpass=#userpass#, pwcalltime=null,pwcallno=null where userno=#userno# and pwcalltime is not null and pwcallno=#pwcallno# and date_add(pwcalltime, interval 24 hour) &gt; <include refid="sql.now"></include>
</update>
<update id="users.usercheck" parameterClass="hashtable">
update usercheck a
inner join users b on b.userno=a.userno <isNotNull property="userpass">and b.userpass=#userpass#</isNotNull>
set a.checkkey=#checkkey#
where a.userno=#userno#;
insert into usercheck(userno,checkkey)
select a.userno,#checkkey#
from users a
left outer join usercheck b on b.userno=a.userno
where a.userno=#userno# <isNotNull property="userpass">and a.userpass=#userpass#</isNotNull> and b.userno is null
</update>
<select id="users.usercheckconfirm" parameterClass="hashtable" resultClass="int">
select ifnull(b.userno,0)
from (select 1 col1) a
left outer join usercheck b on b.userno=#userno# and b.checkkey=#checkkey#;
update usercheck set checkkey=0 where userno=#userno#
</select>
<update id="users.exit" parameterClass="hashtable">
update users set <include refid="sql.up"></include>
,exitreason=#exitreason#
,username='탈퇴회원',usernameeng=null,email=null,mobile=null,telno=null,birthday=null,vssn=null,di=null,ci=null,userpno=null,bankno=null,post=null,address1=null,address2=null,authplatform=0,status=99
where userno=#userno#
</update>
<update id="users.remotelogin.set" parameterClass="hashtable">
update users a
inner join assign b on b.asno=a.asno and b.siteip like concat('%',#siteip#,'%')
set a.remotekey=#remotekey#
where a.userid=#userid# and a.status=1
</update>
<select id="users.remotelogin" parameterClass="hashtable" resultClass="users">
select a.userno from users a where a.userid=#userid# and a.status=1 and a.remotekey=#remotekey#;
update users set remotekey=null where userid=#userid#
</select>
<select id="users.remoteloginnoauth" parameterClass="hashtable" resultClass="users">
select a.userno,b.subdomain
from users a
left outer join assign b on b.asno=a.asno
where a.userid=#userid# and a.status=1
</select>
<select id="users.users.foroffby" parameterClass="string" resultClass="users">
select a.userno,a.username,a.isassignuser,a.kfcfyear,a.edus
,CAST(AES_DECRYPT(UNHEX(a.email), <include refid="sql.digest"></include>) AS char) email
,CAST(AES_DECRYPT(UNHEX(a.telno), <include refid="sql.digest"></include>) AS char) telno
,cc.cname ccpositionname
from users a
left outer join comcode cc on cc.ccode=a.ccposition
where a.userno in ($usernos$)
</select>
<select id="users.users.assign" parameterClass="hashtable" resultClass="assign">
select b.asno,b.asname,b.brno
,b.ceoname,b.post,b.address1,b.address2
,b.btype,b.bkind,b.eino,b.mname
,CAST(AES_DECRYPT(UNHEX(b.mphone), <include refid="sql.digest"></include>) AS char) mphone
,CAST(AES_DECRYPT(UNHEX(b.taxemail), <include refid="sql.digest"></include>) AS char) taxemail
,b.fgnobno
,b.isjoin,b.ascode,b.astype,b.asctg,b.joindate,b.status
,c1.cname astypename,c2.cname asctgname
from users a
inner join assign b on b.asno = a.asno
left outer join comcode c1 on c1.ccode=b.astype
left outer join comcode c2 on c2.ccode=b.asctg
where a.status=1 <!--and b.status=1--> and a.userno = #userno#
</select>
<select id="users.check.snsid" 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.email,a.isacceptemail,a.mobile,a.isacceptmobile
,a.telno,a.asno,a.pasname,a.depart,a.ccposition,a.ccpositionetc,a.fgnoprofile,a.ccjobs,a.userpno,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
from users a
where a.snsid=#snsid# and a.jointype=#jointype#
</select>
<update id="users.snslink.up" parameterClass="hashtable">
update users set <include refid="sql.up"></include>
,snsid=#snsid# ,jointype=#jointype#
where userno=#userno#
</update>
<select id="users.councels" parameterClass="hashtable" resultClass="councel">
select a.bno,a.qtext,a.atext
,a.bldgcat
,b.cname bldgcatname
,a.cdt,c.username coname,c.userid coid
,row_number() over(order by a.cdt desc) rno
,count(a.cno) over() pagetotalcount
from councel a
inner join users c on c.userno = a.cno
left outer join comcode b on b.ccode = a.bldgcat
where a.userno = #userno# and a.isdel = 0
order by a.cdt desc
</select>
<insert id="councel.in" parameterClass="hashtable">
insert into councel(userno,bldgcat,qtext,atext,<include refid="sql.inc"></include>)
values (#userno#,#bldgcat#,#qtext#,#atext#,<include refid="sql.inv"></include>);
<selectKey type="post" property="bno" resultClass="int">SELECT LAST_INSERT_ID()</selectKey>
</insert>
<update id="councel.up" parameterClass="hashtable">
update councel set <include refid="sql.up"></include>
,bldgcat = #bldgcat#
,qtext = #qtext#
,atext = #atext#
where bno=#bno#
</update>
<update id="councel.del" parameterClass="hashtable">
update councel set <include refid="sql.up"></include>
,isdel = 1
where bno = #bno#
</update>
<update id="users.up.asno" parameterClass="hashtable">
update users set <include refid="sql.up"></include>
,asno =#asno#
where userno=#userno#
</update>
<select id="assign.assings3" parameterClass="hashtable" resultClass="data">
select a.asno intval,a.fgnobno longval
from assign a
left outer join users b on b.asno = a.asno
where a.isdel=0
<isNotNull property="userno" prepend="and">b.userno=#userno#</isNotNull>
</select>
<update id="users.disable" parameterClass="hashtable">
update users set status = 9
<dynamic prepend="where">
<isNotNull property="userid" prepend="and">userid =#userid#</isNotNull>
<isNotNull property="userno" prepend="and">userno =#userno#</isNotNull>
</dynamic>
</update>
<update id="users.resetuserpass" parameterClass="hashtable">
insert into userpasslog (userno, userpass, cdt, uip)
select #userno#, #userpass#, now(), #uip#
from (select 1 col1) a
left outer join userpasslog b on b.userno=#userno#
where b.userno is null;
update userpasslog set userpass = #userpass#
where userno=#userno#;
update users set <isNotEmpty property="userpass">userpass=#userpass#,</isNotEmpty>udt=<include refid="sql.now"></include> where userno=#userno#;
</update>
<select id="users.dormants" parameterClass="hashtable" resultClass="users">
select a.userno,username,usernameeng,a.email,a.isacceptemail
,a.mobile,a.telno,a.userpno,a.bankno,a.post,a.address1,a.address2
,a.birthday
from userdormant a where a.userno = #userno#
</select>
<update id="users.dormant.cancel" parameterClass="hashtable">
update users a
left outer join userdormant b on b.userno = a.userno
set a.username = b.username
,a.usernameeng = b.usernameeng
,a.email = b.email
,a.isacceptemail = b.isacceptemail
,a.mobile = b.mobile
,a.telno = b.telno
,a.userpno = b.userpno
,a.bankno = b.bankno
,a.post = b.post
,a.address1 = b.address1
,a.address2 = b.address2
,a.birthday = b.birthday
,a.status =1
where a.userno in ($usernos$);
delete from userdormant where userno in ($usernos$);
</update>
<update id="users.dormant.delete" parameterClass="hashtable">
delete from userdormant where userno in ($usernos$);
</update>
<update id="users.dormant.del" parameterClass="hashtable">
update users a
left outer join userdormant b on b.userno = a.userno
set set <include refid="sql.up"></include>
,status = 99,username='삭제됨',usernameeng=null,email=null,mobile=null,telno=null,userpno=null,bankno=null,post=null,address1=null,address2=null,birthday=null,di=null,ci=null,vssn=null,authplatform=0
where date_add(b.cdt,interval 1 year) &lt; now();
delete from userdormant where date_add(cdt,interval 1 year) &lt; now();
</update>
<select id="users.dormants.del" parameterClass="hashtable" resultClass="data">
select a.userno longval, regexp_replace(b.userid , '(?&lt;=.{3}).','*') strval
,CAST(AES_DECRYPT(UNHEX(a.mobile),<include refid="sql.digest"></include>) AS char) strval2
,date_add(a.cdt, interval 335 day) time
,b.isacceptmobile intval
from userdormant a
inner join users b on b.userno = a.userno
where date_format(date_add(a.cdt, interval 335 day),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
</select>
<select id="users.dormants.save" parameterClass="hashtable" resultClass="data">
select a.userno longval, regexp_replace(a.userid , '(?&lt;=.{3}).' , '*') strval
,CAST(AES_DECRYPT(UNHEX(a.mobile),<include refid="sql.digest"></include>) AS char) strval2
,date_add(a.logintime, interval 335 day) time
,a.isacceptmobile intval
from users a
where a.usertype =1 and a.status=1
and date_format(date_add(a.logintime, interval 366 day),'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
</select>
<update id="users.edit" parameterClass="hashtable">
update users set <include refid="sql.up"></include>
,usertype=#usertype#
<isNotNull property="userpass">,userpass =#userpass#</isNotNull>
,username =case when #username# is not null then #username# else username end
,email =HEX(AES_ENCRYPT(#email#, <include refid="sql.digest"></include>))
,mobile =HEX(AES_ENCRYPT(#mobile#, <include refid="sql.digest"></include>))
,asno =case when #asno# is not null then #asno# else asno end
,depart =#depart#
,ccposition =case when #ccposition# is not null then #ccposition# else ccposition end
,ccpositionetc =case when #ccpositionetc# is not null then #ccpositionetc# else ccpositionetc end
<isNotNull property="fgnoprofile">,fgnoprofile =#fgnoprofile#</isNotNull>
,userpno =case when #userpno# is not null then HEX(AES_ENCRYPT(#userpno#, <include refid="sql.digest"></include>)) else userpno end
,bankname =case when #bankname# is not null then #bankname# else bankname end
,bankno =case when #bankno# is not null then HEX(AES_ENCRYPT(#bankno#, <include refid="sql.digest"></include>)) else bankno end
,post =case when #post# is not null then #post# else post end
,address1 =case when #address1# is not null then #address1# else address1 end
,address2 =case when #address2# is not null then #address2# else address2 end
,introhtml =case when #introhtml# is not null then #introhtml# else introhtml end
where userno=#userno#
</update>
</statements>
</sqlMap>