!10 适配postgresql

Merge pull request !10 from oof/master
This commit is contained in:
MaxKeyTop 2022-03-07 09:56:53 +00:00 committed by Gitee
commit 7a5cdae8ca
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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

@ -2,31 +2,68 @@
<!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
*
from
mxk_accounts
where instid = #{instId}
<include refid="where_statement"/>
</select>
<select id="queryPageResults" parameterType="Accounts" resultType="Accounts"> <select id="queryUserNotInStrategy" parameterType="AccountsStrategy" resultType="UserInfo">
select select
* *
from from mxk_userinfo u
mxk_accounts where u.instid = #{instId}
where and not exists(
(1=1) select 1 from mxk_accounts ac
<include refid="where_statement"/> where ac.appid = #{appId}
</select> 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

@ -2,29 +2,28 @@
<!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

@ -2,16 +2,14 @@
<!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
and status = 1
</select> </select>
</mapper> </mapper>

View File

@ -2,17 +2,15 @@
<!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
and status = 1
</select> </select>
</mapper> </mapper>

View File

@ -2,195 +2,184 @@
<!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 id="queryPageResults" parameterType="Apps" resultType="Apps">
select select
* *
from from
mxk_apps mxk_apps
where where instid = #{instId}
(1=1) <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,
sharedpassword,
systemuserattr,
isextendattr,
extendattr,
userpropertys,
issignature,
isadapter,
adapterid,
adaptername,
adapter,
principal,
credentials,
visible,
sortindex,
createdby,
createddate,
status,
logouturl,
logouttype,
instid)
values (#{id},
#{name},
#{icon},
#{loginUrl},
#{protocol},
#{category},
#{secret},
#{description},
#{vendor},
#{vendorUrl},
#{credential},
#{sharedUsername},
#{sharedPassword},
#{systemUserAttr},
#{isExtendAttr},
#{extendAttr},
#{userPropertys},
#{isSignature},
#{isAdapter},
#{adapterId},
#{adapterName},
#{adapter},
#{principal},
#{credentials},
#{visible},
#{sortIndex},
#{createdBy},
#{createdDate},
#{status},
#{logoutUrl},
#{logoutType},
#{instId})
</insert>
credential, <update id="updateApp" parameterType="Apps">
sharedusername, update mxk_apps set
sharedpassword, name = #{name},
systemuserattr, <if test="icon != null">
icon = #{icon},
</if>
loginurl = #{loginUrl},
protocol = #{protocol},
category = #{category},
secret = #{secret},
description = #{description},
vendor = #{vendor},
vendorurl = #{vendorUrl},
isextendattr, credential = #{credential},
extendattr, sharedusername = #{sharedUsername},
userpropertys, sharedpassword = #{sharedPassword},
systemuserattr = #{systemUserAttr},
<!--
isextendattr = #{isExtendAttr},
extendattr = #{extendAttr},
-->
userpropertys = #{userPropertys},
issignature = #{isSignature},
issignature, <if test="adapter != null">
isadapter = #{isAdapter},
adapterid = #{adapterId},
adaptername = #{adapterName},
adapter = #{adapter},
</if>
principal = #{principal},
credentials = #{credentials},
visible = #{visible},
sortindex = #{sortIndex},
isadapter, modifiedby = #{modifiedBy},
adapter, modifieddate = #{modifiedDate},
principal, status = #{status},
credentials,
visible, logouturl = #{logoutUrl},
logouttype = #{logoutType}
sortindex, where
ID = #{id}
createdby,
createddate,
status,
logouturl,
logouttype
)values(
#{id},
#{name},
#{icon},
#{loginUrl},
#{protocol},
#{category},
#{secret},
#{description},
#{vendor} ,
#{vendorUrl},
#{credential},
#{sharedUsername},
#{sharedPassword},
#{systemUserAttr},
#{isExtendAttr},
#{extendAttr},
#{userPropertys},
#{isSignature},
#{isAdapter},
#{adapter},
#{principal},
#{credentials},
#{visible},
#{sortIndex},
#{createdBy},
#{createdDate} ,
#{status},
#{logoutUrl},
#{logoutType}
)
</insert>
<update id="updateApp" parameterType="Apps" >
update mxk_apps set
name = #{name},
<if test="icon != null">
icon = #{icon},
</if>
loginurl = #{loginUrl},
protocol = #{protocol},
category = #{category},
secret = #{secret},
description = #{description},
vendor = #{vendor},
vendorurl = #{vendorUrl},
credential = #{credential},
sharedusername = #{sharedUsername},
sharedpassword = #{sharedPassword},
systemuserattr = #{systemUserAttr},
<!--
isextendattr = #{isExtendAttr},
extendattr = #{extendAttr},
-->
userpropertys = #{userPropertys},
issignature = #{isSignature},
<if test="adapter != null">
isadapter = #{isAdapter},
adapter = #{adapter},
</if>
principal = #{principal},
credentials = #{credentials},
visible = #{visible},
sortindex = #{sortIndex},
modifiedby = #{modifiedBy},
modifieddate = #{modifiedDate},
status = #{status},
logouturl = #{logoutUrl},
logouttype = #{logoutType}
where
id = #{id}
</update> </update>
<select id="queryMyApps" parameterType="UserApps" resultType="UserApps"> <select id="queryMyApps" parameterType="UserApps" resultType="UserApps">
select distinct select distinct
app.* app.*
from from
mxk_apps app,mxk_group_privileges gp,mxk_groups g mxk_apps app,mxk_group_privileges gp,mxk_groups g
where where
app.id=gp.appid app.id=gp.appid
and gp.groupid=g.id and gp.groupid=g.id
and app.visible != 0 and app.instid = #{instId}
and ( and gp.instid = #{instId}
g.id='ROLE_ALL_USER' and g.instid = #{instId}
or g.id in( and app.visible != 0
select and (
gm.groupid g.id='ROLE_ALL_USER'
from or g.id in(
mxk_group_member gm,mxk_userinfo u select
where gm.memberid = u.id gm.groupid
<if test="userId != null and userId != ''"> from
and u.id = #{userId} mxk_group_member gm,mxk_userinfo u
</if> where gm.memberid = u.id
<if test="username != null and username != ''"> <if test="userId != null and userId != ''">
and u.username = #{username} and u.id = #{userId}
</if> </if>
) <if test="username != null and username != ''">
) and u.username = #{username}
</if>
)
)
<if test="name != null and name != ''"> <if test="name != null and name != ''">
and name = #{name} and name = #{name}
</if> </if>
order by sortindex order by sortindex
</select> </select>

