Closed wzkris closed 5 months ago
这个是mapstruct处理集合默认策略的问题。
MapStruct 提供的解决方案是在 Mapper
注解中,配置 collectionMappingStrategy = CollectionMappingStrategy.TARGET_IMMUTABLE
。
但 MapStructPlus 的 AutoMapper
注解暂时没有增加该配置项。
可以通过如下方式临时解决:
自定义两个转换接口:
LoginUserToLoginUserVOMapper
继承自 BaseMapper<LoginUser, LoginUserVO>
,增加 Mapper
注解,及配置项:collectionMappingStrategy
LoingUserVOToLoginUserMapper
这样子可以临时解决该问题,下个版本增加 collectionMappingStrategy
配置项
增加自定义转换接口后,LoginUser
和 LoginUserVO
的 AutoMapper
注解需要去掉
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
但是生成的代码报错,如下 但是我用set编译器就不会报错