diff --git a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/RolesMapper.xml b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/RolesMapper.xml
index 3c52ea468e073e5625e1aa96e9532a5a5df7b411..8c5c102ebee4fd2a1c09c271d0acbf10bacc502c 100644
--- a/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/RolesMapper.xml
+++ b/maxkey-persistence/src/main/resources/org/maxkey/persistence/mapper/xml/mysql/RolesMapper.xml
@@ -78,10 +78,9 @@
update mxk_role_permissions
set status=9
- where instid = #{instId}
- and id in
-
- #{item.id}
+ where 1 = 1 and
+
+ ( id = #{item.id} and instid = #{item.instId} )
diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/PermissionsController.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/PermissionsController.java
index 426b05e1269180dcfebb728efba949e969740bd6..0a5a4c9f00f5f2e2699e544af9d1f2b68a29ad81 100644
--- a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/PermissionsController.java
+++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/PermissionsController.java
@@ -61,12 +61,12 @@ public class PermissionsController {
public Message insert(@ModelAttribute("rolePermissions") RolePermissions rolePermissions) {
_logger.debug("-save :" + rolePermissions);
//have
-
+ String instId = WebContext.getUserInfo().getInstId();
RolePermissions queryRolePermissions =
new RolePermissions(
rolePermissions.getAppId(),
rolePermissions.getRoleId(),
- WebContext.getUserInfo().getInstId());
+ instId);
List rolePermissionsedList = rolesService.queryRolePermissions(queryRolePermissions);
HashMappermedMap =new HashMap();
@@ -82,8 +82,9 @@ public class PermissionsController {
RolePermissions newRolePermissions=new RolePermissions(
rolePermissions.getAppId(),
rolePermissions.getRoleId(),
- resourceId);
- newRolePermissions.setInstId(WebContext.getUserInfo().getInstId());
+ resourceId,
+ instId);
+ newRolePermissions.setId(newRolePermissions.generateId());
newPermsMap.put(newRolePermissions.getUniqueId(), rolePermissions.getAppId());
if(!rolePermissions.getAppId().equalsIgnoreCase(resourceId) &&
@@ -96,6 +97,7 @@ public class PermissionsController {
ArrayList deleteRolePermissionsList =new ArrayList();
for(RolePermissions rolePerms : rolePermissionsedList) {
if(!newPermsMap.containsKey(rolePerms.getUniqueId())) {
+ rolePerms.setInstId(instId);
deleteRolePermissionsList.add(rolePerms);
}
}