View File

@ -2,33 +2,31 @@
<!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
and app.status = 1
</select> </select>
</mapper> </mapper>

View File

@ -2,17 +2,15 @@
<!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
and status = 1
</select> </select>
</mapper> </mapper>

View File

@ -2,259 +2,296 @@
<!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
from
mxk_userinfo u
where 1 = 1
</select>
<select id="memberInGroup" parameterType="GroupMember" resultType="GroupMember"> <select id="memberInGroup" parameterType="GroupMember" resultType="GroupMember">
select distinct select distinct
gm.id, gm.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,
gm.createddate,
u.status
from
mxk_userinfo u,
mxk_groups g,
mxk_group_member gm
where u.instid = #{instId}
and g.instid = #{instId}
and gm.instid = #{instId}
<if test="groupId != null and groupId != ''">
and gm.groupid = #{groupId}
and g.id = #{groupId}
</if>
<if test="groupName != null and groupName != ''">
and g.name = #{groupName}
</if>
<if test="username != null and username != ''">
and u.username = #{username}
</if>
<if test="displayName != null and displayName != ''">
and u.displayname like '%${displayName}%'
</if>
and gm.type in( 'USER','USER-DYNAMIC')
and gm.groupid = g.id
and gm.memberid = u.id
</select>
u.createdby, <select id="memberNotInGroup" parameterType="GroupMember" resultType="GroupMember">
u.createddate, select distinct
u.modifiedby, u.id,
u.modifieddate, u.username,
u.usertype,
u.windowsaccount,
u.status u.displayname ,
from u.nickname ,
mxk_userinfo u, u.namezhspell,
mxk_groups g, u.namezhshortspell,
mxk_group_member gm u.givenname ,
where 1 = 1 u.middlename ,
<if test="groupId != null and groupId != ''"> u.familyname ,
and gm.groupid = #{groupId}
and g.id = #{groupId} u.gender,
</if>
<if test="groupName != null and groupName != ''"> u.authntype,
and g.name = #{groupName} u.mobile,
</if> u.email,
<if test="username != null and username != ''"> u.workemail,
and u.username = #{username} u.workphonenumber,
</if>
<if test="displayName != null and displayName != ''"> u.employeenumber,
and u.displayname like '%${displayName}%' u.division,
</if> u.costcenter,
and gm.type in( 'USER','USER-DYNAMIC') u.organization,
and gm.groupid = g.id u.departmentid,
and gm.memberid = u.id u.department,
</select> u.jobtitle,
u.joblevel,
<select id="memberNotInGroup" parameterType="GroupMember" resultType="GroupMember"> u.createdby,
select distinct u.createddate,
u.id, u.modifiedby,
u.username, u.modifieddate,
u.usertype,
u.windowsaccount,
u.displayname , u.status
u.nickname , from
u.namezhspell, mxk_userinfo u
u.namezhshortspell, where
u.givenname , u.id not in(
u.middlename , select gm.memberid
u.familyname , from mxk_groups g,mxk_group_member gm
where 1 = 1
u.gender, <if test="groupId != null and groupId != ''">
and gm.groupid = #{groupId}
u.authntype, and g.id = #{groupId}
u.mobile, </if>
u.email, <if test="groupName != null and groupName != ''">
u.workemail, and g.name = #{groupName}
u.workphonenumber, </if>
and gm.type in( 'USER','USER-DYNAMIC')
u.employeenumber, and gm.groupid = g.id
u.division, )
u.costcenter, <if test="username != null and username != ''">
u.organization, and u.username = #{username}
u.departmentid, </if>
u.department, <if test="displayName != null and displayName != ''">
u.jobtitle, and u.displayname like '%${displayName}%'
u.joblevel, </if>
</select>
u.createdby, <!-- GROUP_MEMBER Group Member-->
u.createddate, <select id="groupMemberInGroup" parameterType="GroupMember" resultType="Groups">
u.modifiedby, select distinct
u.modifieddate, ig.*
from
mxk_groups ig,
mxk_groups g,
mxk_group_member gm
where
1 = 1
and gm.groupid = g.id
and gm.memberid = ig.id
and gm.type = 'GROUP'
<if test="groupId != null and groupId != ''">
and gm.groupid = #{groupId}
and g.id = #{groupId}
</if>
<if test="groupName != null and groupName != ''">
and g.name = #{groupName}
</if>
</select>
u.status <update id="addDynamicGroupMember" parameterType="Groups">
from insert into mxk_group_member(
mxk_userinfo u id,
where groupid,
u.id not in( memberid,
select gm.memberid type
from mxk_groups g,mxk_group_member gm )
where 1 = 1 select
<if test="groupId != null and groupId != ''"> concat('${id}',u.id) id,
and gm.groupid = #{groupId} '${id}' groupid,
and g.id = #{groupId} u.id memberid,
</if> 'USER-DYNAMIC' TYPE
<if test="groupName != null and groupName != ''"> from mxk_userinfo u
and g.name = #{groupName} where not exists(
</if> select 1 from mxk_group_member gm
and gm.type in( 'USER','USER-DYNAMIC') where gm.groupid=#{id}
and gm.groupid = g.id and gm.memberid=u.id
) and gm.type='USER-DYNAMIC'
<if test="username != null and username != ''"> )
and u.username = #{username} <if test="filters != null and filters != ''">
</if> and (${filters})
<if test="displayName != null and displayName != ''"> </if>
and u.displayname like '%${displayName}%' <if test="orgIdsList != null and orgIdsList != ''">
</if> and u.departmentid in( ${orgIdsList})
</select> </if>
<!-- GROUP_MEMBER Group Member-->
<select id="groupMemberInGroup" parameterType="GroupMember" resultType="Groups">
select distinct
ig.*
from
mxk_groups ig,
mxk_groups g,
mxk_group_member gm
where
1 = 1
and gm.groupid = g.id
and gm.memberid = ig.id
and gm.type = 'GROUP'
<if test="groupId != null and groupId != ''">
and gm.groupid = #{groupId}
and g.id = #{groupId}
</if>
<if test="groupName != null and groupName != ''">
and g.name = #{groupName}
</if>
</select>
<update id="addDynamicGroupMember" parameterType="Groups" >
insert into mxk_group_member(
id,
groupid,
memberid,
type
)
select
concat_ws('-','UD','${id}',u.id) id,
'${id}' groupid,
u.id memberid,
'USER-DYNAMIC' as type
from mxk_userinfo u
where not exists(
select 1 from mxk_group_member gm
where gm.groupid=#{id}
and gm.memberid=u.id
and gm.type='USER-DYNAMIC'
)
<if test="filters != null and filters != ''">
and (${filters})
</if>
<if test="orgIdsList != null and orgIdsList != ''">
and u.departmentid in( ${orgIdsList})
</if>
</update> </update>
<delete id="deleteDynamicGroupMember" parameterType="Groups" > <delete id="deleteDynamicGroupMember" parameterType="Groups">
delete from mxk_group_member gm delete from mxk_group_member gm
where type = 'user-dynamic' where type = 'user-dynamic'
and gm.groupid=#{id} and gm.groupid=#{id}
and not exists( and not exists(
select 1 select 1
from mxk_userinfo u from mxk_userinfo u
where 1 = 1 where 1 = 1
and u.id=gm.memberid and u.id=gm.memberid
<if test="filters != null and filters != ''"> <if test="filters != null and filters != ''">
and (${filters}) and (${filters})
</if> </if>
<if test="orgIdsList != null and orgIdsList != ''"> <if test="orgIdsList != null and orgIdsList != ''">
and u.departmentid in ( ${orgIdsList}) and u.departmentid in ( ${orgIdsList})
</if> </if>
) )
</delete> </delete>
<delete id="deleteByGroupId" parameterType="string" > <select id="queryMemberByGroupId" parameterType="string" resultType="UserInfo">
delete from mxk_group_member gm select distinct u.id,
where gm.groupid=#{value} u.username,
u.usertype,
u.windowsaccount,
u.displayname,
u.nickname,
u.namezhspell,
u.namezhshortspell,
u.givenname,
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> </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>
<select id="appsNotInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges"> <select id="appsNotInGroup" parameterType="GroupPrivileges" resultType="GroupPrivileges">
select select
* *
from from
mxk_apps apps mxk_apps apps
where where
1 = 1 1 = 1
and apps.id not in( and apps.id not in(
select select
appid appid
from from
mxk_group_privileges mxk_group_privileges
where where
groupid = #{groupId} groupid = #{groupId}
) )
<include refid="where_statement"/> <include refid="where_statement"/>
</select> </select>
</mapper> </mapper>

