【发布时间】:2021-03-25 21:58:14
【问题描述】:
我的意思是,例如,我有 ProductDTO 和 OrderDetail 类。我想忽略 json 上的价格字段,因为价格是可变的,我想保持购买价格。 这是我的 ProductDTO:
public class ProductDTO {
String id;
String name;
String description;
int price; //I want to ignore this one
String brand;
String size;
int stockCount;
String type;
String color;
String gender;
}
这是我的 OrderDetail 类:
public class OrderDetail {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
int price;
ProductDTO productDTO;
}
【问题讨论】:
标签: java json spring-boot spring-data