mirror of
https://gitee.com/easii/mapstruct-plus.git
synced 2025-12-06 09:08:54 +08:00
- 修改 @AutoMapping 注解,增加对 ElementType.ANNOTATION_TYPE 的支持
可以实现如下效果:
//新增dto使用注解,自动将当前用户映射到创建人字段
@AutoMapping(source = "operatorUserId", target = "createBy")
public @interface CreateMapper {
}
@AutoMapping(source = "operatorUserId", target = "createBy")
// 更新dto使用注解,自动将当前用户映射到updateBy字段
@AutoMapping(source = "operatorUserId", target = "updateBy")
public @interface UpdateMapper{
}
这样就可以将基类中的operatorUserId根据dto的不同,映射到对应的字段