View File

@ -2,57 +2,74 @@
<!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
*
from
mxk_groups
where instid = #{instId}
<include refid="where_statement"/>
</select>
<select id="queryPageResults" parameterType="Groups" resultType="Groups"> <select id="queryDynamicGroups" parameterType="Groups" resultType="Groups">
select select
* *
from from
mxk_groups mxk_groups
where where instid = #{instId}
(1=1) and dynamic = '1'
<include refid="where_statement"/> <include refid="where_statement"/>
</select> </select>
<select id="queryDynamicGroups" parameterType="Groups" resultType="Groups">
select
*
from
mxk_groups
where
dynamic = '1'
<include refid="where_statement"/>
</select>
<update id="logisticDelete" parameterType="Groups" > <update id="logisticDelete" parameterType="Groups">
update mxk_groups set update mxk_groups 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_groups set status='2' where id in update mxk_groups
<foreach item="item" collection="list" open="(" separator="," close=")"> set status='2'
#{item} where instid = #{instId}
</foreach> and id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</update> </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,53 +1,54 @@
<?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
<include refid="dao_where_statement"/>
order by logintime desc from mxk_history_login_apps
where instid = #{instId}
<include refid="dao_where_statement"/>
order by logintime desc
</select> </select>

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,
sessionid,
userId,
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}
<include refid="dao_where_statement"/>
<select id="queryPageResults" parameterType="HistoryLogin" resultType="HistoryLogin"> order by logintime desc
select
id,
sessionid,
userId,
username,
displayname,
logintype,
message,
code,
provider,
sourceip,
browser,
platform,
application,
loginurl,
to_char(logintime,'YYYY-MM-DD HH24:MI:SS') as logintime,
to_char(logouttime,'YYYY-MM-DD HH24:MI:SS') as logouttime
from mxk_history_login
where 1 = 1
<include refid="dao_where_statement"/>
order by logintime desc
</select> </select>
<update id="logout" parameterType="java.lang.String" >
update mxk_history_login set <select id="queryOnlineSession" parameterType="HistoryLogin" resultType="HistoryLogin">
logouttime = current_timestamp select
where sessionid id,
sessionid = #{value} sessionid,
userId,
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> </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

