我这里是拿商品做为例子
不多说直接上代码
Mapper.xml
实体类:
public class Commodity { private Integer productId; private Integer categoryId; private String productCode; private String productName; private String productContent; private Standard standard; //第一个表的实体类 private Dommodityattribute dommodityattribute; //第二个表的实体类 然后再提供 get 和 set 的方法 public Standard getStandard() { return standard; } public void setStandard(Standard standard) { this.standard = standard; } public Dommodityattribute getDommodityattribute() { return dommodityattribute; } public void setDommodityattribute(Dommodityattribute dommodityattribute) { this.dommodityattribute = dommodityattribute; } public Integer getProductId() { return productId; } public void setProductId(Integer productId) { this.productId = productId; } public Integer getCategoryId() { return categoryId; } public void setCategoryId(Integer categoryId) { this.categoryId = categoryId; } public String getProductCode() { return productCode; } public void setProductCode(String productCode) { this.productCode = productCode == null ? null : productCode.trim(); } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName == null ? null : productName.trim(); } public String getProductContent() { return productContent; } public void setProductContent(String productContent) { this.productContent = productContent == null ? null : productContent.trim(); }}
希望能帮助大家,谢谢。