package com.songshu.mongo.model.dto; import com.wordnik.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import java.io.Serializable; /** * 案例表demo1 */ //@Document如果数据库中使用的表名与实体类不同名必须增加Document注解,一致可省略。 @Data @Document(collection = "demo1") public class BookDTO implements Serializable { //id属性是给mongodb用的,用@Id注解修饰 @Id private String id; // 书名 private String name; // 价格 private String price; // 类型 private String type; // 阅读量 private Double readedNum; }