@Override
    public int update(final SelectorDTO selectorDTO) {
        final SelectorDO before = selectorMapper.selectById(selectorDTO.getId());
        SelectorDO selectorDO = SelectorDO.buildSelectorDO(selectorDTO);
        final int selectorCount = selectorMapper.updateSelective(selectorDO);

        // need old data for cleaning
        List<SelectorConditionDO> beforeSelectorConditionList = selectorConditionMapper.selectByQuery(new SelectorConditionQuery(selectorDO.getId()));
        List<RuleConditionDTO> beforeCondition = beforeSelectorConditionList.stream().map(selectorConditionDO ->
                SelectorConditionDTO.builder()
                        .selectorId(selectorConditionDO.getSelectorId())
                        .operator(selectorConditionDO.getOperator())
                        .paramName(selectorConditionDO.getParamName())
                        .paramType(selectorConditionDO.getParamType())
                        .paramValue(selectorConditionDO.getParamValue())
                        .build()).collect(Collectors.toList());
        List<RuleConditionDTO> currentCondition = selectorDTO.getSelectorConditions().stream().map(selectorConditionDTO ->
                SelectorConditionDTO.builder()
                        .selectorId(selectorConditionDTO.getSelectorId())
                        .operator(selectorConditionDTO.getOperator())
                        .paramName(selectorConditionDTO.getParamName())
                        .paramType(selectorConditionDTO.getParamType())
                        .paramValue(selectorConditionDTO.getParamValue())
                        .build()).collect(Collectors.toList());
        if (CollectionUtils.isEqualCollection(beforeCondition, currentCondition)) {
            beforeSelectorConditionList = Collections.emptyList();
        }

        //delete rule condition then add
        selectorConditionMapper.deleteByQuery(new SelectorConditionQuery(selectorDO.getId()));
        createCondition(selectorDO.getId(), selectorDTO.getSelectorConditions());
        publishEvent(selectorDO, selectorDTO.getSelectorConditions(), beforeSelectorConditionList);
        if (selectorCount > 0) {
            selectorEventPublisher.onUpdated(selectorDO, before);
        }
        return selectorCount;
    }
create or update selector.

@param selectorDTO {@linkplain SelectorDTO}
@return rows
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/SelectorServiceImpl.java