@ -2,35 +2,32 @@
<!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
*
from
mxk_notices
where
instid = #{instId}
<include refid="where_statement"/>
order by modifieddate desc
</select>
<select id="queryPageResults" parameterType="Notices" resultType="Notices"> <select id="queryLastedNotices" parameterType="Notices" resultType="Notices">
select select *
* from mxk_notices
from where instid = #{instId}
mxk_notices order by modifieddate desc limit 1
where </select>
(1=1)
<include refid="where_statement"/>
order by modifieddate desc
</select>
<select id="queryLastedNotices" parameterType="Notices" resultType="Notices">
select
*
from
mxk_notices
order by modifieddate desc
limit 1
</select>
</mapper> </mapper>

View File

@ -1,57 +1,68 @@
<?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>
<if test="name != name">
and name = #{name}
</if>
<if test="enable != null">
and status = '1'
</if>
<if test="codePath != null">
and codepath = #{codePath}
</if>
</update> </update>
<update id="logisticBatchDelete" parameterType="java.util.List"> <update id="logisticBatchDelete" parameterType="java.util.List">
UPDATE MXK_ORGANIZATIONS SET STATUS = '2' UPDATE MXK_ORGANIZATIONS
WHERE ID IN SET STATUS = '2'
<foreach collection="ids" item="selectId" open="(" separator="," close=")"> WHERE instid = #{instId}
#{selectId} and id in
</foreach> <foreach collection="ids" item="selectId" open="(" separator="," close=")">
#{selectId}
</foreach>
</update> </update>

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

