1.创建项目结构
2在项目中对照表的结构创建User实体类
package com.cyh.bean;
public class User {
private Integer userId;
private String userName;
private String pwd;
private String sex;
private String addr;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getAddr() {
return addr;
}
public void setAddr(String addr) {
this.addr = addr;
}
public User() {
super();
}
public User(Integer userId, String userName, String pwd, String sex, String addr) {
super();
this.userId = userId;
this.userName = userName;
this.pwd = pwd;
this.sex = sex;
this.addr = addr;
}
@Override
public String toString() {
return "User [userId=" + userId + ", userName=" + userName + ", pwd=" + pwd + ", sex=" + sex + ", addr=" + addr
+ "]";
}
}
2在项目中对照表的结构创建Goods实体类
package com.cyh.bean;
public class Goods {
private Integer goodsId;
private String goodsName;
private Double price;
private Integer stock;
private String supplier;
public Goods() {
}
public Goods(Integer goodsId, String goodsName, Double price, Integer stock, String supplier) {
this.goodsId = goodsId;
this.goodsName = goodsName;
this.price = price;
this.stock = stock;
this.supplier = supplier;
}
@Override
public String toString() {
return "Goods{" +
"goodsId=" + goodsId +
", goodsName='" + goodsName + '\'' +
", price=" + price +
", stock=" + stock +
", supplier='" + supplier + '\'' +
'}';
}
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public void setPrice(Double price) {
this.price = price;
}
public void setStock(Integer stock) {
this.stock = stock;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public Integer getGoodsId() {
return goodsId;
}
public String getGoodsName() {
return goodsName;
}
public Double getPrice() {
return price;
}
public Integer getStock() {
return stock;
}
public String getSupplier() {
return supplier;
}
}