小组权限数据变更 小组下角色权限数据丢失的问题解决
This commit is contained in:
parent
49c26905a9
commit
781a17337e
Binary file not shown.
@ -373,7 +373,7 @@ public class CooperationWeb extends ActionWeb {
|
||||
if (isOk) {
|
||||
api.removeCooperationTeamPerms(teamId);
|
||||
// 小组权限数据变更 小组下角色的权限数据也应该随着变更 用户应该在小组管理为除设计成员、浏览成员之外的角色重新配置数据
|
||||
api.removeCooperationRolePerms(teamId);
|
||||
// api.removeCooperationRolePerms(teamId);
|
||||
|
||||
if (repositoryVerIds.size() > 0) {
|
||||
// 创建权限信息
|
||||
@ -384,6 +384,9 @@ public class CooperationWeb extends ActionWeb {
|
||||
}
|
||||
isOk = api.createCooperationTeamPerms(perms);
|
||||
msg = "更新小组数据权限信息";
|
||||
|
||||
// 小组权限数据变更 小组下角色权限数据 如果不存在新的小组权限数据中 则删除
|
||||
api.handleTeamRolePermData(repositoryVerIds, teamId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
@ -1051,4 +1051,32 @@ public class CoeCooperationAPIManager {
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小组权限数据变更 小组下角色权限数据
|
||||
* 如果不存在新的小组权限数据中 则删除
|
||||
* @param teamPermData
|
||||
* @param teamId
|
||||
*/
|
||||
public void handleTeamRolePermData(JSONArray teamPermData, String teamId){
|
||||
// 根据小组查询所有角色
|
||||
List<CoeCooperationRoleModel> allRoleList = new CoeCooperationRoleDao().getCooperationAllRoleByTeam(teamId);
|
||||
CoeCooperationRolePermDao rolePermDao = new CoeCooperationRolePermDao();
|
||||
for (CoeCooperationRoleModel roleModel : allRoleList) {
|
||||
// 查询角色下权限数据
|
||||
List<String> rolePermDataList = rolePermDao.getRolePermListByRole(teamId, roleModel.getId());
|
||||
if (rolePermDataList != null && rolePermDataList.size() > 0){
|
||||
Set<String> deleteIds = new HashSet<>();
|
||||
for (String id : rolePermDataList) {
|
||||
if (!teamPermData.contains(id)){
|
||||
deleteIds.add(id);
|
||||
}
|
||||
}
|
||||
if (deleteIds.size() > 0){
|
||||
// 删除不在小组权限范围内的数据
|
||||
rolePermDao.removeDataByTeamAndPalVersionIds(teamId, roleModel.getId(), deleteIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -188,6 +188,16 @@ public class CoeCooperationRoleDao extends DaoObject<CoeCooperationRoleModel> {
|
||||
return DBSql.query(sql, rowMapper(), new Object[]{teamId});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据小组查询所有角色
|
||||
* @param teamId
|
||||
* @return
|
||||
*/
|
||||
public List<CoeCooperationRoleModel> getCooperationAllRoleByTeam(String teamId) {
|
||||
String sql = "SELECT * FROM " + entityName() + " WHERE " + CoeCooperationRoleModel.TEAMID + " =? ";
|
||||
return DBSql.query(sql, rowMapper(), new Object[]{teamId});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户在某小组的角色
|
||||
* @param teamId
|
||||
|
||||
@ -10,10 +10,7 @@ import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.exception.AWSDataAccessException;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description TODO
|
||||
@ -124,6 +121,25 @@ public class CoeCooperationRolePermDao extends DaoObject<CoeCooperationRolePermM
|
||||
DBSql.update(sql, new Object[]{teamId, roleId});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据小组、角色删除指定的数据
|
||||
* @param teamId
|
||||
* @param roleId
|
||||
* @param palVerIds
|
||||
* @throws AWSDataAccessException
|
||||
*/
|
||||
public void removeDataByTeamAndPalVersionIds(String teamId, String roleId, Set<String> palVerIds) throws AWSDataAccessException {
|
||||
StringBuffer ids = new StringBuffer();
|
||||
for (String verId : palVerIds) {
|
||||
ids.append(",").append("'").append(verId).append("'");
|
||||
}
|
||||
String verIds = ids.substring(1, ids.length());
|
||||
String sql = "delete from " + entityName()
|
||||
+ " where " + CoeCooperationRolePermModel.TEAMID + " = '" + teamId
|
||||
+ "' and " + CoeCooperationRolePermModel.ROLEID + " = '" + roleId + "' and " + CoeCooperationRolePermModel.PALVERSIONID + " in (" + verIds + ")";
|
||||
DBSql.update(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
* @param list
|
||||
|
||||
Loading…
Reference in New Issue
Block a user