@ -2,22 +2,16 @@
<!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="String" resultType="Integer"> <select id="analysisNewUsers" parameterType="java.util.HashMap" resultType="Integer">
select select count(*) reportcount
count(*) reportcount from mxk_userinfo
from mxk_userinfo where instid = #{instId}
where to_char(createddate,'YYYY-MM')=to_char(current_date,'YYYY-MM') and to_char(createddate,'YYYY-MM')=to_char(current_date,'YYYY-MM')
</select> </select>
<!-- 在线用户统计 --> <!-- 在线用户统计 -->
<select id="analysisOnlineUsers" parameterType="String" resultType="Integer"> <select id="analysisOnlineUsers" parameterType="java.util.HashMap" resultType="Integer">
select select count(*) reportcount
count(*) reportcount from mxk_userinfo
from mxk_userinfo where instid = #{instId}
where and online = 1
lastlogintime >lastlogofftime and extract(epoch from now() - lastlogintime) &lt; 10000
</select> </select>
<!-- 30天活跃用户统计 --> <!-- 30天活跃用户统计 -->
<select id="analysisActiveUsers" parameterType="String" resultType="Integer"> <select id="analysisActiveUsers" parameterType="java.util.HashMap" resultType="Integer">
select select count(*) reportcount
count(*) reportcount from mxk_userinfo
from mxk_userinfo where instid = #{instId}
where and date(lastlogintime) > (current_date - interval '30 day')
date(lastlogintime) >(current_date - interval '30 day')
</select> </select>
<!-- DAY HOUR COUNT 当天每小时 --> <!-- DAY HOUR COUNT 当天每小时 -->
<select id="analysisDayHour" parameterType="String" resultType="Map"> <select id="analysisDayHour" parameterType="java.util.HashMap" resultType="Map">
select select count(id) reportcount,
count(id) reportcount, to_char(logintime,'HH24') reportstring
to_char(logintime,'HH24') reportstring from mxk_history_login
from mxk_history_login where instid = #{instId}
where and date (logintime) = current_date
date(logintime) =current_date group by reportstring
group by reportstring order by reportstring
order by reportstring
</select> </select>
<!-- 30 DAY COUNT 最近30天每天访问量--> <!-- 30 DAY COUNT 最近30天每天访问量-->
<select id="analysisMonth" parameterType="String" resultType="Map"> <select id="analysisMonth" parameterType="java.util.HashMap" resultType="Map">
select select count(id) reportcount,
count(id) reportcount, date (logintime) reportstring
date(logintime) reportstring from mxk_history_login
from mxk_history_login where instid = #{instId}
where and date(logintime) > (current_date - interval '30 day')
date(logintime) >(current_date - interval '30 day') group by reportstring
group by reportstring order by reportstring
order by reportstring
</select> </select>
<!-- 30天浏览器的访问统计 --> <!-- 30天浏览器的访问统计 -->
<select id="analysisBrowser" parameterType="Map" resultType="Map"> <select id="analysisBrowser" parameterType="java.util.HashMap" resultType="Map">
select select count(id) reportcount,
count(id) reportcount, coalesce(browser, 'Other') reportstring
browser reportstring from mxk_history_login
from mxk_history_login where instid = #{instId}
where and date(logintime) &gt; (current_date - interval '30 day')
date(logintime) >(current_date - interval '30 day') group by reportstring
group by reportstring order by reportcount desc
order by reportcount desc
</select> </select>
<!-- 30天应用单点登录的访问统计 --> <!-- 30天应用单点登录的访问统计 -->
<select id="analysisApp" parameterType="Map" resultType="Map"> <select id="analysisApp" parameterType="Map" resultType="Map">
select select count(id) reportcount,
count(id) reportcount, appname
appname from mxk_history_login_apps
from mxk_history_login_apps where instid = #{instId}
where and date(logintime) &gt; (current_date - interval '30 day')
date(logintime) >(current_date - interval '30 day') group by appname
group by appname order by reportcount desc order by reportcount desc
</select> </select>
</mapper> </mapper>

