fix mapper bugs for postgresql

This commit is contained in:
oonxt 2022-03-07 14:39:17 +08:00
parent 3fe3d7f863
commit 23ceb7be36
33 changed files with 2107 additions and 1831 deletions

View File

@ -259,7 +259,7 @@ public class Institutions extends JpaBaseEntity implements Serializable {
} }
public boolean isCaptchaSupport() { public boolean isCaptchaSupport() {
return (captchaSupport !=null && captchaSupport.equalsIgnoreCase("YES") ? true : false); return "YES".equalsIgnoreCase(captchaSupport);
} }

View File

@ -257,13 +257,13 @@ public class LoginRepository {
userInfo.getLoginCount() + 1, userInfo.getLoginCount() + 1,
userInfo.getId() userInfo.getId()
}, },
new int[] { Types.VARCHAR, Types.VARCHAR, Types.INTEGER, Types.VARCHAR }); new int[] { Types.TIMESTAMP, Types.VARCHAR, Types.INTEGER, Types.VARCHAR });
} }
public void updateLastLogoff(UserInfo userInfo) { public void updateLastLogoff(UserInfo userInfo) {
jdbcTemplate.update( LOGOUT_USERINFO_UPDATE_STATEMENT, jdbcTemplate.update( LOGOUT_USERINFO_UPDATE_STATEMENT,
new Object[] { userInfo.getLastLogoffTime(), userInfo.getId() }, new Object[] { userInfo.getLastLogoffTime(), userInfo.getId() },
new int[] { Types.VARCHAR, Types.VARCHAR }); new int[] { Types.TIMESTAMP, Types.VARCHAR });
} }
public class UserInfoRowMapper implements RowMapper<UserInfo> { public class UserInfoRowMapper implements RowMapper<UserInfo> {

View File

@ -1,32 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AccountsMapper"> <mapper namespace="org.maxkey.persistence.mapper.AccountsMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="appId != null and appId != ''"> <if test="appId != null and appId != ''">
and appid = #{appId} and appid = #{appId}
</if> </if>
<if test="username != null and username != ''"> <if test="username != null and username != ''">
and username = #{username} and username = #{username}
</if> </if>
<if test="relatedUsername != null and relatedUsername != ''"> <if test="relatedUsername != null and relatedUsername != ''">
and relatedusername = #{relatedUsername} and relatedusername = #{relatedUsername}
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="Accounts" resultType="Accounts">
<select id="queryPageResults" parameterType="Accounts" resultType="Accounts"> select
select *
* from
from mxk_accounts
mxk_accounts where instid = #{instId}
where <include refid="where_statement"/>
(1=1) </select>
<include refid="where_statement"/>
</select> <select id="queryUserNotInStrategy" parameterType="AccountsStrategy" resultType="UserInfo">
select
*
from mxk_userinfo u
where u.instid = #{instId}
and not exists(
select 1 from mxk_accounts ac
where ac.appid = #{appId}
and ac.instid = #{instId}
and ac.userid = u.id
and ac.createtype='automatic'
)
<if test="filters != null and filters != ''">
and (${filters})
</if>
<if test="orgIdsList != null and orgIdsList != ''">
and u.departmentid in( ${orgIdsList})
</if>
</select>
<delete id="deleteByStrategy" parameterType="AccountsStrategy">
delete from mxk_accounts ac
where ac.instid = #{instId}
and ac.createtype = 'automatic'
and ac.appid = #{appId}
and ac.strategyid = #{id}
and not exists(
select 1
from mxk_userinfo u
where instid = #{instId}
and u.id=ac.userid
<if test="filters != null and filters != ''">
and (${filters})
</if>
<if test="orgIdsList != null and orgIdsList != ''">
and u.departmentid in ( ${orgIdsList})
</if>
)
</delete>
</mapper> </mapper>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AccountsStrategyMapper">
<sql id="where_statement">
<if test="id != null and id != ''">
and mas.id = #{id}
</if>
<if test="appId != null and appId != ''">
and mas.appid = #{appId}
</if>
<if test="name != null and name != ''">
and mas.name = #{name}
</if>
</sql>
<select id="queryPageResults" parameterType="AccountsStrategy" resultType="AccountsStrategy">
select
mas.*,
ma.icon appicon
from
mxk_accounts_strategy mas,
mxk_apps ma
where ma.instid = #{instId}
and mas.instid = #{instId}
and mas.appid = ma.id
<include refid="where_statement"/>
</select>
</mapper>

View File

@ -1,30 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AppsAdaptersMapper"> <mapper namespace="org.maxkey.persistence.mapper.AppsAdaptersMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and name like '%${name}%' and name like '%${name}%'
</if> </if>
<if test="protocol != null and protocol != ''"> <if test="protocol != null and protocol != ''">
and protocol = #{protocol} and protocol = #{protocol}
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="AppsAdapters" resultType="AppsAdapters">
<select id="queryPageResults" parameterType="AppsAdapters" resultType="AppsAdapters"> select
select *
* from
from mxk_apps_adapters
mxk_apps_adapters where
where (1=1)
(1=1) <include refid="where_statement"/>
<include refid="where_statement"/> order by sortindex
order by sortindex </select>
</select>
</mapper> </mapper>

View File

@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AppsCasDetailsMapper"> <mapper namespace="org.maxkey.persistence.mapper.AppsCasDetailsMapper">
<select id="getAppDetails" parameterType="string" resultType="AppsCasDetails"> <select id="getAppDetails" parameterType="string" resultType="AppsCasDetails">
select select *
* from mxk_apps_cas_details cd,
from mxk_apps app
mxk_apps_cas_details cd, where app.instid = cd.instid
mxk_apps app and app.status = 1
where and cd.id = app.id
status = 1 and (
and cd.id = app.id app.id = #{value}
and ( or lower(cd.service) = lower(substring(#{value}, 1, length(cd.service)))
app.id = #{value} )
or lower(cd.service) = lower(substring(#{value},1,length(cd.service))) </select>
)
</select>
</mapper> </mapper>

View File

@ -1,17 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AppsFormBasedDetailsMapper"> <mapper namespace="org.maxkey.persistence.mapper.AppsFormBasedDetailsMapper">
<select id="getAppDetails" parameterType="string" resultType="AppsFormBasedDetails"> <select id="getAppDetails" parameterType="string" resultType="AppsFormBasedDetails">
select select *
* from mxk_apps_form_based_details fbd,
from mxk_apps app
mxk_apps_form_based_details fbd, where app.instId = fbd.instId
mxk_apps app and app.id = #{value}
where and fbd.id = #{value}
app.id = #{value} and fbd.id = app.id
and fbd.id = #{value} and status = 1
and fbd.id = app.id </select>
and status = 1
</select>
</mapper> </mapper>

View File

@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AppsJwtDetailsMapper"> <mapper namespace="org.maxkey.persistence.mapper.AppsJwtDetailsMapper">
<select id="getAppDetails" parameterType="string" resultType="AppsJwtDetails"> <select id="getAppDetails" parameterType="string" resultType="AppsJwtDetails">
select select *
* from mxk_apps_jwt_details jd,
from mxk_apps app
mxk_apps_jwt_details jd, where app.instid = jd.instid
mxk_apps app and app.id = #{value}
where and jd.id = #{value}
app.id = #{value} and status = 1
and jd.id = #{value} and jd.id = app.id
and jd.id = app.id </select>
and status = 1
</select>
</mapper> </mapper>

View File

@ -1,197 +1,186 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AppsMapper"> <mapper namespace="org.maxkey.persistence.mapper.AppsMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and name like '%${name}%' and name like '%${name}%'
</if> </if>
<if test="protocol != null and protocol != ''"> <if test="protocol != null and protocol != ''">
and protocol = #{protocol} and protocol = #{protocol}
</if> </if>
<if test="credential != null and credential != ''"> <if test="credential != null and credential != ''">
and credential = #{credential} and credential = #{credential}
</if> </if>
<if test="category != null and category != ''"> <if test="category != null and category != ''">
and category = #{category} and category = #{category}
</if> </if>
<if test="vendor != null and vendor != ''"> <if test="vendor != null and vendor != ''">
and vendor = #{vendor} and vendor = #{vendor}
</if> </if>
</sql>
</sql>
<select id="queryPageResults" parameterType="Apps" resultType="Apps">
select <select id="queryPageResults" parameterType="Apps" resultType="Apps">
* select
from *
mxk_apps from
where mxk_apps
(1=1) where instid = #{instId}
<include refid="where_statement"/> <include refid="where_statement"/>
order by sortindex order by sortindex
</select> </select>
<insert id="insertApp" parameterType="Apps"> <insert id="insertApp" parameterType="Apps">
insert into mxk_apps( insert into mxk_apps(id,
id, name,
name, icon,
icon, loginurl,
loginurl, protocol,
protocol, category,
category, secret,
secret, description,
description, vendor,
vendor, vendorurl,
vendorurl, credential,
sharedusername,
credential, sharedpassword,
sharedusername, systemuserattr,
sharedpassword, isextendattr,
systemuserattr, extendattr,
userpropertys,
isextendattr, issignature,
extendattr, isadapter,
userpropertys, adapterid,
adaptername,
issignature, adapter,
principal,
isadapter, credentials,
adapter, visible,
sortindex,
principal, createdby,
credentials, createddate,
status,
visible, logouturl,
logouttype,
sortindex, instid)
values (#{id},
createdby, #{name},
createddate, #{icon},
#{loginUrl},
status, #{protocol},
#{category},
logouturl, #{secret},
logouttype #{description},
)values( #{vendor},
#{id}, #{vendorUrl},
#{name}, #{credential},
#{icon}, #{sharedUsername},
#{loginUrl}, #{sharedPassword},
#{protocol}, #{systemUserAttr},
#{category}, #{isExtendAttr},
#{secret}, #{extendAttr},
#{description}, #{userPropertys},
#{vendor} , #{isSignature},
#{vendorUrl}, #{isAdapter},
#{adapterId},
#{credential}, #{adapterName},
#{sharedUsername}, #{adapter},
#{sharedPassword}, #{principal},
#{systemUserAttr}, #{credentials},
#{visible},
#{isExtendAttr}, #{sortIndex},
#{extendAttr}, #{createdBy},
#{userPropertys}, #{createdDate},
#{isSignature}, #{status},
#{logoutUrl},
#{isAdapter}, #{logoutType},
#{adapter}, #{instId})
</insert>
#{principal},
#{credentials}, <update id="updateApp" parameterType="Apps">
update mxk_apps set
#{visible}, name = #{name},
<if test="icon != null">
#{sortIndex}, icon = #{icon},
</if>
#{createdBy}, loginurl = #{loginUrl},
#{createdDate} , protocol = #{protocol},
category = #{category},
#{status}, secret = #{secret},
description = #{description},
#{logoutUrl}, vendor = #{vendor},
#{logoutType} vendorurl = #{vendorUrl},
)
</insert> credential = #{credential},
sharedusername = #{sharedUsername},
<update id="updateApp" parameterType="Apps" > sharedpassword = #{sharedPassword},
update mxk_apps set systemuserattr = #{systemUserAttr},
name = #{name}, <!--
<if test="icon != null"> isextendattr = #{isExtendAttr},
icon = #{icon}, extendattr = #{extendAttr},
</if> -->
loginurl = #{loginUrl}, userpropertys = #{userPropertys},
protocol = #{protocol}, issignature = #{isSignature},
category = #{category},
secret = #{secret}, <if test="adapter != null">
description = #{description}, isadapter = #{isAdapter},
vendor = #{vendor}, adapterid = #{adapterId},
vendorurl = #{vendorUrl}, adaptername = #{adapterName},
adapter = #{adapter},
credential = #{credential}, </if>
sharedusername = #{sharedUsername}, principal = #{principal},
sharedpassword = #{sharedPassword}, credentials = #{credentials},
systemuserattr = #{systemUserAttr}, visible = #{visible},
<!-- sortindex = #{sortIndex},
isextendattr = #{isExtendAttr},
extendattr = #{extendAttr}, modifiedby = #{modifiedBy},
--> modifieddate = #{modifiedDate},
userpropertys = #{userPropertys},
issignature = #{isSignature}, status = #{status},
<if test="adapter != null"> logouturl = #{logoutUrl},
isadapter = #{isAdapter}, logouttype = #{logoutType}
adapter = #{adapter}, where
</if> ID = #{id}
principal = #{principal}, </update>
credentials = #{credentials},
visible = #{visible}, <select id="queryMyApps" parameterType="UserApps" resultType="UserApps">
sortindex = #{sortIndex}, select distinct
app.*
modifiedby = #{modifiedBy}, from
modifieddate = #{modifiedDate}, mxk_apps app,mxk_group_privileges gp,mxk_groups g
where
status = #{status}, app.id=gp.appid
and gp.groupid=g.id
logouturl = #{logoutUrl}, and app.instid = #{instId}
logouttype = #{logoutType} and gp.instid = #{instId}
where and g.instid = #{instId}
id = #{id} and app.visible != 0
</update> and (
g.id='ROLE_ALL_USER'
<select id="queryMyApps" parameterType="UserApps" resultType="UserApps"> or g.id in(
select distinct select
app.* gm.groupid
from from
mxk_apps app,mxk_group_privileges gp,mxk_groups g mxk_group_member gm,mxk_userinfo u
where where gm.memberid = u.id
app.id=gp.appid <if test="userId != null and userId != ''">
and gp.groupid=g.id and u.id = #{userId}
and app.visible != 0 </if>
and ( <if test="username != null and username != ''">
g.id='ROLE_ALL_USER' and u.username = #{username}
or g.id in( </if>
select )
gm.groupid )
from <if test="name != null and name != ''">
mxk_group_member gm,mxk_userinfo u and name = #{name}
where gm.memberid = u.id </if>
<if test="userId != null and userId != ''"> order by sortindex
and u.id = #{userId} </select>
</if>
<if test="username != null and username != ''">
and u.username = #{username}
</if>
)
)
<if test="name != null and name != ''">
and name = #{name}
</if>
order by sortindex
</select>
</mapper> </mapper>

View File

@ -1,34 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AppsSaml20DetailsMapper"> <mapper namespace="org.maxkey.persistence.mapper.AppsSaml20DetailsMapper">
<select id="getAppDetails" parameterType="string" resultType="AppsSaml20Details"> <select id="getAppDetails" parameterType="string" resultType="AppsSaml20Details">
select select svd.certissuer,
svd.certissuer, svd.certsubject,
svd.certsubject, svd.certexpiration,
svd.certexpiration, svd.keystore,
svd.keystore, svd.spacsurl,
svd.spacsurl , svd.issuer,
svd.issuer, svd.entityid,
svd.entityid, svd.audience,
svd.audience, svd.validityinterval,
svd.validityinterval , svd.nameidformat,
svd.nameidformat, svd.encrypted,
svd.encrypted, svd.binding,
svd.binding, svd.nameidconvert,
svd.nameidconvert, svd.signature,
svd.signature, svd.digestmethod,
svd.digestmethod, svd.metaurl,
svd.metaurl, app.*
app.* from mxk_apps_saml_v20_details svd,
from mxk_apps app
mxk_apps_saml_v20_details svd, where app.instid = svd.instid
mxk_apps app and app.id = #{value}
where and svd.id = #{value}
app.id = #{value} and svd.id = app.id
and svd.id = #{value} and app.status = 1
and svd.id = app.id </select>
and app.status = 1
</select>
</mapper> </mapper>

View File

@ -1,18 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.AppsTokenBasedDetailsMapper"> <mapper namespace="org.maxkey.persistence.mapper.AppsTokenBasedDetailsMapper">
<select id="getAppDetails" parameterType="string" resultType="AppsTokenBasedDetails"> <select id="getAppDetails" parameterType="string" resultType="AppsTokenBasedDetails">
select select *
* from mxk_apps_token_based_details tbd,
from mxk_apps app
mxk_apps_token_based_details tbd, where app.instid = tbd.instid
mxk_apps app and app.id = #{value}
where and tbd.id = #{value}
app.id = #{value} and tbd.id = app.id
and tbd.id = #{value} and status = 1
and tbd.id = app.id </select>
and status = 1
</select>
</mapper> </mapper>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.ForgotPasswordMapper"> <mapper namespace="org.maxkey.persistence.mapper.ForgotPasswordMapper">
</mapper> </mapper>

View File

@ -1,260 +1,297 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.GroupMemberMapper"> <mapper namespace="org.maxkey.persistence.mapper.GroupMemberMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and name = #{name} and name = #{name}
</if> </if>
</sql> </sql>
<!-- GROUP_MEMBER User Member--> <!-- GROUP_MEMBER User Member-->
<select id="allMemberInGroup" parameterType="GroupMember" resultType="GroupMember"> <select id="allMemberInGroup" parameterType="GroupMember" resultType="GroupMember">
select distinct select distinct u.id,
u.id, u.username,
u.username, u.usertype,
u.usertype, u.windowsaccount,
u.windowsaccount,
u.displayname,
u.displayname , u.nickname,
u.nickname , u.namezhspell,
u.namezhspell, u.namezhshortspell,
u.namezhshortspell, u.givenname,
u.givenname , u.middlename,
u.middlename , u.familyname,
u.familyname ,
u.gender,
u.gender,
u.authntype,
u.authntype, u.mobile,
u.mobile, u.email,
u.email, u.workemail,
u.workemail, u.workphonenumber,
u.workphonenumber,
u.employeenumber,
u.employeenumber, u.division,
u.division, u.costcenter,
u.costcenter, u.organization,
u.organization, u.departmentid,
u.departmentid, u.department,
u.department, u.jobtitle,
u.jobtitle, u.joblevel,
u.joblevel,
u.createddate,
u.createdby, u.status
u.createddate, from mxk_userinfo u
u.modifiedby, where instid = #{instId}
u.modifieddate, </select>
u.status <select id="memberInGroup" parameterType="GroupMember" resultType="GroupMember">
from select distinct
mxk_userinfo u gm.id,
where 1 = 1 u.username,
</select> u.usertype,
u.windowsaccount,
<select id="memberInGroup" parameterType="GroupMember" resultType="GroupMember">
select distinct u.displayname ,
gm.id, u.nickname ,
u.username, u.namezhspell,
u.usertype, u.namezhshortspell,
u.windowsaccount, u.givenname ,
u.middlename ,
u.displayname , u.familyname ,
u.nickname ,
u.namezhspell, u.gender,
u.namezhshortspell,
u.givenname , u.authntype,
u.middlename , u.mobile,
u.familyname , u.email,
u.workemail,
u.gender, u.workphonenumber,
u.authntype, u.employeenumber,
u.mobile, u.division,
u.email, u.costcenter,
u.workemail, u.organization,
u.workphonenumber, u.departmentid,
u.department,
u.employeenumber, u.jobtitle,
u.division, u.joblevel,
u.costcenter,
u.organization, gm.createddate,
u.departmentid,
u.department, u.status
u.jobtitle, from
u.joblevel, mxk_userinfo u,
mxk_groups g,
mxk_group_member gm
u.createdby, where u.instid = #{instId}
u.createddate, and g.instid = #{instId}
u.modifiedby, and gm.instid = #{instId}
u.modifieddate, <if test="groupId != null and groupId != ''">
and gm.groupid = #{groupId}
u.status and g.id = #{groupId}
from </if>
mxk_userinfo u, <if test="groupName != null and groupName != ''">
mxk_groups g, and g.name = #{groupName}
mxk_group_member gm </if>
where 1 = 1 <if test="username != null and username != ''">
<if test="groupId != null and groupId != ''"> and u.username = #{username}
and gm.groupid = #{groupId} </if>
and g.id = #{groupId} <if test="displayName != null and displayName != ''">
</if> and u.displayname like '%${displayName}%'
<if test="groupName != null and groupName != ''"> </if>
and g.name = #{groupName} and gm.type in( 'USER','USER-DYNAMIC')
</if> and gm.groupid = g.id
<if test="username != null and username != ''"> and gm.memberid = u.id
and u.username = #{username} </select>
</if>
<if test="displayName != null and displayName != ''">
and u.displayname like '%${displayName}%' <select id="memberNotInGroup" parameterType="GroupMember" resultType="GroupMember">
</if> select distinct
and gm.type in( 'USER','USER-DYNAMIC') u.id,
and gm.groupid = g.id u.username,
and gm.memberid = u.id u.usertype,
</select> u.windowsaccount,
u.displayname ,
<select id="memberNotInGroup" parameterType="GroupMember" resultType="GroupMember"> u.nickname ,
select distinct u.namezhspell,
u.id, u.namezhshortspell,
u.username, u.givenname ,
u.usertype, u.middlename ,
u.windowsaccount, u.familyname ,
u.displayname , u.gender,
u.nickname ,
u.namezhspell, u.authntype,
u.namezhshortspell, u.mobile,
u.givenname , u.email,
u.middlename , u.workemail,
u.familyname , u.workphonenumber,
u.gender, u.employeenumber,
u.division,
u.authntype, u.costcenter,
u.mobile, u.organization,
u.email, u.departmentid,
u.workemail, u.department,
u.workphonenumber, u.jobtitle,
u.joblevel,
u.employeenumber,
u.division,
u.costcenter, u.createdby,
u.organization, u.createddate,
u.departmentid, u.modifiedby,
u.department, u.modifieddate,
u.jobtitle,
u.joblevel, u.status
from
mxk_userinfo u
u.createdby, where
u.createddate, u.id not in(
u.modifiedby, select gm.memberid
u.modifieddate, from mxk_groups g,mxk_group_member gm
where 1 = 1
u.status <if test="groupId != null and groupId != ''">
from and gm.groupid = #{groupId}
mxk_userinfo u and g.id = #{groupId}
where </if>
u.id not in( <if test="groupName != null and groupName != ''">
select gm.memberid and g.name = #{groupName}
from mxk_groups g,mxk_group_member gm </if>
where 1 = 1 and gm.type in( 'USER','USER-DYNAMIC')
<if test="groupId != null and groupId != ''"> and gm.groupid = g.id
and gm.groupid = #{groupId} )
and g.id = #{groupId} <if test="username != null and username != ''">
</if> and u.username = #{username}
<if test="groupName != null and groupName != ''"> </if>
and g.name = #{groupName} <if test="displayName != null and displayName != ''">
</if> and u.displayname like '%${displayName}%'
and gm.type in( 'USER','USER-DYNAMIC') </if>
and gm.groupid = g.id </select>
)
<if test="username != null and username != ''">
and u.username = #{username} <!-- GROUP_MEMBER Group Member-->
</if> <select id="groupMemberInGroup" parameterType="GroupMember" resultType="Groups">
<if test="displayName != null and displayName != ''"> select distinct
and u.displayname like '%${displayName}%' ig.*
</if> from
</select> mxk_groups ig,
mxk_groups g,
mxk_group_member gm
<!-- GROUP_MEMBER Group Member--> where
<select id="groupMemberInGroup" parameterType="GroupMember" resultType="Groups"> 1 = 1
select distinct and gm.groupid = g.id
ig.* and gm.memberid = ig.id
from and gm.type = 'GROUP'
mxk_groups ig, <if test="groupId != null and groupId != ''">
mxk_groups g, and gm.groupid = #{groupId}
mxk_group_member gm and g.id = #{groupId}
where </if>
1 = 1 <if test="groupName != null and groupName != ''">
and gm.groupid = g.id and g.name = #{groupName}
and gm.memberid = ig.id </if>
and gm.type = 'GROUP' </select>
<if test="groupId != null and groupId != ''">
and gm.groupid = #{groupId} <update id="addDynamicGroupMember" parameterType="Groups">
and g.id = #{groupId} insert into mxk_group_member(
</if> id,
<if test="groupName != null and groupName != ''"> groupid,
and g.name = #{groupName} memberid,
</if> type
</select> )
select
<update id="addDynamicGroupMember" parameterType="Groups" > concat('${id}',u.id) id,
insert into mxk_group_member( '${id}' groupid,
id, u.id memberid,
groupid, 'USER-DYNAMIC' TYPE
memberid, from mxk_userinfo u
type where not exists(
) select 1 from mxk_group_member gm
select where gm.groupid=#{id}
concat_ws('-','UD','${id}',u.id) id, and gm.memberid=u.id
'${id}' groupid, and gm.type='USER-DYNAMIC'
u.id memberid, )
'USER-DYNAMIC' as type <if test="filters != null and filters != ''">
from mxk_userinfo u and (${filters})
where not exists( </if>
select 1 from mxk_group_member gm <if test="orgIdsList != null and orgIdsList != ''">
where gm.groupid=#{id} and u.departmentid in( ${orgIdsList})
and gm.memberid=u.id </if>
and gm.type='USER-DYNAMIC' </update>
)
<if test="filters != null and filters != ''"> <delete id="deleteDynamicGroupMember" parameterType="Groups">
and (${filters}) delete from mxk_group_member gm
</if> where type = 'user-dynamic'
<if test="orgIdsList != null and orgIdsList != ''"> and gm.groupid=#{id}
and u.departmentid in( ${orgIdsList}) and not exists(
</if> select 1
</update> from mxk_userinfo u
where 1 = 1
<delete id="deleteDynamicGroupMember" parameterType="Groups" > and u.id=gm.memberid
delete from mxk_group_member gm <if test="filters != null and filters != ''">
where type = 'user-dynamic' and (${filters})
and gm.groupid=#{id} </if>
and not exists( <if test="orgIdsList != null and orgIdsList != ''">
select 1 and u.departmentid in ( ${orgIdsList})
from mxk_userinfo u </if>
where 1 = 1 )
and u.id=gm.memberid </delete>
<if test="filters != null and filters != ''">
and (${filters}) <select id="queryMemberByGroupId" parameterType="string" resultType="UserInfo">
</if> select distinct u.id,
<if test="orgIdsList != null and orgIdsList != ''"> u.username,
and u.departmentid in ( ${orgIdsList}) u.usertype,
</if> u.windowsaccount,
)
</delete> u.displayname,
u.nickname,
<delete id="deleteByGroupId" parameterType="string" > u.namezhspell,
delete from mxk_group_member gm u.namezhshortspell,
where gm.groupid=#{value} u.givenname,
</delete> u.middlename,
u.familyname,
u.gender,
u.authntype,
u.mobile,
u.email,
u.workemail,
u.workphonenumber,
u.employeenumber,
u.division,
u.costcenter,
u.organization,
u.departmentid,
u.department,
u.jobtitle,
u.joblevel,
gm.createddate,
u.status
from mxk_userinfo u,
mxk_groups g,
mxk_group_member gm
where 1 = 1
and gm.groupid = #{value}
and g.id = #{value}
and gm.type in ('USER', 'USER-DYNAMIC')
and gm.groupid = g.id
and gm.memberid = u.id
</select>
<delete id="deleteByGroupId" parameterType="string">
delete
from mxk_group_member gm
where gm.groupid = #{value}
</delete>
</mapper> </mapper>

View File

@ -1,61 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.GroupPrivilegesMapper" > <mapper namespace="org.maxkey.persistence.mapper.GroupPrivilegesMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and apps.id = #{id} and apps.id = #{id}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and apps.name like '%${name}%' and apps.name like '%${name}%'
</if> </if>
<if test="protocol != null and protocol != ''"> <if test="protocol != null and protocol != ''">
and apps.protocol = #{protocol} and apps.protocol = #{protocol}
</if> </if>
<if test="category != null and category != ''"> <if test="category != null and category != ''">
and apps.category = #{category} and apps.category = #{category}
</if> </if>
</sql> </sql>
<!-- AppGroup --> <!-- AppGroup -->
<select id="appsInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges"> <select id="appsInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges">
select select
gp.id, gp.id,
gp.groupid, gp.groupid,
gp.appid, gp.appid,
apps.name, apps.name,
apps.icon, apps.icon,
apps.loginurl, apps.loginurl,
apps.protocol, apps.protocol,
apps.category, apps.category,
apps.description, apps.description,
apps.vendor, apps.vendor,
apps.vendorurl apps.vendorurl
from from
mxk_apps apps, mxk_apps apps,
mxk_group_privileges gp mxk_group_privileges gp
where where
gp.appid=apps.id apps.instid = #{instId}
and gp.groupid = #{groupId} and gp.instid = #{instId}
<include refid="where_statement"/> and gp.appid = apps.id
</select> and gp.groupid = #{groupId}
<include refid="where_statement"/>
<select id="appsNotInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges"> </select>
select
* <select id="appsNotInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges">
from select
mxk_apps apps *
where from
1 = 1 mxk_apps apps
and apps.id not in( where
select 1 = 1
appid and apps.id not in(
from select
mxk_group_privileges appid
where from
groupid = #{groupId} mxk_group_privileges
) where
<include refid="where_statement"/> groupid = #{groupId}
</select> )
<include refid="where_statement"/>
</select>
</mapper> </mapper>

View File

@ -1,58 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.GroupsMapper"> <mapper namespace="org.maxkey.persistence.mapper.GroupsMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and name like '%${name}%' and name like '%${name}%'
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="Groups" resultType="Groups">
<select id="queryPageResults" parameterType="Groups" resultType="Groups"> select
select *
* from
from mxk_groups
mxk_groups where instid = #{instId}
where <include refid="where_statement"/>
(1=1) </select>
<include refid="where_statement"/>
</select> <select id="queryDynamicGroups" parameterType="Groups" resultType="Groups">
select
<select id="queryDynamicGroups" parameterType="Groups" resultType="Groups"> *
select from
* mxk_groups
from where instid = #{instId}
mxk_groups and dynamic = '1'
where <include refid="where_statement"/>
dynamic = '1' </select>
<include refid="where_statement"/>
</select>
<update id="logisticDelete" parameterType="Groups">
update mxk_groups set
<update id="logisticDelete" parameterType="Groups" > status = '2'
update mxk_groups set where instid = #{instId}
status = '2' <if test="id != null">
where 1 = 1 and id = #{id}
<if test="id != null"> </if>
and id = #{id} <if test="name != name">
</if> and name = #{name}
<if test="name != name"> </if>
and name = #{name} </update>
</if>
</update>
<update id="logisticBatchDelete" parameterType="java.util.List">
update mxk_groups
<update id="logisticBatchDelete" parameterType="java.util.List"> set status='2'
update mxk_groups set status='2' where id in where instid = #{instId}
<foreach item="item" collection="list" open="(" separator="," close=")"> and id in
#{item} <foreach item="item" collection="list" open="(" separator="," close=")">
</foreach> #{item}
</update> </foreach>
</update>
<select id="queryGroupByUserId" parameterType="string" resultType="Groups">
select distinct g.*
from mxk_userinfo u,
mxk_groups g,
mxk_group_member gm
where u.instid = #{instId}
and g.instid = #{instId}
and gm.instid = #{instId}
and gm.memberid = #{value}
and u.id = #{value}
and gm.type in ('USER', 'USER-DYNAMIC')
and gm.groupid = g.id
and gm.memberid = u.id
</select>
</mapper> </mapper>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.HistoryConnectorMapper">
<sql id="where_statement">
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="conName != null and conName != ''">
and conName = #{conName}
</if>
<if test="conType != null and conType != ''">
and conType = #{conType}
</if>
<if test="sourceId != null and sourceId != ''">
and sourceId = #{sourceId}
</if>
<if test="sourceName != null and sourceName != ''">
and sourceName = #{sourceName}
</if>
<if test="objectId != null and objectId != ''">
and objectId = #{objectId}
</if>
<if test="objectName != null and objectName != ''">
and objectname = #{objectName}
</if>
<if test="result != null and result != ''">
and result = #{result}
</if>
<if test="startDate != null and startDate != ''">
and synctime >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and #{endDate} >= synctime
</if>
<if test="description != null and description != ''">
and description like '%${description}%'
</if>
</sql>
<select id="queryPageResults" parameterType="HistoryConnector" resultType="HistoryConnector">
select
*
from mxk_history_connector
where instid = #{instId}
<include refid="where_statement"/>
order by synctime desc
</select>
</mapper>

View File

@ -1,54 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.HistoryLoginAppsMapper" > <mapper namespace="org.maxkey.persistence.mapper.HistoryLoginAppsMapper">
<sql id="dao_where_statement"> <sql id="dao_where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="sessionId != null and sessionId != ''"> <if test="sessionId != null and sessionId != ''">
and sessionid = #{sessionId} and sessionid = #{sessionId}
</if> </if>
<if test="appId != null and appId != ''"> <if test="appId != null and appId != ''">
and appid = #{appId} and appid = #{appId}
</if> </if>
<if test="appName != null and appName != ''"> <if test="appName != null and appName != ''">
and appname like concat('%',#{appName},'%') and appname like concat('%',#{appName},'%')
</if> </if>
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
and userId = #{userId} and userId = #{userId}
</if> </if>
<if test="username != null and username != ''"> <if test="username != null and username != ''">
and username like concat('%',#{username},'%') and username = #{username}
</if> </if>
<if test="displayName != null and displayName != ''"> <if test="displayName != null and displayName != ''">
and displayname like concat('%',#{displayName},'%') and displayname like concat('%',#{displayName},'%')
</if> </if>
<if test="startDate != null and startDate != ''"> <if test="startDate != null and startDate != ''">
and logintime >= #{startDate} and logintime >= #{startDate}
</if> </if>
<if test="endDate != null and endDate != ''"> <if test="endDate != null and endDate != ''">
and #{endDate} >= logintime and #{endDate} >= logintime
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="HistoryLoginApps" resultType="HistoryLoginApps"> <select id="queryPageResults" parameterType="HistoryLoginApps" resultType="HistoryLoginApps">
select select
id, id,
sessionid, sessionid,
appid, appid,
appname, appname,
uid, userId,
username, username,
displayname, displayname,
to_char(logintime,'YYYY-MM-DD HH24:MI:SS') as logintime to_char(logintime,'YYYY-MM-DD HH24:MI:SS') as logintime
from mxk_history_login_apps
where 1 = 1 from mxk_history_login_apps
<include refid="dao_where_statement"/> where instid = #{instId}
<include refid="dao_where_statement"/>
order by logintime desc
</select> order by logintime desc
</select>
</mapper> </mapper>

View File

@ -1,72 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.HistoryLoginMapper" > <mapper namespace="org.maxkey.persistence.mapper.HistoryLoginMapper">
<sql id="dao_where_statement"> <sql id="dao_where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
and userId = #{userId} and userId = #{userId}
</if> </if>
<if test="username != null and username != '' "> <if test="username != null and username != '' ">
and lower(username) like lower(concat('%',#{username},'%')) and lower(username) like lower(concat('%',#{username},'%'))
</if> </if>
<if test="message != null and message != '' "> <if test="message != null and message != '' ">
and lower(message) like lower(concat('%',#{message},'%')) and lower(message) like lower(concat('%',#{message},'%'))
</if> </if>
<if test="displayName != null and displayName != '' "> <if test="displayName != null and displayName != '' ">
and lower(displayname) like lower(concat('%',#{displayName},'%')) and lower(displayname) like lower(concat('%',#{displayName},'%'))
</if> </if>
<if test="startDate != null and startDate != ''"> <if test="startDate != null and startDate != ''">
and logintime >= #{startDate} and logintime >= #{startDate}
</if> </if>
<if test="endDate != null and endDate != ''"> <if test="endDate != null and endDate != ''">
and #{endDate} >= logintime and #{endDate} >= logintime
</if> </if>
<if test="sessionId != null and sessionId != ''"> <if test="sessionId != null and sessionId != ''">
and sessionid = #{sessionId} and sessionid = #{sessionId}
</if> </if>
<if test="loginType != null and loginType != ''"> <if test="loginType != null and loginType != ''">
and logintype = #{loginType} and logintype = #{loginType}
</if> </if>
<if test="sourceIp != null and sourceIp != ''"> <if test="sourceIp != null and sourceIp != ''">
and sourceip = #{sourceIp} and sourceip = #{sourceIp}
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="HistoryLogin" resultType="HistoryLogin">
<select id="queryPageResults" parameterType="HistoryLogin" resultType="HistoryLogin"> select
select id,
id, sessionid,
sessionid, userId,
userId, username,
username, displayname,
displayname, logintype,
logintype, message,
message, code,
code, provider,
provider, sourceip,
sourceip, browser,
browser, platform,
platform, application,
application, loginurl,
loginurl, to_char(logintime,'YYYY-MM-DD HH24:MI:SS') as logintime,
to_char(logintime,'YYYY-MM-DD HH24:MI:SS') as logintime, logouttime
to_char(logouttime,'YYYY-MM-DD HH24:MI:SS') as logouttime from mxk_history_login
from mxk_history_login where instid = #{instId}
where 1 = 1 <include refid="dao_where_statement"/>
<include refid="dao_where_statement"/>
order by logintime desc
order by logintime desc </select>
</select>
<update id="logout" parameterType="java.lang.String" > <select id="queryOnlineSession" parameterType="HistoryLogin" resultType="HistoryLogin">
update mxk_history_login set select
logouttime = current_timestamp sessionid id,
where sessionid,
sessionid = #{value} userId,
</update> username,
displayname,
logintype,
message,
code,
provider,
sourceip,
browser,
platform,
application,
loginurl,
to_char(logintime,'YYYY-MM-DD HH24:MI:SS') as logintime,
logouttime
from mxk_history_login
where instid = #{instId}
and sessionstatus = 1
<include refid="dao_where_statement"/>
order by logintime desc
</select>
<update id="logout" parameterType="java.lang.String">
update mxk_history_login
set logouttime = current_timestamp
where sessionid = #{value}
</update>
</mapper> </mapper>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.HistorySynchronizerMapper">
<sql id="where_statement">
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="syncId != null and syncId != ''">
and syncid = #{syncId}
</if>
<if test="objectName != null and objectName != ''">
and objectname = #{objectName}
</if>
<if test="result != null and result != ''">
and result = #{result}
</if>
<if test="startDate != null and startDate != ''">
and synctime >= #{startDate}
</if>
<if test="endDate != null and endDate != ''">
and #{endDate} >= synctime
</if>
</sql>
<select id="queryPageResults" parameterType="HistorySynchronizer" resultType="HistorySynchronizer">
select
*
from mxk_history_synchronizer
where instid = #{instId}
<include refid="where_statement"/>
order by synctime desc
</select>
</mapper>

View File

@ -1,55 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.HistorySystemLogsMapper" > <mapper namespace="org.maxkey.persistence.mapper.HistorySystemLogsMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="serviceName != null and serviceName != '' "> <if test="serviceName != null and serviceName != '' ">
and lower(servicename) like lower(concat('%',#{serviceName},'%')) and lower(servicename) like lower(concat('%',#{serviceName},'%'))
</if> </if>
<if test="message != null and message != '' "> <if test="message != null and message != '' ">
and lower(message) like lower(concat('%',#{message},'%')) and lower(message) like lower(concat('%',#{message},'%'))
</if> </if>
<if test="startDate != null and startDate != '' "> <if test="startDate != null and startDate != '' ">
and createddate between #{startDate} and #{endDate} and createddate between #{startDate} and #{endDate}
</if> </if>
<if test="createdBy != null and createdBy != ''"> <if test="createdBy != null and createdBy != ''">
and createdby = #{createdBy} and createdby = #{createdBy}
</if> </if>
<if test="username != null and username != ''"> <if test="username != null and username != ''">
and lower(username) like lower(concat('%',#{username},'%')) and lower(username) like lower(concat('%',#{username},'%'))
</if> </if>
<if test="messageType != null and messageType != ''"> <if test="messageType != null and messageType != ''">
and messagetype = #{messageType} and messagetype = #{messageType}
</if> </if>
<if test="operateType != null and operateType != ''"> <if test="operateType != null and operateType != ''">
and operatetype = #{operateType} and operatetype = #{operateType}
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="HistoryLogs" resultType="HistoryLogs"> <select id="queryPageResults" parameterType="HistoryLogs" resultType="HistoryLogs">
select select
id, id,
tid, tid,
tname, tname,
servicename , servicename ,
code, code,
message , message ,
content, content,
operatetype, operatetype,
messagetype, messagetype,
username, username,
createddate, createddate,
createdby createdby
from mxk_history_logs from mxk_history_logs
where 1 = 1 where instid = #{instId}
<include refid="where_statement"/> <include refid="where_statement"/>
order by createddate desc order by createddate desc
</select> </select>
</mapper> </mapper>

View File

@ -1,36 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.NoticesMapper"> <mapper namespace="org.maxkey.persistence.mapper.NoticesMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="title != null and title != ''"> <if test="title != null and title != ''">
and title like '%${title}%' and title like '%${title}%'
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="Notices" resultType="Notices">
<select id="queryPageResults" parameterType="Notices" resultType="Notices"> select
select *
* from
from mxk_notices
mxk_notices where
where instid = #{instId}
(1=1) <include refid="where_statement"/>
<include refid="where_statement"/> order by modifieddate desc
order by modifieddate desc </select>
</select>
<select id="queryLastedNotices" parameterType="Notices" resultType="Notices">
<select id="queryLastedNotices" parameterType="Notices" resultType="Notices"> select *
select from mxk_notices
* where instid = #{instId}
from order by modifieddate desc limit 1
mxk_notices </select>
order by modifieddate desc
limit 1
</select>
</mapper> </mapper>

View File

@ -1,58 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.OrganizationsMapper" > <mapper namespace="org.maxkey.persistence.mapper.OrganizationsMapper">
<sql id="dao_where_statement"> <sql id="dao_where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="name != null and name != '' "> <if test="name != null and name != '' ">
and name like '%#{name}%' and name like '%${name}%'
</if> </if>
<if test="parentId != null and parentId != '' "> <if test="parentId != null and parentId != '' ">
and parentid = #{parentId} and parentid = #{parentId}
</if> </if>
<if test="parentName != null and parentName != ''"> <if test="parentName != null and parentName != ''">
and parentname like '%#{parentName}%' and parentName like '%${parentName}%'
</if> </if>
</sql> </sql>
<select id="queryOrgs" parameterType="Organizations" resultType="Organizations">
<select id="queryPageResults" parameterType="Organizations" resultType="Organizations"> select
select *
* from mxk_organizations
from mxk_organizations where instid = #{instId}
where 1 = 1 <include refid="dao_where_statement"/>
<include refid="dao_where_statement"/> order by sortindex,id
</select> </select>
<update id="logisticDelete" parameterType="Organizations" > <select id="queryPageResults" parameterType="Organizations" resultType="Organizations">
update mxk_organizations set status = '2' select
where 1 = 1 *
<if test="id != null and id != '' "> from mxk_organizations
and id = #{id} where instid = #{instId}
</if> <include refid="dao_where_statement"/>
<if test="name != name"> order by sortindex,id
and name = #{name} </select>
</if>
<if test="enable != null"> <update id="logisticDelete" parameterType="Organizations">
and status = '1' update mxk_organizations set status = '2'
</if> where instid = #{instId}
<if test="codePath != null"> <if test="id != null and id != '' ">
and codepath = #{codePath} and id = #{id}
</if> </if>
</update> <if test="name != name">
and name = #{name}
<update id="logisticBatchDelete" parameterType="java.util.List"> </if>
UPDATE MXK_ORGANIZATIONS SET STATUS = '2' <if test="enable != null">
WHERE ID IN and status = '1'
<foreach collection="ids" item="selectId" open="(" separator="," close=")"> </if>
#{selectId} <if test="codePath != null">
</foreach> and codepath = #{codePath}
</update> </if>
</update>
<update id="logisticBatchDelete" parameterType="java.util.List">
UPDATE MXK_ORGANIZATIONS
SET STATUS = '2'
WHERE instid = #{instId}
and id in
<foreach collection="ids" item="selectId" open="(" separator="," close=")">
#{selectId}
</foreach>
</update>
</mapper> </mapper>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.PasswordPolicyMapper" > <mapper namespace="org.maxkey.persistence.mapper.PasswordPolicyMapper">
</mapper> </mapper>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.RegisterMapper">
<select id="findByEmail" parameterType="string" resultType="Register">
select *
from mxk_register
where workemail = #{value}
</select>
</mapper>

View File

@ -1,23 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.RegistrationMapper"> <mapper namespace="org.maxkey.persistence.mapper.RegistrationMapper">
<select id="queryUserInfoByEmail" parameterType="string" resultType="UserInfo"> <select id="queryUserInfoByEmail" parameterType="string" resultType="UserInfo">
select select id,
id, email
email from userinfo
from where email = #{value}
userinfo union
where select id,
email = #{value} workemail eamil
union from mxk_registration
select where workemail = #{value}
id, </select>
workemail eamil
from
mxk_registration
where
workemail = #{value}
</select>
</mapper> </mapper>

View File

@ -1,82 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.ReportMapper" > <mapper namespace="org.maxkey.persistence.mapper.ReportMapper">
<!-- DAY COUNT 一天访问量 --> <!-- DAY COUNT 一天访问量 -->
<select id="analysisDay" resultType="Integer"> <select id="analysisDay" parameterType="java.util.HashMap" resultType="Integer">
select select count(id) reportcount
count(id) reportcount from mxk_history_login
from mxk_history_login where instid = #{instId}
where and date (logintime) = current_date
date(logintime) =current_date </select>
</select> <!-- 本月新用户统计 -->
<!-- 本月新用户统计 --> <select id="analysisNewUsers" parameterType="java.util.HashMap" resultType="Integer">
<select id="analysisNewUsers" parameterType="String" resultType="Integer"> select count(*) reportcount
select from mxk_userinfo
count(*) reportcount where instid = #{instId}
from mxk_userinfo and to_char(createddate,'YYYY-MM')=to_char(current_date,'YYYY-MM')
where to_char(createddate,'YYYY-MM')=to_char(current_date,'YYYY-MM') </select>
</select> <!-- 在线用户统计 -->
<!-- 在线用户统计 --> <select id="analysisOnlineUsers" parameterType="java.util.HashMap" resultType="Integer">
<select id="analysisOnlineUsers" parameterType="String" resultType="Integer"> select count(*) reportcount
select from mxk_userinfo
count(*) reportcount where instid = #{instId}
from mxk_userinfo and online = 1
where and extract(epoch from now() - lastlogintime) &lt; 10000
lastlogintime >lastlogofftime </select>
</select> <!-- 30天活跃用户统计 -->
<!-- 30天活跃用户统计 --> <select id="analysisActiveUsers" parameterType="java.util.HashMap" resultType="Integer">
<select id="analysisActiveUsers" parameterType="String" resultType="Integer"> select count(*) reportcount
select from mxk_userinfo
count(*) reportcount where instid = #{instId}
from mxk_userinfo and date(lastlogintime) > (current_date - interval '30 day')
where </select>
date(lastlogintime) >(current_date - interval '30 day')
</select> <!-- DAY HOUR COUNT 当天每小时 -->
<select id="analysisDayHour" parameterType="java.util.HashMap" resultType="Map">
<!-- DAY HOUR COUNT 当天每小时 --> select count(id) reportcount,
<select id="analysisDayHour" parameterType="String" resultType="Map"> to_char(logintime,'HH24') reportstring
select from mxk_history_login
count(id) reportcount, where instid = #{instId}
to_char(logintime,'HH24') reportstring and date (logintime) = current_date
from mxk_history_login group by reportstring
where order by reportstring
date(logintime) =current_date </select>
group by reportstring <!-- 30 DAY COUNT 最近30天每天访问量-->
order by reportstring <select id="analysisMonth" parameterType="java.util.HashMap" resultType="Map">
</select> select count(id) reportcount,
<!-- 30 DAY COUNT 最近30天每天访问量--> date (logintime) reportstring
<select id="analysisMonth" parameterType="String" resultType="Map"> from mxk_history_login
select where instid = #{instId}
count(id) reportcount, and date(logintime) > (current_date - interval '30 day')
date(logintime) reportstring group by reportstring
from mxk_history_login order by reportstring
where </select>
date(logintime) >(current_date - interval '30 day')
group by reportstring <!-- 30天浏览器的访问统计 -->
order by reportstring <select id="analysisBrowser" parameterType="java.util.HashMap" resultType="Map">
</select> select count(id) reportcount,
coalesce(browser, 'Other') reportstring
<!-- 30天浏览器的访问统计 --> from mxk_history_login
<select id="analysisBrowser" parameterType="Map" resultType="Map"> where instid = #{instId}
select and date(logintime) &gt; (current_date - interval '30 day')
count(id) reportcount, group by reportstring
browser reportstring order by reportcount desc
from mxk_history_login </select>
where
date(logintime) >(current_date - interval '30 day') <!-- 30天应用单点登录的访问统计 -->
group by reportstring <select id="analysisApp" parameterType="Map" resultType="Map">
order by reportcount desc select count(id) reportcount,
</select> appname
from mxk_history_login_apps
<!-- 30天应用单点登录的访问统计 --> where instid = #{instId}
<select id="analysisApp" parameterType="Map" resultType="Map"> and date(logintime) &gt; (current_date - interval '30 day')
select group by appname
count(id) reportcount, order by reportcount desc
appname </select>
from mxk_history_login_apps
where
date(logintime) >(current_date - interval '30 day')
group by appname order by reportcount desc
</select>
</mapper> </mapper>

View File

@ -1,55 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.ResourcesMapper"> <mapper namespace="org.maxkey.persistence.mapper.ResourcesMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and res.id = #{id} and res.id = #{id}
</if> </if>
<if test="appId != null and appId != ''"> <if test="appId != null and appId != ''">
and res.appid = #{appId} and res.appid = #{appId}
</if> </if>
<if test="parentId != null and parentId != ''"> <if test="parentId != null and parentId != ''">
and res.parentid = #{parentId} and res.parentid = #{parentId}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and res.name like '%${name}%' and res.name like '%${name}%'
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="Resources" resultType="Resources">
<select id="queryPageResults" parameterType="Resources" resultType="Resources"> select
select res.*,app.name appname
res.*,app.name appname from
from mxk_resources res, mxk_apps app
mxk_resources res, mxk_apps app where
where res.instid = #{instId}
(1=1) and res.appid=app.id and app.instid = #{instId}
<include refid="where_statement"/> and res.appid=app.id
order by res.sortindex <include refid="where_statement"/>
</select> order by res.sortindex
</select>
<update id="logisticDelete" parameterType="Resources" >
update mxk_resources set <update id="logisticDelete" parameterType="Resources">
status = '2' update mxk_resources set
where 1 = 1 status = '2'
<if test="id != null"> where instid = #{instId}
and id = #{id} <if test="id != null">
</if> and id = #{id}
<if test="name != name"> </if>
and name = #{name} <if test="name != name">
</if> and name = #{name}
</update> </if>
</update>
<update id="logisticBatchDelete" parameterType="java.util.List">
update mxk_resources set status='2' where id in <update id="logisticBatchDelete" parameterType="java.util.List">
<foreach item="item" collection="list" open="(" separator="," close=")"> update mxk_resources
#{item} set status='2'
</foreach> where instid = #{instId}
</update> and id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</update>
</mapper> </mapper>

View File

@ -1,261 +1,255 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.RoleMemberMapper"> <mapper namespace="org.maxkey.persistence.mapper.RoleMemberMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and name = #{name} and name = #{name}
</if> </if>
</sql> </sql>
<!-- ROLE_MEMBER User Member--> <!-- ROLE_MEMBER User Member-->
<select id="allMemberInRole" parameterType="RoleMember" resultType="RoleMember"> <select id="allMemberInRole" parameterType="RoleMember" resultType="RoleMember">
select distinct select distinct u.id,
u.id, u.username,
u.username, u.usertype,
u.usertype, u.windowsaccount,
u.windowsaccount,
u.displayname,
u.displayname , u.nickname,
u.nickname , u.namezhspell,
u.namezhspell, u.namezhshortspell,
u.namezhshortspell, u.givenname,
u.givenname , u.middlename,
u.middlename , u.familyname,
u.familyname ,
u.gender,
u.gender,
u.authntype,
u.authntype, u.mobile,
u.mobile, u.email,
u.email, u.workemail,
u.workemail, u.workphonenumber,
u.workphonenumber,
u.employeenumber,
u.employeenumber, u.division,
u.division, u.costcenter,
u.costcenter, u.organization,
u.organization, u.departmentid,
u.departmentid, u.department,
u.department, u.jobtitle,
u.jobtitle, u.joblevel,
u.joblevel,
u.createddate,
u.createdby, u.status
u.createddate, from mxk_userinfo u
u.modifiedby, where instid = #{instId}
u.modifieddate, </select>
u.status <select id="memberInRole" parameterType="RoleMember" resultType="RoleMember">
from select distinct
mxk_userinfo u rm.id,
where 1 = 1 u.username,
</select> u.usertype,
u.windowsaccount,
<select id="memberInRole" parameterType="RoleMember" resultType="RoleMember">
select distinct u.displayname ,
rm.id, u.nickname ,
u.username, u.namezhspell,
u.usertype, u.namezhshortspell,
u.windowsaccount, u.givenname ,
u.middlename ,
u.displayname , u.familyname ,
u.nickname ,
u.namezhspell, u.gender,
u.namezhshortspell,
u.givenname , u.authntype,
u.middlename , u.mobile,
u.familyname , u.email,
u.workemail,
u.gender, u.workphonenumber,
u.authntype, u.employeenumber,
u.mobile, u.division,
u.email, u.costcenter,
u.workemail, u.organization,
u.workphonenumber, u.departmentid,
u.department,
u.employeenumber, u.jobtitle,
u.division, u.joblevel,
u.costcenter,
u.organization,
u.departmentid, rm.createddate,
u.department,
u.jobtitle, u.status
u.joblevel, from
mxk_userinfo u,
mxk_roles r,
u.createdby, mxk_role_member rm
u.createddate, where u.instid = #{instId}
u.modifiedby, and r.instid = #{instId}
u.modifieddate, and rm.instid = #{instId}
<if test="roleId != null and roleId != ''">
u.status and rm.roleid = #{roleId}
from and r.id = #{roleId}
mxk_userinfo u, </if>
mxk_roles r, <if test="roleName != null and roleName != ''">
mxk_role_member rm and r.name = #{roleName}
where 1 = 1 </if>
<if test="roleId != null and roleId != ''"> <if test="username != null and username != ''">
and rm.roleid = #{roleId} and u.username = #{username}
and r.id = #{roleId} </if>
</if> <if test="displayName != null and displayName != ''">
<if test="roleName != null and roleName != ''"> and u.displayname like '%${displayName}%'
and r.name = #{roleName} </if>
</if> and rm.type in( 'USER','USER-DYNAMIC')
<if test="username != null and username != ''"> and rm.roleid = r.id
and u.username = #{username} and rm.memberid = u.id
</if> </select>
<if test="displayName != null and displayName != ''">
and u.displayname like '%${displayName}%'
</if> <select id="memberNotInRole" parameterType="RoleMember" resultType="RoleMember">
and rm.type in( 'USER','USER-DYNAMIC') select distinct
and rm.roleid = r.id u.id,
and rm.memberid = u.id u.username,
</select> u.usertype,
u.windowsaccount,
<select id="memberNotInRole" parameterType="RoleMember" resultType="RoleMember"> u.displayname ,
select distinct u.nickname ,
u.id, u.namezhspell,
u.username, u.namezhshortspell,
u.usertype, u.givenname ,
u.windowsaccount, u.middlename ,
u.familyname ,
u.displayname ,
u.nickname , u.gender,
u.namezhspell,
u.namezhshortspell, u.authntype,
u.givenname , u.mobile,
u.middlename , u.email,
u.familyname , u.workemail,
u.workphonenumber,
u.gender,
u.employeenumber,
u.authntype, u.division,
u.mobile, u.costcenter,
u.email, u.organization,
u.workemail, u.departmentid,
u.workphonenumber, u.department,
u.jobtitle,
u.employeenumber, u.joblevel,
u.division,
u.costcenter,
u.organization, u.createdby,
u.departmentid, u.createddate,
u.department, u.modifiedby,
u.jobtitle, u.modifieddate,
u.joblevel,
u.status
from
u.createdby, mxk_userinfo u
u.createddate, where
u.modifiedby, u.id not in(
u.modifieddate, select rm.memberid
from mxk_roles r,mxk_role_member rm
u.status where 1 = 1
from <if test="roleId != null and roleId != ''">
mxk_userinfo u and rm.roleid = #{roleId}
where and r.id = #{roleId}
u.id not in( </if>
select rm.memberid <if test="roleName != null and roleName != ''">
from mxk_roles r,mxk_role_member rm and r.name = #{roleName}
where 1 = 1 </if>
<if test="roleId != null and roleId != ''">
and rm.roleid = #{roleId} and rm.type in( 'USER','USER-DYNAMIC')
and r.id = #{roleId} and rm.roleid = r.id
</if> )
<if test="roleName != null and roleName != ''"> <if test="username != null and username != ''">
and r.name = #{roleName} and u.username = #{username}
</if> </if>
<if test="displayName != null and displayName != ''">
and rm.type in( 'USER','USER-DYNAMIC') and u.displayname like '%${displayName}%'
and rm.roleid = r.id </if>
) </select>
<if test="username != null and username != ''">
and u.username = #{username}
</if> <!-- ROLE_MEMBER Roles Member-->
<if test="displayName != null and displayName != ''"> <select id="roleMemberInRole" parameterType="RoleMember" resultType="Roles">
and u.displayname like '%${displayName}%' select distinct
</if> ir.*
</select> from
mxk_roles ir,
mxk_roles r,
<!-- ROLE_MEMBER Roles Member--> mxk_role_member rm
<select id="roleMemberInRole" parameterType="RoleMember" resultType="Roles"> where
select distinct 1 = 1
ir.* and rm.groupid = r.id
from and rm.memberid = ir.id
mxk_roles ir, and rm.type in( 'USER','USER-DYNAMIC')
mxk_roles r, <if test="roleId != null and roleId != ''">
mxk_role_member rm and rm.roleid = #{roleId}
where and r.id = #{roleId}
1 = 1 </if>
and rm.groupid = r.id <if test="roleName != null and roleName != ''">
and rm.memberid = ir.id and r.name = #{roleName}
and rm.type in( 'USER','USER-DYNAMIC') </if>
<if test="roleId != null and roleId != ''"> </select>
and rm.roleid = #{roleId}
and r.id = #{roleId} <update id="addDynamicRoleMember" parameterType="Roles">
</if> insert into mxk_role_member(
<if test="roleName != null and roleName != ''"> id,
and r.name = #{roleName} roleid,
</if> memberid,
</select> type
)
<update id="addDynamicRoleMember" parameterType="Roles" > select
insert into mxk_role_member( concat('${id}',u.id) id,
id, '${id}' ROLEID,
roleid, u.id memberid,
memberid, 'USER-DYNAMIC' type
type from mxk_userinfo u
) where not exists(
select select 1 from mxk_role_member rm
concat_ws('-','UD','${id}',u.id) id, where rm.roleid=#{id}
'${id}' ROLEID, and rm.memberid=u.id
u.id memberid, and rm.type='USER-DYNAMIC'
'USER-DYNAMIC' type )
from mxk_userinfo u <if test="filters != null and filters != ''">
where not exists( ${filters}
select 1 from mxk_role_member rm </if>
where rm.roleid=#{id} <if test="orgIdsList != null and orgIdsList != ''">
and rm.memberid=u.id and u.departmentid in( ${orgIdsList})
and rm.type='USER-DYNAMIC' </if>
) </update>
<if test="filters != null and filters != ''">
${filters} <delete id="deleteDynamicRoleMember" parameterType="Roles">
</if> delete from mxk_role_member rm
<if test="orgIdsList != null and orgIdsList != ''"> where type = 'USER-DYNAMIC'
and u.departmentid in( ${orgIdsList}) and rm.roleid = #{id}
</if> and not exists(
</update> select 1
from mxk_userinfo u
<delete id="deleteDynamicRoleMember" parameterType="Roles" > where 1 = 1
delete from mxk_role_member rm and u.id=rm.memberid
where type = 'USER-DYNAMIC' <if test="filters != null and filters != ''">
and rm.roleid = #{id} ${filters}
and not exists( </if>
select 1 <if test="orgIdsList != null and orgIdsList != ''">
from mxk_userinfo u and u.departmentid in( ${orgIdsList})
where 1 = 1 </if>
and u.id=rm.memberid )
<if test="filters != null and filters != ''"> </delete>
${filters}
</if> <delete id="deleteByRoleId" parameterType="string">
<if test="orgIdsList != null and orgIdsList != ''"> delete
and u.departmentid in( ${orgIdsList}) from mxk_role_member rm
</if> where rm.roleid = #{value}
) </delete>
</delete>
<delete id="deleteByRoleId" parameterType="string" >
delete from mxk_role_member rm
where rm.roleid=#{value}
</delete>
</mapper> </mapper>

View File

@ -1,92 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.RolesMapper"> <mapper namespace="org.maxkey.persistence.mapper.RolesMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and name like '%${name}%' and name like '%${name}%'
</if> </if>
</sql> </sql>
<select id="queryDynamicRoles" parameterType="Roles" resultType="Roles"> <select id="queryDynamicRoles" parameterType="Roles" resultType="Roles">
select select
* *
from from
mxk_groups mxk_roles
where where instid = #{instId}
dynamic = '1' and dynamic = '1'
<include refid="where_statement"/> <include refid="where_statement"/>
</select> </select>
<select id="queryPageResults" parameterType="Roles" resultType="Roles"> <select id="queryPageResults" parameterType="Roles" resultType="Roles">
select select
* *
from from
mxk_roles mxk_roles
where where
(1=1) instid = #{instId}
<include refid="where_statement"/> <include refid="where_statement"/>
</select> </select>
<update id="logisticDelete" parameterType="Roles" > <update id="logisticDelete" parameterType="Roles">
update mxk_roles set update mxk_roles set
status = '2' status = '2'
where 1 = 1 where instid = #{instId}
<if test="id != null"> <if test="id != null">
and id = #{id} and id = #{id}
</if> </if>
<if test="name != name"> <if test="name != name">
and name = #{name} and name = #{name}
</if> </if>
</update> </update>
<update id="logisticBatchDelete" parameterType="java.util.List"> <update id="logisticBatchDelete" parameterType="java.util.List">
update mxk_roles set status='2' where id in update mxk_roles
<foreach item="item" collection="list" open="(" separator="," close=")"> set status='2'
#{item} where instid = #{instId}
</foreach> and id in
</update> <foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
<select id="queryRolePermissions" parameterType="RolePermissions" resultType="RolePermissions"> </update>
select
*
from <select id="queryRolePermissions" parameterType="RolePermissions" resultType="RolePermissions">
mxk_role_permissions select
where *
status = 1 from
<if test="id != null and id != ''"> mxk_role_permissions
and id = #{id} where instid = #{instId}
</if> and status = 1
<if test="roleId != null and roleId != ''"> <if test="id != null and id != ''">
and roleid = #{roleId} and id = #{id}
</if> </if>
<if test="appId != null and appId != ''"> <if test="roleId != null and roleId != ''">
and appid = #{appId} and roleid = #{roleId}
</if> </if>
<if test="appId != null and appId != ''">
</select> and appid = #{appId}
</if>
<update id="logisticDeleteRolePermissions" parameterType="java.util.List">
update mxk_role_permissions set status=9 where id in </select>
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item.id} <update id="logisticDeleteRolePermissions" parameterType="java.util.List">
</foreach> update mxk_role_permissions
</update> set status = 9
where 1 = 1 and
<insert id="insertRolePermissions" parameterType="java.util.List"> <foreach item="item" collection="list" open="(" separator="or" close=")">
insert into mxk_role_permissions ( id,appid,roleid,resourceid,status) ( id = #{item.id} and instid = #{item.instId} )
values </foreach>
<foreach collection="list" item="item" index="index" separator=","> </update>
(#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status})
</foreach> <insert id="insertRolePermissions" parameterType="java.util.List">
</insert> insert into mxk_role_permissions ( id,appid,roleid,resourceid,status,instid)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status},#{item.instId})
</foreach>
</insert>
</mapper> </mapper>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.SocialsProviderMapper">
<sql id="where_statement">
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="providerName != null and providerName != ''">
and providerName like '%${providerName}%'
</if>
</sql>
<select id="queryPageResults" parameterType="SocialsProvider" resultType="SocialsProvider">
select
*
from
mxk_socials_provider
where
instid = #{instId}
<include refid="where_statement"/>
order by sortindex
</select>
</mapper>

View File

@ -2,24 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.SynchronizersMapper"> <mapper namespace="org.maxkey.persistence.mapper.SynchronizersMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and name like '%${name}%' and name like '%${name}%'
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="Synchronizers" resultType="Synchronizers"> <select id="queryPageResults" parameterType="Synchronizers" resultType="Synchronizers">
select select
* *
from from
mxk_synchronizers mxk_synchronizers
where where
(1=1) instid = #{instId}
<include refid="where_statement"/> <include refid="where_statement"/>
</select> </select>
</mapper> </mapper>

View File

@ -1,49 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.UserInfoAdjointMapper"> <mapper namespace="org.maxkey.persistence.mapper.UserInfoAdjointMapper">
<sql id="where_statement"> <sql id="where_statement">
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="userId != null and userId != ''"> <if test="userId != null and userId != ''">
and userid = #{userId} and userid = #{userId}
</if> </if>
</sql> </sql>
<select id="queryPageResults" parameterType="UserInfoAdjoint" resultType="UserInfoAdjoint">
<select id="queryPageResults" parameterType="UserInfoAdjoint" resultType="UserInfoAdjoint"> select
select *
* from
from mxk_userinfo_adjunct
mxk_userinfo_adjunct where
where instid = #{instId}
(1=1) <include refid="where_statement"/>
<include refid="where_statement"/> </select>
</select>
<update id="logisticDelete" parameterType="UserInfoAdjoint">
<update id="logisticDelete" parameterType="UserInfoAdjoint" > update mxk_userinfo_adjunct set
update mxk_userinfo_adjunct set status = '2'
status = '2' where instid = #{instId}
where 1 = 1 <if test="id != null">
<if test="id != null"> and id = #{id}
and id = #{id} </if>
</if> <if test="name != name">
<if test="name != name"> and NAME = #{name}
and name = #{name} </if>
</if> </update>
</update>
<update id="logisticBatchDelete" parameterType="java.util.List">
<update id="logisticBatchDelete" parameterType="java.util.List"> update mxk_userinfo_adjunct
update mxk_userinfo_adjunct set status='2' where id in set status='2'
<foreach item="item" collection="list" open="(" separator="," close=")"> where instid = #{instId}
#{item} and id in
</foreach> <foreach item="item" collection="list" open="(" separator="," close=")">
</update> #{item}
</foreach>
</update>
</mapper> </mapper>

View File

@ -1,252 +1,262 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.maxkey.persistence.mapper.UserInfoMapper"> <mapper namespace="org.maxkey.persistence.mapper.UserInfoMapper">
<select id="loadByUsername" parameterType="string" resultType="UserInfo"> <select id="queryPageResults" parameterType="UserInfo" resultType="UserInfo">
select select
* id,
from username,
mxk_userinfo usertype,
where username = #{value} windowsaccount,
</select>
displayname ,
<select id="queryPageResults" parameterType="UserInfo" resultType="UserInfo"> nickname ,
select namezhspell,
id, namezhshortspell,
username, givenname ,
usertype, middlename ,
windowsaccount, familyname ,
displayname , gender,
nickname ,
namezhspell, authntype,
namezhshortspell, mobile,
givenname , email,
middlename , workemail,
familyname , workphonenumber,
gender, employeenumber,
division,
authntype, costcenter,
mobile, organization,
email, departmentid,
workemail, department,
workphonenumber, jobtitle,
joblevel,
employeenumber,
division,
costcenter, createdby,
organization, createddate,
departmentid, modifiedby,
department, modifieddate,
jobtitle,
joblevel, status
from
mxk_userinfo
createdby, where instid = #{instId}
createddate, <if test="username != null and username != ''">
modifiedby, and username = #{username}
modifieddate, </if>
<if test="employeeNumber != null and employeeNumber != ''">
status and employeenumber = #{employeeNumber}
from </if>
mxk_userinfo <if test="userType != null and userType != ''">
where and usertype = #{userType}
(1=1) </if>
<if test="username != null and username != ''"> <if test="displayName != null and displayName != ''">
and username = #{username} and displayname like '%${displayName}%'
</if> </if>
<if test="employeeNumber != null and employeeNumber != ''"> <if test="departmentId != null and departmentId != ''">
and employeenumber = #{employeeNumber} and departmentid = #{departmentId}
</if> </if>
<if test="userType != null and userType != ''"> order by sortorder,id
and usertype = #{userType} </select>
</if>
<if test="displayName != null and displayName != ''"> <update id="updateLocked" parameterType="UserInfo">
and displayname like '%${displayName}%' update mxk_userinfo set
</if> <if test="isLocked != null">
<if test="departmentId != null and departmentId != ''"> islocked = #{isLocked},
and departmentid = #{departmentId} </if>
</if> modifieddate = current_timestamp
order by sortorder where
</select> id = #{id}
</update>
<update id="locked" parameterType="UserInfo" >
update mxk_userinfo set <update id="updateLockout" parameterType="UserInfo">
<if test="isLocked != null"> update mxk_userinfo set
islocked = #{isLocked}, <if test="isLocked != null">
</if> islocked = #{isLocked},
modifieddate = current_timestamp badpwdcount = 0,
where </if>
id = #{id} unlockdate = current_timestamp,
</update> modifieddate = current_timestamp
where
<update id="lockout" parameterType="UserInfo" > id = #{id}
update mxk_userinfo set </update>
<if test="isLocked != null">
islocked = #{isLocked}, <update id="updatePassword" parameterType="UserInfo">
badpwdcount = 0, update mxk_userinfo set
</if> <if test="password != null">
unlockdate = current_timestamp, password = #{password},
modifieddate = current_timestamp decipherable = #{decipherable},
where passwordsettype =#{passwordSetType},
id = #{id} </if>
</update> passwordlastsettime = current_timestamp
where
<update id="changePassword" parameterType="UserInfo" > id = #{id}
update mxk_userinfo set </update>
<if test="password != null">
password = #{password}, <update id="updateSharedSecret" parameterType="UserInfo">
decipherable = #{decipherable}, update mxk_userinfo set
</if> <if test="sharedSecret != null">
passwordsettype = 0, sharedsecret = #{sharedSecret},
passwordlastsettime = current_timestamp sharedcounter = #{sharedCounter},
where </if>
id = #{id} modifieddate = current_timestamp
</update> where
id = #{id}
<update id="changeSharedSecret" parameterType="UserInfo" > </update>
update mxk_userinfo set
<if test="sharedSecret != null"> <update id="updateAppLoginPassword" parameterType="UserInfo">
sharedsecret = #{sharedSecret}, update mxk_userinfo set
sharedcounter = #{sharedCounter}, <if test="appLoginPassword != null">
</if> apploginpassword = #{appLoginPassword},
modifieddate = current_timestamp </if>
where modifieddate = current_timestamp
id = #{id} where
</update> id = #{id}
</update>
<update id="changeAppLoginPassword" parameterType="UserInfo" >
update mxk_userinfo set <update id="updateProtectedApps" parameterType="UserInfo">
<if test="appLoginPassword != null"> update mxk_userinfo set
apploginpassword = #{appLoginPassword}, <if test="protectedApps != null">
</if> protectedapps = #{protectedApps},
modifieddate = current_timestamp </if>
where modifieddate = current_timestamp
id = #{id} where
</update> id = #{id}
</update>
<update id="updateProtectedApps" parameterType="UserInfo" >
update mxk_userinfo set <update id="updatePasswordQuestion" parameterType="UserInfo">
<if test="protectedApps != null"> update mxk_userinfo set
protectedapps = #{protectedApps}, <if test="passwordAnswer != null">
</if> passwordquestion = #{passwordQuestion},
modifieddate = current_timestamp passwordanswer = #{passwordAnswer},
where </if>
id = #{id} modifieddate = current_timestamp
</update> where
id = #{id}
<update id="changePasswordQuestion" parameterType="UserInfo" > </update>
update mxk_userinfo set
<if test="passwordAnswer != null"> <update id="updateAuthnType" parameterType="UserInfo">
passwordquestion = #{passwordQuestion}, update mxk_userinfo set
passwordanswer = #{passwordAnswer}, <if test="authnType != null">
</if> authntype = #{authnType},
modifieddate = current_timestamp </if>
where modifieddate = current_timestamp
id = #{id} where
</update> id = #{id}
</update>
<update id="changeAuthnType" parameterType="UserInfo" >
update mxk_userinfo set <update id="updateEmail" parameterType="UserInfo">
<if test="authnType != null"> update mxk_userinfo set
authntype = #{authnType}, <if test="email != null">
</if> email = #{email},
modifieddate = current_timestamp </if>
where <if test="emailVerified != null">
id = #{id} emailverified = #{emailVerified},
</update> </if>
<if test="theme != null">
<update id="changeEmail" parameterType="UserInfo" > theme = #{theme},
update mxk_userinfo set </if>
<if test="email != null"> modifieddate = current_timestamp
email = #{email}, where
</if> id = #{id}
<if test="emailVerified != null"> </update>
emailverified = #{emailVerified},
</if> <update id="updateMobile" parameterType="UserInfo">
<if test="theme != null"> update mxk_userinfo set
theme = #{theme}, <if test="mobile != null">
</if> mobile = #{mobile},
modifieddate = current_timestamp </if>
where <if test="mobileVerified != null">
id = #{id} mobileverified = #{mobileVerified},
</update> </if>
modifieddate = current_timestamp
<update id="changeMobile" parameterType="UserInfo" > where
update mxk_userinfo set id = #{id}
<if test="mobile != null"> </update>
mobile = #{mobile},
</if> <update id="updateProfile" parameterType="UserInfo">
<if test="mobileVerified != null"> update mxk_userinfo set
mobileverified = #{mobileVerified}, displayname = #{displayName},
</if> nickname = #{nickName},
modifieddate = current_timestamp namezhspell = #{nameZhSpell},
where namezhshortspell= #{nameZhShortSpell},
id = #{id} givenname = #{givenName},
</update> middlename = #{middleName},
familyname = #{familyName},
<update id="logisticBatchDelete" parameterType="java.util.List"> honorificprefix = #{honorificPrefix},
update mxk_userinfo set status='2' where id in honorificsuffix = #{honorificSuffix},
<foreach item="item" collection="list" open="(" separator="," close=")"> formattedname = #{formattedName} ,
#{item} married = #{married},
</foreach> gender = #{gender},
</update> birthdate = #{birthDate},
<if test="picture != null">
<update id="updateProfile" parameterType="UserInfo" > picture = #{picture},
update mxk_userinfo set </if>
displayname = #{displayName}, idtype = #{idType},
nickname = #{nickName}, idcardno = #{idCardNo},
namezhspell = #{nameZhSpell}, website = #{webSite},
namezhshortspell= #{nameZhShortSpell},
givenname = #{givenName}, locale = #{locale},
middlename = #{middleName}, timezone = #{timeZone},
familyname = #{familyName}, preferredlanguage= #{preferredLanguage},
honorificprefix = #{honorificPrefix},
honorificsuffix = #{honorificSuffix}, windowsaccount = #{windowsAccount},
formattedname = #{formattedName} ,
married = #{married}, workcountry = #{workCountry},
gender = #{gender}, workregion = #{workRegion},
birthdate = #{birthDate}, worklocality = #{workLocality},
<if test="picture != null"> workstreetaddress= #{workStreetAddress},
picture = #{picture}, workaddressformatted= #{workAddressFormatted},
</if> workemail = #{workEmail},
idtype = #{idType}, workphonenumber = #{workPhoneNumber},
idcardno = #{idCardNo}, workpostalcode = #{workPostalCode},
website = #{webSite}, workfax = #{workFax},
locale = #{locale}, homecountry = #{homeCountry},
timezone = #{timeZone}, homeregion = #{homeRegion},
preferredlanguage= #{preferredLanguage}, homelocality = #{homeLocality},
homestreetaddress= #{homeStreetAddress},
windowsaccount = #{windowsAccount}, homeaddressformatted= #{homeAddressFormatted},
homeemail = #{homeEmail},
workcountry = #{workCountry}, homephonenumber= #{homePhoneNumber},
workregion = #{workRegion}, homepostalcode = #{homePostalCode},
worklocality = #{workLocality}, homefax = #{homeFax},
workstreetaddress= #{workStreetAddress},
workaddressformatted= #{workAddressFormatted}, extraattribute = #{extraAttribute},
workemail = #{workEmail},
workphonenumber = #{workPhoneNumber}, modifiedby = #{modifiedBy},
workpostalcode = #{workPostalCode}, modifieddate = current_timestamp
workfax = #{workFax}, where
id = #{id}
homecountry = #{homeCountry}, </update>
homeregion = #{homeRegion},
homelocality = #{homeLocality}, <select id="findDeptsByUserId" parameterType="string" resultType="Organizations">
homestreetaddress= #{homeStreetAddress}, select o.*, 1 isPrimary
homeaddressformatted= #{homeAddressFormatted}, from mxk_organizations o,
homeemail = #{homeEmail}, mxk_userinfo u
homephonenumber= #{homePhoneNumber}, where o.instid = #{instId}
homepostalcode = #{homePostalCode}, and u.instid = #{instId}
homefax = #{homeFax}, and o.id = u.departmentid
and u.id = #{value}
extraattribute = #{extraAttribute},
union all
modifiedby = #{modifiedBy},
modifieddate = current_timestamp select o.*, 0 isPrimary
where from mxk_organizations o,
id = #{id} mxk_userinfo_adjunct ua
</update> where o.instid = #{instId}
and ua.instid = #{instId}
and o.id = ua.departmentid
and ua.userid = #{value}
</select>
<select id="findAdjointsByUserId" parameterType="string" resultType="UserInfoAdjoint">
select *
from mxk_userinfo_adjunct
where userid = #{value}
</select>
</mapper> </mapper>