diff --git a/maxkey-core/src/main/java/org/maxkey/entity/Institutions.java b/maxkey-core/src/main/java/org/maxkey/entity/Institutions.java index cfc143a5d..aa2db142e 100644 --- a/maxkey-core/src/main/java/org/maxkey/entity/Institutions.java +++ b/maxkey-core/src/main/java/org/maxkey/entity/Institutions.java @@ -259,7 +259,7 @@ public class Institutions extends JpaBaseEntity implements Serializable { } public boolean isCaptchaSupport() { - return (captchaSupport !=null && captchaSupport.equalsIgnoreCase("YES") ? true : false); + return "YES".equalsIgnoreCase(captchaSupport); } diff --git a/maxkey-core/src/main/java/org/maxkey/persistence/repository/LoginRepository.java b/maxkey-core/src/main/java/org/maxkey/persistence/repository/LoginRepository.java index 6a12d2282..a3765e11c 100644 --- a/maxkey-core/src/main/java/org/maxkey/persistence/repository/LoginRepository.java +++ b/maxkey-core/src/main/java/org/maxkey/persistence/repository/LoginRepository.java @@ -257,13 +257,13 @@ public class LoginRepository { userInfo.getLoginCount() + 1, 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) { jdbcTemplate.update( LOGOUT_USERINFO_UPDATE_STATEMENT, new Object[] { userInfo.getLastLogoffTime(), userInfo.getId() }, - new int[] { Types.VARCHAR, Types.VARCHAR }); + new int[] { Types.TIMESTAMP, Types.VARCHAR }); } public class UserInfoRowMapper implements RowMapper { diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AccountsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AccountsMapper.xml index b52849859..ff5be826e 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AccountsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AccountsMapper.xml @@ -1,32 +1,69 @@ - - - - - - - and id = #{id} - - - and appid = #{appId} - - - and username = #{username} - - - and relatedusername = #{relatedUsername} - - - - - - - + + + + + + + and id = #{id} + + + and appid = #{appId} + + + and username = #{username} + + + and relatedusername = #{relatedUsername} + + + + + + + + + + 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 + + and (${filters}) + + + and u.departmentid in ( ${orgIdsList}) + + ) + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AccountsStrategyMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AccountsStrategyMapper.xml new file mode 100644 index 000000000..9e07bbbcf --- /dev/null +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AccountsStrategyMapper.xml @@ -0,0 +1,31 @@ + + + + + + + and mas.id = #{id} + + + and mas.appid = #{appId} + + + and mas.name = #{name} + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsAdaptersMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsAdaptersMapper.xml index 3aabab07a..4be3e919a 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsAdaptersMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsAdaptersMapper.xml @@ -1,30 +1,29 @@ - - - - - - - and id = #{id} - - - and name like '%${name}%' - - - and protocol = #{protocol} - - - - - - - + + + + + + + and id = #{id} + + + and name like '%${name}%' + + + and protocol = #{protocol} + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsCasDetailsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsCasDetailsMapper.xml index 53fdbc5cb..cb6b3b45b 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsCasDetailsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsCasDetailsMapper.xml @@ -1,18 +1,16 @@ - - - - + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsFormBasedDetailsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsFormBasedDetailsMapper.xml index 6ac5df162..1bb54bd64 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsFormBasedDetailsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsFormBasedDetailsMapper.xml @@ -1,17 +1,15 @@ - - - - - + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsJwtDetailsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsJwtDetailsMapper.xml index bc8bef6d6..b72381433 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsJwtDetailsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsJwtDetailsMapper.xml @@ -1,18 +1,16 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsMapper.xml index ee1186d22..0d74b46f1 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsMapper.xml @@ -1,197 +1,186 @@ - - - - - - - and id = #{id} - - - and name like '%${name}%' - - - and protocol = #{protocol} - - - and credential = #{credential} - - - and category = #{category} - - - and vendor = #{vendor} - - - - - - - - - insert into mxk_apps( - 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 - )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} - ) - - - - update mxk_apps set - name = #{name}, - - icon = #{icon}, - - loginurl = #{loginUrl}, - protocol = #{protocol}, - category = #{category}, - secret = #{secret}, - description = #{description}, - vendor = #{vendor}, - vendorurl = #{vendorUrl}, - - credential = #{credential}, - sharedusername = #{sharedUsername}, - sharedpassword = #{sharedPassword}, - systemuserattr = #{systemUserAttr}, - - userpropertys = #{userPropertys}, - issignature = #{isSignature}, - - - isadapter = #{isAdapter}, - adapter = #{adapter}, - - principal = #{principal}, - credentials = #{credentials}, - visible = #{visible}, - sortindex = #{sortIndex}, - - modifiedby = #{modifiedBy}, - modifieddate = #{modifiedDate}, - - status = #{status}, - - logouturl = #{logoutUrl}, - logouttype = #{logoutType} - where - id = #{id} - - - + + + + + + + and id = #{id} + + + and name like '%${name}%' + + + and protocol = #{protocol} + + + and credential = #{credential} + + + and category = #{category} + + + and vendor = #{vendor} + + + + + + + + + + insert into mxk_apps(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) + 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}) + + + + update mxk_apps set + name = #{name}, + + icon = #{icon}, + + loginurl = #{loginUrl}, + protocol = #{protocol}, + category = #{category}, + secret = #{secret}, + description = #{description}, + vendor = #{vendor}, + vendorurl = #{vendorUrl}, + + credential = #{credential}, + sharedusername = #{sharedUsername}, + sharedpassword = #{sharedPassword}, + systemuserattr = #{systemUserAttr}, + + userpropertys = #{userPropertys}, + issignature = #{isSignature}, + + + isadapter = #{isAdapter}, + adapterid = #{adapterId}, + adaptername = #{adapterName}, + adapter = #{adapter}, + + principal = #{principal}, + credentials = #{credentials}, + visible = #{visible}, + sortindex = #{sortIndex}, + + modifiedby = #{modifiedBy}, + modifieddate = #{modifiedDate}, + + status = #{status}, + + logouturl = #{logoutUrl}, + logouttype = #{logoutType} + where + ID = #{id} + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsSaml20DetailsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsSaml20DetailsMapper.xml index c26db4711..3fd93e8ef 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsSaml20DetailsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsSaml20DetailsMapper.xml @@ -1,34 +1,32 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsTokenBasedDetailsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsTokenBasedDetailsMapper.xml index 7f05af3cb..2d33a531d 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsTokenBasedDetailsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/AppsTokenBasedDetailsMapper.xml @@ -1,18 +1,16 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ForgotPasswordMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ForgotPasswordMapper.xml index 16b5f22b5..9b4906d2b 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ForgotPasswordMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ForgotPasswordMapper.xml @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupMemberMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupMemberMapper.xml index d1c538275..177c0f58b 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupMemberMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupMemberMapper.xml @@ -1,260 +1,297 @@ - - - - - - - and id = #{id} - - - and name = #{name} - - - - - - - - - - - - - - - - - - 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' - ) - - and (${filters}) - - - and u.departmentid in( ${orgIdsList}) - - - - - delete from mxk_group_member gm - where type = 'user-dynamic' - and gm.groupid=#{id} - and not exists( - select 1 - from mxk_userinfo u - where 1 = 1 - and u.id=gm.memberid - - and (${filters}) - - - and u.departmentid in ( ${orgIdsList}) - - ) - - - - delete from mxk_group_member gm - where gm.groupid=#{value} - - + + + + + + + and id = #{id} + + + and name = #{name} + + + + + + + + + + + + + + + + + + insert into mxk_group_member( + id, + groupid, + memberid, + type + ) + select + concat('${id}',u.id) id, + '${id}' groupid, + u.id memberid, + 'USER-DYNAMIC' 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' + ) + + and (${filters}) + + + and u.departmentid in( ${orgIdsList}) + + + + + delete from mxk_group_member gm + where type = 'user-dynamic' + and gm.groupid=#{id} + and not exists( + select 1 + from mxk_userinfo u + where 1 = 1 + and u.id=gm.memberid + + and (${filters}) + + + and u.departmentid in ( ${orgIdsList}) + + ) + + + + + + + delete + from mxk_group_member gm + where gm.groupid = #{value} + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupPrivilegesMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupPrivilegesMapper.xml index 102f3127e..ee10eec29 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupPrivilegesMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupPrivilegesMapper.xml @@ -1,61 +1,63 @@ - - - - - - - and apps.id = #{id} - - - and apps.name like '%${name}%' - - - and apps.protocol = #{protocol} - - - and apps.category = #{category} - - - - - - - - + + + + + + + and apps.id = #{id} + + + and apps.name like '%${name}%' + + + and apps.protocol = #{protocol} + + + and apps.category = #{category} + + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupsMapper.xml index cafca991c..a0addd97b 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/GroupsMapper.xml @@ -1,58 +1,75 @@ - - - - - - - and id = #{id} - - - and name like '%${name}%' - - - - - - - - - - - - update mxk_groups set - status = '2' - where 1 = 1 - - and id = #{id} - - - and name = #{name} - - - - - - update mxk_groups set status='2' where id in - - #{item} - - - - + + + + + + + and id = #{id} + + + and name like '%${name}%' + + + + + + + + + + + update mxk_groups set + status = '2' + where instid = #{instId} + + and id = #{id} + + + and name = #{name} + + + + + + update mxk_groups + set status='2' + where instid = #{instId} + and id in + + #{item} + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryConnectorMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryConnectorMapper.xml new file mode 100644 index 000000000..0c2f648e8 --- /dev/null +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryConnectorMapper.xml @@ -0,0 +1,62 @@ + + + + + + + and id = #{id} + + + + and conName = #{conName} + + + + and conType = #{conType} + + + + and sourceId = #{sourceId} + + + + and sourceName = #{sourceName} + + + + and objectId = #{objectId} + + + + and objectname = #{objectName} + + + + and result = #{result} + + + + and synctime >= #{startDate} + + + + and #{endDate} >= synctime + + + + and description like '%${description}%' + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLoginAppsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLoginAppsMapper.xml index 61c6c589f..4f6ac4227 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLoginAppsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLoginAppsMapper.xml @@ -1,54 +1,55 @@ - - - - - - - and id = #{id} - - - and sessionid = #{sessionId} - - - and appid = #{appId} - - - and appname like concat('%',#{appName},'%') - - - and userId = #{userId} - - - and username like concat('%',#{username},'%') - - - and displayname like concat('%',#{displayName},'%') - - - and logintime >= #{startDate} - - - and #{endDate} >= logintime - - - - - - - + + + + + + + and id = #{id} + + + and sessionid = #{sessionId} + + + and appid = #{appId} + + + and appname like concat('%',#{appName},'%') + + + and userId = #{userId} + + + and username = #{username} + + + and displayname like concat('%',#{displayName},'%') + + + and logintime >= #{startDate} + + + and #{endDate} >= logintime + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLoginMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLoginMapper.xml index 953fb0af9..b74670502 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLoginMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistoryLoginMapper.xml @@ -1,72 +1,98 @@ - - - - - - - and id = #{id} - - - and userId = #{userId} - - - and lower(username) like lower(concat('%',#{username},'%')) - - - and lower(message) like lower(concat('%',#{message},'%')) - - - and lower(displayname) like lower(concat('%',#{displayName},'%')) - - - - and logintime >= #{startDate} - - - and #{endDate} >= logintime - - - and sessionid = #{sessionId} - - - and logintype = #{loginType} - - - and sourceip = #{sourceIp} - - - - - - - - - update mxk_history_login set - logouttime = current_timestamp - where - sessionid = #{value} - + + + + + + + and id = #{id} + + + and userId = #{userId} + + + and lower(username) like lower(concat('%',#{username},'%')) + + + and lower(message) like lower(concat('%',#{message},'%')) + + + and lower(displayname) like lower(concat('%',#{displayName},'%')) + + + + and logintime >= #{startDate} + + + and #{endDate} >= logintime + + + and sessionid = #{sessionId} + + + and logintype = #{loginType} + + + and sourceip = #{sourceIp} + + + + + + + + + + + update mxk_history_login + set logouttime = current_timestamp + where sessionid = #{value} + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySynchronizerMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySynchronizerMapper.xml new file mode 100644 index 000000000..0dfd5c7b5 --- /dev/null +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySynchronizerMapper.xml @@ -0,0 +1,37 @@ + + + + + + + and id = #{id} + + + and syncid = #{syncId} + + + and objectname = #{objectName} + + + and result = #{result} + + + and synctime >= #{startDate} + + + and #{endDate} >= synctime + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySystemLogsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySystemLogsMapper.xml index a9da59fb4..a8ba17c2a 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySystemLogsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/HistorySystemLogsMapper.xml @@ -1,55 +1,55 @@ - + - - - and id = #{id} - - - and lower(servicename) like lower(concat('%',#{serviceName},'%')) - - - and lower(message) like lower(concat('%',#{message},'%')) - - - and createddate between #{startDate} and #{endDate} - - - and createdby = #{createdBy} - + + + and id = #{id} + + + and lower(servicename) like lower(concat('%',#{serviceName},'%')) + + + and lower(message) like lower(concat('%',#{message},'%')) + + + and createddate between #{startDate} and #{endDate} + + + and createdby = #{createdBy} + - - and lower(username) like lower(concat('%',#{username},'%')) - - - and messagetype = #{messageType} - - - and operatetype = #{operateType} - + + and lower(username) like lower(concat('%',#{username},'%')) + + + and messagetype = #{messageType} + + + and operatetype = #{operateType} + - - - + select + id, + tid, + tname, + servicename , + code, + message , + content, + operatetype, + messagetype, + username, + createddate, + createdby + from mxk_history_logs + where instid = #{instId} + + + order by createddate desc - + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/NoticesMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/NoticesMapper.xml index 637061b29..357eed235 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/NoticesMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/NoticesMapper.xml @@ -1,36 +1,33 @@ - - - - - - - and id = #{id} - - - and title like '%${title}%' - - - - - - - - - + + + + + + + and id = #{id} + + + and title like '%${title}%' + + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/OrganizationsMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/OrganizationsMapper.xml index c779017e4..36cd31198 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/OrganizationsMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/OrganizationsMapper.xml @@ -1,58 +1,69 @@ - - - - - - - and id = #{id} - - - and name like '%#{name}%' - - - and parentid = #{parentId} - - - and parentname like '%#{parentName}%' - - - - - - - - - - - update mxk_organizations set status = '2' - where 1 = 1 - - and id = #{id} - - - and name = #{name} - - - and status = '1' - - - and codepath = #{codePath} - - - - - UPDATE MXK_ORGANIZATIONS SET STATUS = '2' - WHERE ID IN - - #{selectId} - - - - + + + + + + + and id = #{id} + + + and name like '%${name}%' + + + and parentid = #{parentId} + + + and parentName like '%${parentName}%' + + + + + + + + + + + + update mxk_organizations set status = '2' + where instid = #{instId} + + and id = #{id} + + + and name = #{name} + + + and status = '1' + + + and codepath = #{codePath} + + + + + UPDATE MXK_ORGANIZATIONS + SET STATUS = '2' + WHERE instid = #{instId} + and id in + + #{selectId} + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/PasswordPolicyMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/PasswordPolicyMapper.xml index 9f3eaa5ae..34a7e7f30 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/PasswordPolicyMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/PasswordPolicyMapper.xml @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RegisterMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RegisterMapper.xml new file mode 100644 index 000000000..677af1346 --- /dev/null +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RegisterMapper.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RegistrationMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RegistrationMapper.xml index dc45b8fb2..31b52916d 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RegistrationMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RegistrationMapper.xml @@ -1,23 +1,17 @@ - - - + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ReportMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ReportMapper.xml index ca6572852..b5da176f8 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ReportMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ReportMapper.xml @@ -1,82 +1,77 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ResourcesMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ResourcesMapper.xml index 208207b8b..f40a04bb4 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ResourcesMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/ResourcesMapper.xml @@ -1,55 +1,59 @@ - - - - - - - and res.id = #{id} - - - and res.appid = #{appId} - - - and res.parentid = #{parentId} - - - and res.name like '%${name}%' - - - - - - - - - - update mxk_resources set - status = '2' - where 1 = 1 - - and id = #{id} - - - and name = #{name} - - - - - - update mxk_resources set status='2' where id in - - #{item} - - - - + + + + + + + and res.id = #{id} + + + and res.appid = #{appId} + + + and res.parentid = #{parentId} + + + and res.name like '%${name}%' + + + + + + + + + update mxk_resources set + status = '2' + where instid = #{instId} + + and id = #{id} + + + and name = #{name} + + + + + + update mxk_resources + set status='2' + where instid = #{instId} + and id in + + #{item} + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RoleMemberMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RoleMemberMapper.xml index b3f487d33..da64d7c99 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RoleMemberMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RoleMemberMapper.xml @@ -1,261 +1,255 @@ - - - - - - - and id = #{id} - - - and name = #{name} - - - - - - - - - - - - - - - - - - insert into mxk_role_member( - id, - roleid, - memberid, - type - ) - select - concat_ws('-','UD','${id}',u.id) id, - '${id}' ROLEID, - u.id memberid, - 'USER-DYNAMIC' type - from mxk_userinfo u - where not exists( - select 1 from mxk_role_member rm - where rm.roleid=#{id} - and rm.memberid=u.id - and rm.type='USER-DYNAMIC' - ) - - ${filters} - - - and u.departmentid in( ${orgIdsList}) - - - - - delete from mxk_role_member rm - where type = 'USER-DYNAMIC' - and rm.roleid = #{id} - and not exists( - select 1 - from mxk_userinfo u - where 1 = 1 - and u.id=rm.memberid - - ${filters} - - - and u.departmentid in( ${orgIdsList}) - - ) - - - - delete from mxk_role_member rm - where rm.roleid=#{value} - - + + + + + + + and id = #{id} + + + and name = #{name} + + + + + + + + + + + + + + + + + + insert into mxk_role_member( + id, + roleid, + memberid, + type + ) + select + concat('${id}',u.id) id, + '${id}' ROLEID, + u.id memberid, + 'USER-DYNAMIC' type + from mxk_userinfo u + where not exists( + select 1 from mxk_role_member rm + where rm.roleid=#{id} + and rm.memberid=u.id + and rm.type='USER-DYNAMIC' + ) + + ${filters} + + + and u.departmentid in( ${orgIdsList}) + + + + + delete from mxk_role_member rm + where type = 'USER-DYNAMIC' + and rm.roleid = #{id} + and not exists( + select 1 + from mxk_userinfo u + where 1 = 1 + and u.id=rm.memberid + + ${filters} + + + and u.departmentid in( ${orgIdsList}) + + ) + + + + delete + from mxk_role_member rm + where rm.roleid = #{value} + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RolesMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RolesMapper.xml index 0c01ac414..ac3616cc9 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RolesMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/RolesMapper.xml @@ -1,92 +1,96 @@ - - - - - - - and id = #{id} - - - and name like '%${name}%' - - - - - - - - - - update mxk_roles set - status = '2' - where 1 = 1 - - and id = #{id} - - - and name = #{name} - - - - - - update mxk_roles set status='2' where id in - - #{item} - - - - - - - - update mxk_role_permissions set status=9 where id in - - #{item.id} - - - - - insert into mxk_role_permissions ( id,appid,roleid,resourceid,status) - values - - (#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status}) - - - - - + + + + + + + and id = #{id} + + + and name like '%${name}%' + + + + + + + + + + update mxk_roles set + status = '2' + where instid = #{instId} + + and id = #{id} + + + and name = #{name} + + + + + + update mxk_roles + set status='2' + where instid = #{instId} + and id in + + #{item} + + + + + + + + update mxk_role_permissions + set status = 9 + where 1 = 1 and + + ( id = #{item.id} and instid = #{item.instId} ) + + + + + insert into mxk_role_permissions ( id,appid,roleid,resourceid,status,instid) + values + + (#{item.id},#{item.appId},#{item.roleId},#{item.resourceId},#{item.status},#{item.instId}) + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/SocialsProviderMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/SocialsProviderMapper.xml new file mode 100644 index 000000000..146b88a8a --- /dev/null +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/SocialsProviderMapper.xml @@ -0,0 +1,27 @@ + + + + + + + and id = #{id} + + + and providerName like '%${providerName}%' + + + + + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/SynchronizersMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/SynchronizersMapper.xml index 100e745c1..ef7baa301 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/SynchronizersMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/SynchronizersMapper.xml @@ -2,24 +2,24 @@ - - - and id = #{id} - - - and name like '%${name}%' - + + + and id = #{id} + + + and name like '%${name}%' + - - - - + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/UserInfoAdjointMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/UserInfoAdjointMapper.xml index 9db4b63a0..ffd2efe3d 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/UserInfoAdjointMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/UserInfoAdjointMapper.xml @@ -1,49 +1,50 @@ - - - - - - - and id = #{id} - - - and userid = #{userId} - - - - - - - - - - update mxk_userinfo_adjunct set - status = '2' - where 1 = 1 - - and id = #{id} - - - and name = #{name} - - - - - - update mxk_userinfo_adjunct set status='2' where id in - - #{item} - - - - - + + + + + + + and id = #{id} + + + and userid = #{userId} + + + + + + + + + update mxk_userinfo_adjunct set + status = '2' + where instid = #{instId} + + and id = #{id} + + + and NAME = #{name} + + + + + + update mxk_userinfo_adjunct + set status='2' + where instid = #{instId} + and id in + + #{item} + + + + \ No newline at end of file diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/UserInfoMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/UserInfoMapper.xml index c9106db32..6b1c89415 100644 --- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/UserInfoMapper.xml +++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/postgresql/UserInfoMapper.xml @@ -1,252 +1,262 @@ - - - - - - - - - - update mxk_userinfo set - - islocked = #{isLocked}, - - modifieddate = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set - - islocked = #{isLocked}, - badpwdcount = 0, - - unlockdate = current_timestamp, - modifieddate = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set - - password = #{password}, - decipherable = #{decipherable}, - - passwordsettype = 0, - passwordlastsettime = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set - - sharedsecret = #{sharedSecret}, - sharedcounter = #{sharedCounter}, - - modifieddate = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set - - apploginpassword = #{appLoginPassword}, - - modifieddate = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set - - protectedapps = #{protectedApps}, - - modifieddate = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set - - passwordquestion = #{passwordQuestion}, - passwordanswer = #{passwordAnswer}, - - modifieddate = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set - - authntype = #{authnType}, - - modifieddate = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set - - email = #{email}, - - - emailverified = #{emailVerified}, - - - theme = #{theme}, - - modifieddate = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set - - mobile = #{mobile}, - - - mobileverified = #{mobileVerified}, - - modifieddate = current_timestamp - where - id = #{id} - - - - update mxk_userinfo set status='2' where id in - - #{item} - - - - - 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}, - - picture = #{picture}, - - 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 mxk_userinfo set + + islocked = #{isLocked}, + + modifieddate = current_timestamp + where + id = #{id} + + + + update mxk_userinfo set + + islocked = #{isLocked}, + badpwdcount = 0, + + unlockdate = current_timestamp, + modifieddate = current_timestamp + where + id = #{id} + + + + update mxk_userinfo set + + password = #{password}, + decipherable = #{decipherable}, + passwordsettype =#{passwordSetType}, + + passwordlastsettime = current_timestamp + where + id = #{id} + + + + update mxk_userinfo set + + sharedsecret = #{sharedSecret}, + sharedcounter = #{sharedCounter}, + + modifieddate = current_timestamp + where + id = #{id} + + + + update mxk_userinfo set + + apploginpassword = #{appLoginPassword}, + + modifieddate = current_timestamp + where + id = #{id} + + + + update mxk_userinfo set + + protectedapps = #{protectedApps}, + + modifieddate = current_timestamp + where + id = #{id} + + + + update mxk_userinfo set + + passwordquestion = #{passwordQuestion}, + passwordanswer = #{passwordAnswer}, + + modifieddate = current_timestamp + where + id = #{id} + + + + update mxk_userinfo set + + authntype = #{authnType}, + + modifieddate = current_timestamp + where + id = #{id} + + + + update mxk_userinfo set + + email = #{email}, + + + emailverified = #{emailVerified}, + + + theme = #{theme}, + + modifieddate = current_timestamp + where + id = #{id} + + + + update mxk_userinfo set + + mobile = #{mobile}, + + + mobileverified = #{mobileVerified}, + + modifieddate = current_timestamp + where + id = #{id} + + + + 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}, + + picture = #{picture}, + + 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} + + + + + + \ No newline at end of file