pagehelper / pagehelper-spring-boot

pagehelper-spring-boot
MIT License
1.55k stars 312 forks source link

异步count,Parameter '__frch_item_0' not found #176

Open chenyu65535 opened 5 months ago

chenyu65535 commented 5 months ago

PageInterceptor.asyncCount()方法复制BoundSql的时候没有将additionalParameters 复制过去

chenyu65535 commented 5 months ago

PageInterceptor line 186 行 添加解决 BeanUtil.setFieldValue(boundSql, countBoundSql, "additionalParameters");

public static void setFieldValue(T original, T target, String fieldName) { if (original == null || target == null || StringUtils.isBlank(fieldName)) { return; } try { Field field = original.getClass().getDeclaredField(fieldName); field.setAccessible(true); ReflectionUtils.setField(field, target, field.get(original)); } catch (NoSuchFieldException | IllegalAccessException e) { } }