mayi-upms/mayi-upms-biz/src/main/java/com/zf1976/mayi/upms/biz/service/SysUserService.java
private void updateDependents(@NotNull UserDTO dto){
            Assert.notNull(dto, "user dto cannot been null");
            Assert.notNull(dto.getId(), "user id cannot been null");
            Assert.notNull(dto.getUsername(), "username cannot been null");
            // user id
            final Long userId = dto.getId();
            // user post id collection
            final var preUpdatePositionIds = dto.getPositionIds();
            if (!CollectionUtils.isEmpty(preUpdatePositionIds)) {
                final var positionIds = new HashSet<>(super.baseMapper.selectPositionRelationById(userId));
                if (CollectionUtil.notEq(preUpdatePositionIds, positionIds)) {
                    super.baseMapper.deletePositionRelationById(userId);
                    super.baseMapper.savePositionRelationById(userId, preUpdatePositionIds);
                }
            }
            // user role id collection
            final var preUpdateRoleIds = dto.getRoleIds();
            if (!CollectionUtils.isEmpty(preUpdateRoleIds)) {
                final var roleIds = new HashSet<>(super.baseMapper.selectRoleRelationById(userId));
                if (CollectionUtil.notEq(preUpdateRoleIds, roleIds)) {
                    // revoke user authentication
                    Context.revokeAuthentication(dto.getUsername());
                    super.baseMapper.deleteRoleRelationById(userId);
                    super.baseMapper.savaRoleRelationById(userId, preUpdateRoleIds);
                }
            }
        }
/**
         * update user dependencies
         *
         * @param dto dto
         */
update user dependencies
@param dto dto
update user dependencies @param dto dto
private void updateDependents(@NotNull UserDTO dto){
            Assert.notNull(dto, "user dto cannot been null");
            Assert.notNull(dto.getId(), "user id cannot been null");
            Assert.notNull(dto.getUsername(), "username cannot been null");
            final Long userId = dto.getId();
            final var preUpdatePositionIds = dto.getPositionIds();
            if (!CollectionUtils.isEmpty(preUpdatePositionIds)) {
                final var positionIds = new HashSet<>(super.baseMapper.selectPositionRelationById(userId));
                if (CollectionUtil.notEq(preUpdatePositionIds, positionIds)) {
                    super.baseMapper.deletePositionRelationById(userId);
                    super.baseMapper.savePositionRelationById(userId, preUpdatePositionIds);
                }
            }
            final var preUpdateRoleIds = dto.getRoleIds();
            if (!CollectionUtils.isEmpty(preUpdateRoleIds)) {
                final var roleIds = new HashSet<>(super.baseMapper.selectRoleRelationById(userId));
                if (CollectionUtil.notEq(preUpdateRoleIds, roleIds)) {
                    Context.revokeAuthentication(dto.getUsername());
                    super.baseMapper.deleteRoleRelationById(userId);
                    super.baseMapper.savaRoleRelationById(userId, preUpdateRoleIds);
                }
            }
        }
private void updateDependents ( @ NotNull UserDTO dto ) { Assert . notNull ( dto , "user dto cannot been null" ) ; Assert . notNull ( dto . getId ( ) , "user id cannot been null" ) ; Assert . notNull ( dto . getUsername ( ) , "username cannot been null" ) ; final Long userId = dto . getId ( ) ; final var preUpdatePositionIds = dto . getPositionIds ( ) ; if ( ! CollectionUtils . isEmpty ( preUpdatePositionIds ) ) { final var positionIds = new HashSet < > ( super . baseMapper . selectPositionRelationById ( userId ) ) ; if ( CollectionUtil . notEq ( preUpdatePositionIds , positionIds ) ) { super . baseMapper . deletePositionRelationById ( userId ) ; super . baseMapper . savePositionRelationById ( userId , preUpdatePositionIds ) ; } } final var preUpdateRoleIds = dto . getRoleIds ( ) ; if ( ! CollectionUtils . isEmpty ( preUpdateRoleIds ) ) { final var roleIds = new HashSet < > ( super . baseMapper . selectRoleRelationById ( userId ) ) ; if ( CollectionUtil . notEq ( preUpdateRoleIds , roleIds ) ) { Context . revokeAuthentication ( dto . getUsername ( ) ) ; super . baseMapper . deleteRoleRelationById ( userId ) ; super . baseMapper . savaRoleRelationById ( userId , preUpdateRoleIds ) ; } } }
update user dependencies
 @param dto dto
update user dependencies @param dto dto
// user id // user post id collection // user role id collection // revoke user authentication