一、手写
public class ObjectModel implements Serializable {
public <T> T fromDTO(Object record, Class<T> Class) {
return JSONObject.parseObject(JSONObject.toJSONString(record), Class);
}
}
二、org.springframework.beans.BeanUtils
BeanUtils.copyProperties(inDto,data);