26 lines
693 B
Java
26 lines
693 B
Java
package com.knowledge.base.infrastructure.converter;
|
|
|
|
import com.knowledge.base.domain.user.model.UserDO;
|
|
import com.knowledge.base.infrastructure.north.dto.user.UserDTO;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
/**
|
|
* @author Luke.ye
|
|
* @date 2025/6/9 09:44
|
|
*/
|
|
public class UserDtoConverter {
|
|
public static UserDO toDO(UserDTO dto) {
|
|
if (dto == null) return null;
|
|
UserDO doObj = new UserDO();
|
|
BeanUtils.copyProperties(dto, doObj);
|
|
return doObj;
|
|
}
|
|
public static UserDTO toDTO(UserDO doObj) {
|
|
if (doObj == null) return null;
|
|
UserDTO dto = new UserDTO();
|
|
BeanUtils.copyProperties(doObj, dto);
|
|
return dto;
|
|
}
|
|
}
|
|
|