damonxue commented on code in PR #4515:
URL: https://github.com/apache/shenyu/pull/4515#discussion_r1153917425
##########
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/RuleServiceImpl.java:
##########
@@ -154,8 +155,26 @@ public int update(final RuleDTO ruleDTO) {
final int ruleCount = ruleMapper.updateSelective(ruleDO);
// need old data for cleaning
- final List<RuleConditionDO> beforeRuleCondition =
ruleConditionMapper.selectByQuery(new RuleConditionQuery(ruleDO.getId()));
-
+ List<RuleConditionDO> beforeRuleCondition =
ruleConditionMapper.selectByQuery(new RuleConditionQuery(ruleDO.getId()));
+ List<RuleConditionDTO> beforRuleCondition =
beforeRuleCondition.stream().map(ruleConditionDO ->
+ RuleConditionDTO.builder()
+ .ruleId(ruleConditionDO.getRuleId())
+ .operator(ruleConditionDO.getOperator())
+ .paramName(ruleConditionDO.getParamName())
+ .paramType(ruleConditionDO.getParamType())
+ .paramValue(ruleConditionDO.getParamValue())
+ .build()).collect(Collectors.toList());
+ List<RuleConditionDTO> currentRuleCondition =
ruleDTO.getRuleConditions().stream().map(ruleConditionDTO ->
+ RuleConditionDTO.builder()
+ .ruleId(ruleConditionDTO.getRuleId())
+ .operator(ruleConditionDTO.getOperator())
+ .paramName(ruleConditionDTO.getParamName())
+ .paramType(ruleConditionDTO.getParamType())
+ .paramValue(ruleConditionDTO.getParamValue())
+ .build()).collect(Collectors.toList());
+ if (CollectionUtils.isEqualCollection(beforRuleCondition,
currentRuleCondition)) {
Review Comment:
Maybe `beforeRuleDtos` and `currentRuleDtos` are more clear than
(`beforRuleCondition` vs `beforeRuleCondition`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]