View File

@ -2,53 +2,57 @@
<!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 test="name != null and name != ''">
and res.name like '%${name}%'
</if> </if>
<if test="name != null and name != ''">
and res.name like '%${name}%'
</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 id="logisticDelete" parameterType="Resources">
update mxk_resources set update mxk_resources 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_resources set status='2' where id in update mxk_resources
<foreach item="item" collection="list" open="(" separator="," close=")"> set status='2'
#{item} where instid = #{instId}
</foreach> and id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</update> </update>

View File

@ -2,260 +2,254 @@
<!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
from
mxk_userinfo u
where 1 = 1
</select>
<select id="memberInRole" parameterType="RoleMember" resultType="RoleMember"> <select id="memberInRole" parameterType="RoleMember" resultType="RoleMember">
select distinct select distinct
rm.id, rm.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.createdby, rm.createddate,
u.createddate,
u.modifiedby,
u.modifieddate,
u.status u.status
from from
mxk_userinfo u, mxk_userinfo u,
mxk_roles r, mxk_roles r,
mxk_role_member rm mxk_role_member rm
where 1 = 1 where u.instid = #{instId}
<if test="roleId != null and roleId != ''"> and r.instid = #{instId}
and rm.roleid = #{roleId} and rm.instid = #{instId}
and r.id = #{roleId} <if test="roleId != null and roleId != ''">
</if> and rm.roleid = #{roleId}
<if test="roleName != null and roleName != ''"> and r.id = #{roleId}
and r.name = #{roleName} </if>
</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="username != null and username != ''">
<if test="displayName != null and displayName != ''"> and u.username = #{username}
and u.displayname like '%${displayName}%' </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>
and rm.memberid = u.id and rm.type in( 'USER','USER-DYNAMIC')
</select> and rm.roleid = r.id
and rm.memberid = u.id
</select>
<select id="memberNotInRole" parameterType="RoleMember" resultType="RoleMember"> <select id="memberNotInRole" 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.createdby, u.createdby,
u.createddate, u.createddate,
u.modifiedby, u.modifiedby,
u.modifieddate, u.modifieddate,
u.status u.status
from from
mxk_userinfo u mxk_userinfo u
where where
u.id not in( u.id not in(
select rm.memberid select rm.memberid
from mxk_roles r,mxk_role_member rm from mxk_roles r,mxk_role_member rm
where 1 = 1 where 1 = 1
<if test="roleId != null and roleId != ''"> <if test="roleId != null and roleId != ''">
and rm.roleid = #{roleId} and rm.roleid = #{roleId}
and r.id = #{roleId} and r.id = #{roleId}
</if> </if>
<if test="roleName != null and roleName != ''"> <if test="roleName != null and roleName != ''">
and r.name = #{roleName} and r.name = #{roleName}
</if> </if>
and rm.type in( 'USER','USER-DYNAMIC') and rm.type in( 'USER','USER-DYNAMIC')
and rm.roleid = r.id and rm.roleid = r.id
) )
<if test="username != null and username != ''"> <if test="username != null and username != ''">
and u.username = #{username} and u.username = #{username}
</if> </if>
<if test="displayName != null and displayName != ''"> <if test="displayName != null and displayName != ''">
and u.displayname like '%${displayName}%' and u.displayname like '%${displayName}%'
</if> </if>
</select> </select>
<!-- ROLE_MEMBER Roles Member--> <!-- ROLE_MEMBER Roles Member-->
<select id="roleMemberInRole" parameterType="RoleMember" resultType="Roles"> <select id="roleMemberInRole" parameterType="RoleMember" resultType="Roles">
select distinct select distinct
ir.* ir.*
from from
mxk_roles ir, mxk_roles ir,
mxk_roles r, mxk_roles r,
mxk_role_member rm mxk_role_member rm
where where
1 = 1 1 = 1
and rm.groupid = r.id and rm.groupid = r.id
and rm.memberid = ir.id and rm.memberid = ir.id
and rm.type in( 'USER','USER-DYNAMIC') and rm.type in( 'USER','USER-DYNAMIC')
<if test="roleId != null and roleId != ''"> <if test="roleId != null and roleId != ''">
and rm.roleid = #{roleId} and rm.roleid = #{roleId}
and r.id = #{roleId} and r.id = #{roleId}
</if> </if>
<if test="roleName != null and roleName != ''"> <if test="roleName != null and roleName != ''">
and r.name = #{roleName} and r.name = #{roleName}
</if> </if>
</select> </select>
<update id="addDynamicRoleMember" parameterType="Roles" > <update id="addDynamicRoleMember" parameterType="Roles">
insert into mxk_role_member( insert into mxk_role_member(
id, id,
roleid, roleid,
memberid, memberid,
type type
) )
select select
concat_ws('-','UD','${id}',u.id) id, concat('${id}',u.id) id,
'${id}' ROLEID, '${id}' ROLEID,
u.id memberid, u.id memberid,
'USER-DYNAMIC' type 'USER-DYNAMIC' type
from mxk_userinfo u from mxk_userinfo u
where not exists( where not exists(
select 1 from mxk_role_member rm select 1 from mxk_role_member rm
where rm.roleid=#{id} where rm.roleid=#{id}
and rm.memberid=u.id and rm.memberid=u.id
and rm.type='USER-DYNAMIC' and rm.type='USER-DYNAMIC'
) )
<if test="filters != null and filters != ''"> <if test="filters != null and filters != ''">
${filters} ${filters}
</if> </if>
<if test="orgIdsList != null and orgIdsList != ''"> <if test="orgIdsList != null and orgIdsList != ''">
and u.departmentid in( ${orgIdsList}) and u.departmentid in( ${orgIdsList})
</if> </if>
</update> </update>
<delete id="deleteDynamicRoleMember" parameterType="Roles" > <delete id="deleteDynamicRoleMember" parameterType="Roles">
delete from mxk_role_member rm delete from mxk_role_member rm
where type = 'USER-DYNAMIC' where type = 'USER-DYNAMIC'
and rm.roleid = #{id} and rm.roleid = #{id}
and not exists( and not exists(
select 1 select 1
from mxk_userinfo u from mxk_userinfo u
where 1 = 1 where 1 = 1
and u.id=rm.memberid and u.id=rm.memberid
<if test="filters != null and filters != ''"> <if test="filters != null and filters != ''">
${filters} ${filters}
</if> </if>
<if test="orgIdsList != null and orgIdsList != ''"> <if test="orgIdsList != null and orgIdsList != ''">
and u.departmentid in( ${orgIdsList}) and u.departmentid in( ${orgIdsList})
</if> </if>
) )
</delete> </delete>
<delete id="deleteByRoleId" parameterType="string" > <delete id="deleteByRoleId" parameterType="string">
delete from mxk_role_member rm delete
where rm.roleid=#{value} from mxk_role_member rm
where rm.roleid = #{value}
</delete> </delete>
</mapper> </mapper>

