@Schema(description = "可见租户ID列表") private List<Long> tenantIds; @Schema(description =…
- User
@Schema(description = "可见租户ID列表") private List tenantIds;
code@Schema(description = "全选租户 若全选租户则租户ID列表为null") private Boolean allTenantVisible;我认为我目前的处理是合理的,如果全选租户则tenantIds为null
Assistant
你说的有道理,如果设计上明确约定
allTenantVisible为true时tenantIds必须为null,那么你目前的逻辑是合理的。我之前的建议是基于一种更通用的情况,即
tenantIds可以同时存在,并且allTenantVisible用于覆盖或补充tenantIds的内容。既然你明确了设计约束,那么代码中的逻辑就更清晰了。
总结:
- 设计约束明确:
allTenantVisible = true时,tenantIds必须为null。 - 代码逻辑合理: 你的代码符合这个设计约束,并且能够正确处理全选和部分选择的情况。
- 设计约束明确:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.