This commit is contained in:
Looly 2022-11-10 12:11:56 +08:00
parent ff6adb3c68
commit fa115dffbc
2 changed files with 3 additions and 5 deletions

View File

@ -11,7 +11,6 @@
* 【db 】 DialectFactory增加identifyDriver重载issue#I5YWI6@Gitee * 【db 】 DialectFactory增加identifyDriver重载issue#I5YWI6@Gitee
* 【core 】 去除ClassloaderUtil的Cacheissue#I5YWI6@Gitee * 【core 】 去除ClassloaderUtil的Cacheissue#I5YWI6@Gitee
* 【core 】 ClassScanner 增加忽略加载错误类的扫描方法pr#855@Gitee * 【core 】 ClassScanner 增加忽略加载错误类的扫描方法pr#855@Gitee
* 【core 】 优化BeanPath.set方法避免多次重复调用get方法pr#865@Gitee
### 🐞Bug修复 ### 🐞Bug修复
* 【db 】 修复分页时order by截断问题issue#I5X6FM@Gitee * 【db 】 修复分页时order by截断问题issue#I5X6FM@Gitee

View File

@ -141,16 +141,15 @@ public class BeanPath implements Serializable {
* @param value * @param value
* @return * @return
*/ */
private Object set(Object bean, List<String> patternParts, boolean nextNumberPart, Object value) { private void set(Object bean, List<String> patternParts, boolean nextNumberPart, Object value) {
Object subBean = this.get(patternParts, bean, true); Object subBean = this.get(patternParts, bean, true);
if (null == subBean) { if (null == subBean) {
final List<String> parentParts = getParentParts(patternParts); final List<String> parentParts = getParentParts(patternParts);
this.set(bean, parentParts, lastIsNumber(parentParts), nextNumberPart ? new ArrayList<>() : new HashMap<>()); this.set(bean, parentParts, lastIsNumber(parentParts), nextNumberPart ? new ArrayList<>() : new HashMap<>());
// 避免get方法的重复调用 //set中有可能做过转换因此此处重新获取bean
subBean = this.set(bean, parentParts, lastIsNumber(parentParts), nextNumberPart ? new ArrayList<>() : new HashMap<>()); subBean = this.get(patternParts, bean, true);
} }
BeanUtil.setFieldValue(subBean, patternParts.get(patternParts.size() - 1), value); BeanUtil.setFieldValue(subBean, patternParts.get(patternParts.size() - 1), value);
return value;
} }
/** /**