View File

@ -2,91 +2,95 @@
<!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
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</update> </update>
<select id="queryRolePermissions" parameterType="RolePermissions" resultType="RolePermissions"> <select id="queryRolePermissions" parameterType="RolePermissions" resultType="RolePermissions">
select select
* *
from from
mxk_role_permissions mxk_role_permissions
where where instid = #{instId}
status = 1 and status = 1
<if test="id != null and id != ''"> <if test="id != null and id != ''">
and id = #{id} and id = #{id}
</if> </if>
<if test="roleId != null and roleId != ''"> <if test="roleId != null and roleId != ''">
and roleid = #{roleId} and roleid = #{roleId}
</if> </if>
<if test="appId != null and appId != ''"> <if test="appId != null and appId != ''">
and appid = #{appId} and appid = #{appId}
</if> </if>
</select> </select>
<update id="logisticDeleteRolePermissions" parameterType="java.util.List"> <update id="logisticDeleteRolePermissions" parameterType="java.util.List">
update mxk_role_permissions set status=9 where id in update mxk_role_permissions
<foreach item="item" collection="list" open="(" separator="," close=")"> set status = 9
#{item.id} where 1 = 1 and
</foreach> <foreach item="item" collection="list" open="(" separator="or" close=")">
( id = #{item.id} and instid = #{item.instId} )
</foreach>
</update> </update>
<insert id="insertRolePermissions" parameterType="java.util.List"> <insert id="insertRolePermissions" parameterType="java.util.List">
insert into mxk_role_permissions ( id,appid,roleid,resourceid,status) insert into mxk_role_permissions ( id,appid,roleid,resourceid,status,instid)
values values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
(#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status}) (#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status},#{item.instId})
</foreach> </foreach>
</insert> </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

@ -2,48 +2,49 @@
<!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 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_userinfo_adjunct set status='2' where id in update mxk_userinfo_adjunct
<foreach item="item" collection="list" open="(" separator="," close=")"> set status='2'
#{item} where instid = #{instId}
</foreach> and id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</update> </update>
</mapper> </mapper>

View File

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