addPermissionForUser方法

@ Transactional(rollbackFor = Exception.class)
public   void addPermissionForUser( String userName, ListuserPermissionDTOList){
if (CollectionUtils. isEmpty(userPermissionDTOList)){
return;
for (UserPermissionDTOuserPermissionDTO:userPermissionDTOList){
IndexPattern
indexPattern=indexPatternService. getIndexPattemByName(userPermissionDTO. getIndexPatternN   ame());
if(indexPattern!= null){
Long indexPatternId=indexPattern. getId();
UserPermission  permissionOld= new
UserPermission(userName,indexPatternId);
UserPermission permissionNew = new UserPermission(userName,
indexPatternId,userPermissionDTO. getEffectiveDate(),userPermissionDTO. getPermanentFlag());
//新增 先删后加 防止重复插入操作导致失败
userPermissionMapper. delete(permissionOld);
//新增结束
userPermissionMapper. insert(permissionNew);
}
}
}

posted @ 2024-11-21 16:47  一曲微茫  阅读(2)  评论(0编辑  收藏  举报