This commit is contained in:
whz 2024-05-14 10:00:47 +08:00
parent 80a5a31141
commit aac247698e

View File

@ -13,5 +13,14 @@ public interface UserMapper {
UserDto toDto(User user); UserDto toDto(User user);
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)User partialUpdate(UserDto userDto, @MappingTarget User user); /**
* 对用户实体进行部分更新
* 该方法用于将用户DTO中的非空属性值复制到现有的用户实体中忽略空属性
*
* @param userDto 用户的DTO对象包含需要更新的数据
* @param user 现有的用户实体将被更新
* @return 更新后的用户实体对象
*/
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
User partialUpdate(UserDto userDto, @MappingTarget User user);
} }