|
|
|
|
@ -13,14 +13,33 @@ public class Item implements Serializable {
|
|
|
|
|
private String category;
|
|
|
|
|
private String location;
|
|
|
|
|
private String contact;
|
|
|
|
|
private String contactQQ; // 新增QQ联系方式
|
|
|
|
|
private String contactWechat; // 新增微信联系方式
|
|
|
|
|
private long publishTime;
|
|
|
|
|
private String userId;
|
|
|
|
|
private int viewCount; // 浏览数
|
|
|
|
|
private int likeCount; // 点赞数
|
|
|
|
|
|
|
|
|
|
public Item() {
|
|
|
|
|
imageUrls = new ArrayList<>();
|
|
|
|
|
viewCount = 0;
|
|
|
|
|
likeCount = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Getters and Setters
|
|
|
|
|
// 构造函数
|
|
|
|
|
public Item(String title, String description, double price, String category, String location, String contact) {
|
|
|
|
|
this();
|
|
|
|
|
this.title = title;
|
|
|
|
|
this.description = description;
|
|
|
|
|
this.price = price;
|
|
|
|
|
this.category = category;
|
|
|
|
|
this.location = location;
|
|
|
|
|
this.contact = contact;
|
|
|
|
|
this.publishTime = System.currentTimeMillis();
|
|
|
|
|
this.userId = "user_" + System.currentTimeMillis();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Getter 和 Setter 方法
|
|
|
|
|
public String getId() { return id; }
|
|
|
|
|
public void setId(String id) { this.id = id; }
|
|
|
|
|
|
|
|
|
|
@ -35,6 +54,7 @@ public class Item implements Serializable {
|
|
|
|
|
|
|
|
|
|
public List<String> getImageUrls() { return imageUrls; }
|
|
|
|
|
public void setImageUrls(List<String> imageUrls) { this.imageUrls = imageUrls; }
|
|
|
|
|
public void addImageUrl(String imageUrl) { this.imageUrls.add(imageUrl); }
|
|
|
|
|
|
|
|
|
|
public String getCategory() { return category; }
|
|
|
|
|
public void setCategory(String category) { this.category = category; }
|
|
|
|
|
@ -45,9 +65,47 @@ public class Item implements Serializable {
|
|
|
|
|
public String getContact() { return contact; }
|
|
|
|
|
public void setContact(String contact) { this.contact = contact; }
|
|
|
|
|
|
|
|
|
|
public String getContactQQ() { return contactQQ; }
|
|
|
|
|
public void setContactQQ(String contactQQ) { this.contactQQ = contactQQ; }
|
|
|
|
|
|
|
|
|
|
public String getContactWechat() { return contactWechat; }
|
|
|
|
|
public void setContactWechat(String contactWechat) { this.contactWechat = contactWechat; }
|
|
|
|
|
|
|
|
|
|
public long getPublishTime() { return publishTime; }
|
|
|
|
|
public void setPublishTime(long publishTime) { this.publishTime = publishTime; }
|
|
|
|
|
|
|
|
|
|
public String getUserId() { return userId; }
|
|
|
|
|
public void setUserId(String userId) { this.userId = userId; }
|
|
|
|
|
|
|
|
|
|
public int getViewCount() { return viewCount; }
|
|
|
|
|
public void setViewCount(int viewCount) { this.viewCount = viewCount; }
|
|
|
|
|
|
|
|
|
|
public int getLikeCount() { return likeCount; }
|
|
|
|
|
public void setLikeCount(int likeCount) { this.likeCount = likeCount; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 增加浏览数
|
|
|
|
|
*/
|
|
|
|
|
public void incrementViewCount() {
|
|
|
|
|
this.viewCount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 增加点赞数
|
|
|
|
|
*/
|
|
|
|
|
public void incrementLikeCount() {
|
|
|
|
|
this.likeCount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
|
|
|
|
return "Item{" +
|
|
|
|
|
"id='" + id + '\'' +
|
|
|
|
|
", title='" + title + '\'' +
|
|
|
|
|
", price=" + price +
|
|
|
|
|
", category='" + category + '\'' +
|
|
|
|
|
", location='" + location + '\'' +
|
|
|
|
|
", publishTime=" + publishTime +
|
|
|
|
|
'}';
|
|
|
|
|
}
|
|
|
|
|
}
|